이전
dalla sh script
dev_deploy
#!/bin/sh
REPOSITORY=~/deploy
ORIGIN=origin
repo=("a_repo" "b_repo" "c_repo" "d_repo" "e_repo" "f_admin")
jenkins=("a_jenkins" "b_jenkins" "c_jenkins" "d_jenkins" "e_jenkins" "f_jenkins")
profile=("real" "stage")
for((var=0; var<${#repo[@]}; var++))
do
echo $var : ${repo[var]}
done
read -p "배포할 프로젝트 선택:" PROJECT
echo "디렉토리 이동" $REPOSITORY/${repo[$PROJECT]}
cd $REPOSITORY/${repo[$PROJECT]}
echo "깃 페치(git fetch origin -p)"
git fetch origin -p
read -p "병합할 브랜치명 작성 : origin/" BRANCH
echo "깃 병합(git merge --ff-only)" $ORIGIN/$BRANCH
git merge --ff-only $ORIGIN/$BRANCH
echo "깃 푸시(git push origin HEAD:release)" $ORIGIN/$BRANCH
git push origin HEAD:release
for((var=0; var<${#jenkins[@]}; var++))
do
echo $var : ${jenkins[var]}
done
read -p "빌드할 프로젝트 선택:" BUILD
if [ ${jenkins[$BUILD]} == "a_jenkins" ]
then
for((var=0; var<${#profile[@]}; var++))
do
echo $var : ${profile[var]}
done
read -p "빌드할 변수 입력:" NPM_RUN
echo ${profile[$NPM_RUN]}
curl --location 'http://localhost:8180/jenkins/job/'${jenkins[$BUILD]}'/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'NPM_RUN='${profile[$NPM_RUN]}
else
curl --location 'http://localhost:8180/jenkins/job/'${jenkins[$BUILD]}'/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes'
fi
real_deploy
#!/bin/sh
deploy=("FRONT" "API" "PAY")
for((var=0; var<${#deploy[@]}; var++))
do
echo $var : ${deploy[var]}
done
read -p "Select the number to deploy real server:" DEPLOY
if [ ${deploy[$DEPLOY]} == "FRONT" ]
then
echo "www서버의 instance 1번(WAS1 : ~/public_html/)만 제외시작."
curl --location 'http://localhost:8180/jenkins/job/a_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=1'
sleep 50
echo "m서버의 instance 1번(WAS1 : ~/public_m/)으로 배포시작."
curl --location 'http://localhost:8180/jenkins/job/a_project_sync/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'DIST_INSTANCE1=true'
sleep 50
echo "www서버의 instance 2번(WAS2 : ~/public_html/)만 제외시작."
curl --location 'http://localhost:8180/jenkins/job/a_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=2'
sleep 50
echo "m서버의 instance 2번(WAS2 : ~/public_m/)으로 배포시작."
curl --location 'http://localhost:8180/jenkins/job/a_project_sync/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'DIST_INSTANCE2=true'
sleep 50
echo "none : 제외 없이 www서버의 모든 instance를 사용한다."
curl --location 'http://localhost:8180/jenkins/job/a_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=none'
elif [ ${deploy[$DEPLOY]} == "API" ]
then
echo "api서버의 instance 1번(WAS1 : ~/public_html/)만 제외시작."
curl --location 'http://localhost:8180/jenkins/job/b_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=1'
sleep 50
echo "api서버의 instance 1번(WAS1 : ~/public_api/)으로 배포시작"
curl --location 'http://localhost:8180/jenkins/job/b_project_sync/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'DIST_INSTANCE1=true'
sleep 50
echo "api서버의 instance 2번(WAS2 : ~/public_html/)만 제외시작."
curl --location 'http://localhost:8180/jenkins/job/b_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=2'
sleep 50
echo "api서버의 instance 2번(WAS1 : ~/public_api/)으로 배포시작."
curl --location 'http://localhost:8180/jenkins/job/b_project_sync/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'DIST_INSTANCE2=true'
sleep 50
echo "none : 제외 없이 api서버의 모든 instance를 사용한다."
curl --location 'http://localhost:8180/jenkins/job/a_project_unbindbuildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=none'
elif [ ${deploy[$DEPLOY]} == "PAY" ]
then
echo "pay서버의 instance 1번(WAS1 : ~/public_html/)만 제외시작."
curl --location 'http://localhost:8180/jenkins/job/c_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=1'
sleep 50
echo "pay서버의 instance 1번(WAS1 : ~/public_html/)으로 배포시작."
curl --location 'http://localhost:8180/jenkins/job/c_project_sync/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'DIST_INSTANCE1=true'
sleep 50
echo "pay서버의 instance 2번(WAS2 : ~/public_html/)만 제외시작."
curl --location 'http://localhost:8180/jenkins/job/c_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=2'
sleep 50
echo "pay서버의 instance 1번(WAS1 : ~/public_html/)으로 배포시작."
curl --location 'http://localhost:8180/jenkins/job/c_project_sync/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'DIST_INSTANCE2=true'
sleep 50
echo "none : 제외 없이 pay서버의 모든 instance를 사용한다."
curl --location 'http://localhost:8180/jenkins/job/c_project_unbind/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'EXCL_INSTANCE=none'
fi
get_off_dev.sh
#!/bin/sh
REPOSITORY=~/deploy
ORIGIN=origin
repo=("a_repo" "b_repo" "c_repo" "d_repo" "e_repo" "f_admin")
jenkins=("a_jenkins" "b_jenkins" "c_jenkins" "d_jenkins" "e_jenkins" "f_jenkins")
profile=("real" "stage")
for((var=0; var<${#repo[@]}; var++))
do
echo $var : ${repo[var]}
done
read -p "개발서버 내릴 프로젝트 선택:" PROJECT
echo "디렉토리 이동" $REPOSITORY/${repo[$PROJECT]}
cd $REPOSITORY/${repo[$PROJECT]}
echo "깃 페치(git fetch origin -p)"
git fetch origin -p
echo "깃 마스터 체크아웃(git checkout origin/master)"
git checkout origin/master
echo "깃 릴리즈 푸시강제(push origin HEAD:release -f)"
git push origin HEAD:release -f
for((var=0; var<${#jenkins[@]}; var++))
do
echo $var : ${jenkins[var]}
done
read -p "빌드할 프로젝트 선택:" BUILD
if [ ${jenkins[$BUILD]} == "a_jenkins" ]
then
for((var=0; var<${#profile[@]}; var++))
do
echo $var : ${profile[var]}
done
read -p "빌드할 변수 입력:" NPM_RUN
echo ${profile[$NPM_RUN]}
curl --location 'http://localhost:8180/jenkins/job/'${jenkins[$BUILD]}'/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'NPM_RUN='${profile[$NPM_RUN]}
else
curl --location 'http://localhost:8180/jenkins/job/'${jenkins[$BUILD]}'/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes'
fi
change_profile_a_jenkins.sh
#!/bin/sh
profile=("real" "stage")
for((var=0; var<${#profile[@]}; var++))
do
echo $var : ${profile[var]}
done
read -p "빌드할 변수 입력:" NPM_RUN
curl --location 'http://localhost:8180/jenkins/job/a_jenkins/buildWithParameters' \
--header 'Authorization: Basic API_Token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'Are_You_Sure=yes' \
--data-urlencode 'NPM_RUN='${profile[$NPM_RUN]}