Prepare Jenkins SSH credential verification
myfileagent-python-ci/pipeline/head This commit looks good
myfileagent-python-ci/pipeline/head This commit looks good
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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'
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user