Files
Codex 4cc9a2c6ac
myfileagent-python-ci/pipeline/head This commit looks good
Prepare Jenkins SSH credential verification
2026-11-04 20:23:14 +00:00

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'
'''
}
}
}
}
}