update deploy stage and smoke check for scripts #42
31
Jenkinsfile
vendored
31
Jenkinsfile
vendored
@@ -11,6 +11,8 @@ pipeline {
|
|||||||
APP_HOST = "${env.APP_HOST ?: '192.168.68.89'}"
|
APP_HOST = "${env.APP_HOST ?: '192.168.68.89'}"
|
||||||
APP_USER = "${env.APP_USER ?: 'deploy'}"
|
APP_USER = "${env.APP_USER ?: 'deploy'}"
|
||||||
DEPLOY_PATH = "${env.DEPLOY_PATH ?: '/opt/plesk-agency-portal'}"
|
DEPLOY_PATH = "${env.DEPLOY_PATH ?: '/opt/plesk-agency-portal'}"
|
||||||
|
APP_BASE_URL = "${env.APP_BASE_URL ?: 'https://portal.rdbcloud.co.uk}"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@@ -70,7 +72,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([sshUserPrivateKey(
|
withCredentials([sshUserPrivateKey(
|
||||||
credentialsId: "${env.DEPLOY_SSH_CREDENTIAL_ID}",
|
credentialsId: "${env.DEPLOY_SSH_CREDENTIAL_ID}",
|
||||||
@@ -78,26 +80,33 @@ pipeline {
|
|||||||
)]) {
|
)]) {
|
||||||
sh '''
|
sh '''
|
||||||
bash -eo pipefail << 'EOF'
|
bash -eo pipefail << 'EOF'
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
rsync -az \
|
ssh -i "$SSH_KEY" "$APP_USER@$APP_HOST" "mkdir -p $DEPLOY_PATH/scripts"
|
||||||
docker-compose.prod.yml \
|
|
||||||
scripts/ \
|
rsync -az \
|
||||||
-e "ssh -i $SSH_KEY" \
|
-e "ssh -i $SSH_KEY" \
|
||||||
$APP_USER@$APP_HOST:$DEPLOY_PATH/
|
docker-compose.prod.yml \
|
||||||
|
"$APP_USER@$APP_HOST:$DEPLOY_PATH/"
|
||||||
|
|
||||||
docker save ${IMAGE_LATEST} ${IMAGE_BUILD} \
|
rsync -az \
|
||||||
| ssh -i $SSH_KEY $APP_USER@$APP_HOST 'docker load'
|
-e "ssh -i $SSH_KEY" \
|
||||||
|
scripts/ \
|
||||||
|
"$APP_USER@$APP_HOST:$DEPLOY_PATH/scripts/"
|
||||||
|
|
||||||
ssh -i $SSH_KEY $APP_USER@$APP_HOST \
|
docker save ${IMAGE_LATEST} ${IMAGE_BUILD} \
|
||||||
|
| ssh -i "$SSH_KEY" "$APP_USER@$APP_HOST" 'docker load'
|
||||||
|
|
||||||
|
ssh -i "$SSH_KEY" "$APP_USER@$APP_HOST" \
|
||||||
"cd $DEPLOY_PATH && chmod +x ./scripts/deploy-prod.sh ./scripts/smoke-check.sh ./scripts/rollback-prod.sh"
|
"cd $DEPLOY_PATH && chmod +x ./scripts/deploy-prod.sh ./scripts/smoke-check.sh ./scripts/rollback-prod.sh"
|
||||||
|
|
||||||
ssh -i $SSH_KEY $APP_USER@$APP_HOST "cd $DEPLOY_PATH && ./scripts/deploy-prod.sh"
|
ssh -i "$SSH_KEY" "$APP_USER@$APP_HOST" \
|
||||||
|
"cd $DEPLOY_PATH && ./scripts/deploy-prod.sh"
|
||||||
EOF
|
EOF
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Smoke check') {
|
stage('Smoke check') {
|
||||||
steps {
|
steps {
|
||||||
|
|||||||
Reference in New Issue
Block a user