我正在使用jenkins声明性语法。我希望在作业A成功并提供一些参数后触发作业B. 这似乎对我有用,但是工作A仍然在运行直到工作B完成而工作A完成并且工作B开始:
工作A
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '3'))
}
parameters {
string(defaultValue: 'MAJOR.MINOR.PATCH', description: 'Version of Maven X.X.X-SNAPSHOT (+ Version of Support Branch)', name: 'VERSION')
}
stages {
stage('print') {
steps {
script {
echo env.VERSION
}
}
}
}
post {
always {
cleanWs()
}
success {
echo "hey"
build job: 'debug/job2', parameters: [[$class: 'StringParameterValue', name: 'PARAM', value: env.VERSION]]
}
}
}
工作B
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '3'))
}
parameters {
string(defaultValue: 'MAJOR.MINOR.PATCH', description: 'Version of Maven X.X.X-SNAPSHOT (+ Version of Support Branch)', name: 'PARAM')
}
stages {
stage('print') {
steps {
script {
echo env.TEST
}
}
}
}
}
一个问题
答案 0 :(得分:2)
请参阅此处的构建步骤文档:https://jenkins.io/doc/pipeline/steps/pipeline-build-step/
您可以使用wait属性
..
return 'select colA from tableA where colB = '||const||'';
..