fix(ci): prevent ssh from consuming deploy-stage heredoc stdin
This commit is contained in:
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
@@ -99,20 +99,20 @@ ls -l "${SSH_KEY}"
|
|||||||
ssh-keygen -y -f "${SSH_KEY}"
|
ssh-keygen -y -f "${SSH_KEY}"
|
||||||
|
|
||||||
echo "Testing remote SSH connectivity"
|
echo "Testing remote SSH connectivity"
|
||||||
ssh ${SSH_OPTS} "${SSH_USER}@${APP_HOST}" "whoami && hostname && pwd"
|
ssh -n ${SSH_OPTS} "${SSH_USER}@${APP_HOST}" "whoami && hostname && pwd"
|
||||||
|
|
||||||
echo "Deploying image tag: ${IMAGE_BUILD}"
|
echo "Deploying image tag: ${IMAGE_BUILD}"
|
||||||
docker image inspect "${IMAGE_BUILD}" --format='{{.Id}} {{.RepoTags}}'
|
docker image inspect "${IMAGE_BUILD}" --format='{{.Id}} {{.RepoTags}}'
|
||||||
|
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" "mkdir -p $DEPLOY_PATH/scripts"
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" "mkdir -p $DEPLOY_PATH/scripts"
|
||||||
|
|
||||||
rsync -az \
|
rsync -az \
|
||||||
-e "ssh ${SSH_OPTS}" \
|
-e "ssh -n ${SSH_OPTS}" \
|
||||||
docker-compose.prod.yml \
|
docker-compose.prod.yml \
|
||||||
"$SSH_USER@$APP_HOST:$DEPLOY_PATH/"
|
"$SSH_USER@$APP_HOST:$DEPLOY_PATH/"
|
||||||
|
|
||||||
rsync -az \
|
rsync -az \
|
||||||
-e "ssh ${SSH_OPTS}" \
|
-e "ssh -n ${SSH_OPTS}" \
|
||||||
scripts/ \
|
scripts/ \
|
||||||
"$SSH_USER@$APP_HOST:$DEPLOY_PATH/scripts/"
|
"$SSH_USER@$APP_HOST:$DEPLOY_PATH/scripts/"
|
||||||
|
|
||||||
@@ -126,24 +126,24 @@ echo "Copying image archive to remote host via scp"
|
|||||||
scp ${SSH_OPTS} "${IMAGE_TAR}" "$SSH_USER@$APP_HOST:$DEPLOY_PATH/"
|
scp ${SSH_OPTS} "${IMAGE_TAR}" "$SSH_USER@$APP_HOST:$DEPLOY_PATH/"
|
||||||
|
|
||||||
echo "Verifying image archive exists on remote host"
|
echo "Verifying image archive exists on remote host"
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" "ls -lh $DEPLOY_PATH/plesk-agency-portal-build.tar"
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" "ls -lh $DEPLOY_PATH/plesk-agency-portal-build.tar"
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" "sha256sum $DEPLOY_PATH/plesk-agency-portal-build.tar"
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" "sha256sum $DEPLOY_PATH/plesk-agency-portal-build.tar"
|
||||||
|
|
||||||
echo "Loading image archive on remote host"
|
echo "Loading image archive on remote host"
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" "docker load -i $DEPLOY_PATH/plesk-agency-portal-build.tar"
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" "docker load -i $DEPLOY_PATH/plesk-agency-portal-build.tar"
|
||||||
|
|
||||||
echo "Verifying exact image tag is available on remote host"
|
echo "Verifying exact image tag is available on remote host"
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" "docker image inspect ${IMAGE_BUILD} --format='{{.Id}} {{.RepoTags}}'"
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" "docker image inspect ${IMAGE_BUILD} --format='{{.Id}} {{.RepoTags}}'"
|
||||||
|
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" \
|
ssh -n ${SSH_OPTS} "$SSH_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"
|
||||||
|
|
||||||
echo "Running remote deploy script with exact image tag"
|
echo "Running remote deploy script with exact image tag"
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" \
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" \
|
||||||
"cd $DEPLOY_PATH && APP_IMAGE='${IMAGE_BUILD}' ./scripts/deploy-prod.sh"
|
"cd $DEPLOY_PATH && APP_IMAGE='${IMAGE_BUILD}' ./scripts/deploy-prod.sh"
|
||||||
|
|
||||||
echo "Printing final running container image metadata"
|
echo "Printing final running container image metadata"
|
||||||
ssh ${SSH_OPTS} "$SSH_USER@$APP_HOST" "docker inspect plesk-agency-portal --format='{{.Image}} {{.Created}}'"
|
ssh -n ${SSH_OPTS} "$SSH_USER@$APP_HOST" "docker inspect plesk-agency-portal --format='{{.Image}} {{.Created}}'"
|
||||||
EOF
|
EOF
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user