1
我在SSH管道腳本中使用SSH從節點作爲節點。在Jenkins管道中獲取SSH從節點主機名/ IP
有沒有辦法獲取管道(Jenkinsfile)腳本內節點的主機名/ IP?
我正在部署到參數化節點,並希望在腳本結尾處回顯節點的IP。
即:
node('master') {
checkout scm
stash name: 'deploy', includes: 'modules/ci/,modules/compose/'
}
stage ('Deploy to remote server (SSH)') {
node(${NODE}) {
unstash 'deploy'
withEnv(["BRANCH=${BRANCH}"]) {
sh "chmod +x modules/ci/deployment/*"
sh "modules/ci/deployment/update.sh"
}
echo 'Deployment was successful, branch ${BRANCH} was deployed to https://104.xx.xxx.xx (node IP/hostname)'
}
}