Prepare Jenkins SSH credential verification
myfileagent-python-ci/pipeline/head This commit looks good

This commit is contained in:
Codex
2026-11-04 20:23:14 +00:00
parent 80c7fe2bdc
commit 4cc9a2c6ac
2 changed files with 20 additions and 0 deletions
+17
View File
@@ -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'
'''
}
}
}
}
}