18 lines
638 B
Plaintext
18 lines
638 B
Plaintext
pipeline {
|
|
agent { label 'assignment8-trusted' }
|
|
options { timeout(time: 5, unit: 'MINUTES'); skipDefaultCheckout() }
|
|
stages {
|
|
stage('Checkout') { steps { checkout scm } }
|
|
stage('Verify deployment connection') {
|
|
steps {
|
|
withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY', usernameVariable: 'DEPLOY_USER')]) {
|
|
sh '''set +x
|
|
set -eu
|
|
ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WORKSPACE/secure-delivery/ansible/known_hosts" -i "$DEPLOY_KEY" "$DEPLOY_USER@172.20.0.1" 'id; sudo -n id'
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|