嵌入脚本-03
原 XMind 内的文本附件快照。仅展示,不执行;已识别口令会被遮蔽,其余路径、账号、凭据引用和环境假设仍需人工审查。
原资源:resources/c242a509307d6f3f51684cd0ecc9c5f9b34952273fab1608a391931d8fa14dd6.txt
pipeline {
// 选择运行节点
//agent none
agent {
label 'build01'
}
stages {
stage('build') {
// stage level agent
agent {
label 'linux'
}
steps {
echo 'build'
}
}
stage('test') {
steps{
echo "test"
}
}
stage('deploy'){
steps{
script{
//groovy script
println("hello")
// shell
result = sh returnStdout: true, script: 'echo 123' // 123\n
println(result - "\n")
// environment self
println("build id: ${BUILD_ID}")
println("job name: ${JOB_NAME}")
}
echo "deploy"
}
}
}
post {
always{
echo "always"
}
success {
// One or more steps need to be included within each condition's block.
echo "success"
}
failure {
// One or more steps need to be included within each condition's block.
echo "failure"
}
}
}
来源主题: