diff --git a/Jenkinsfile b/Jenkinsfile index d5a3584..edc264d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -76,16 +76,19 @@ pipeline { steps { script { // Run the deployment script on CT 112 via SSH - withCredentials([sshUserPrivateKey(credentialsId: 'confidence-engine-deploy-ssh')]) { - sh """ - ssh -o StrictHostKeyChecking=no \\ - root@${TARGET_HOST} \\ - "bash -s" \\ - < ${WORKSPACE}/scripts/deploy-production.sh \\ - "${DEPLOY_SHA}" \\ - "${DEPLOY_DIR}" \\ - "${HEALTH_URL}" - """ + withCredentials([sshUserPrivateKey( + credentialsId: 'confidence-engine-deploy-ssh', + keyFileVariable: 'SSH_KEY', + usernameVariable: 'SSH_USER' + )]) { + sh ''' + ssh \ + -i "$SSH_KEY" \ + -o StrictHostKeyChecking=yes \ + "$SSH_USER@$TARGET_HOST" \ + bash -s -- "$DEPLOY_SHA" "$DEPLOY_DIR" "$HEALTH_URL" \ + < "$WORKSPACE/scripts/deploy-production.sh" + ''' } } }