[英]trigger parameterized build doesnt find buildpath in jenkins pipeline job
My code dynamically creates a .groovy
file which triggers parameterized build inside a parallel step: 我的代码动态创建一个
.groovy
文件,该文件触发并行步骤中的参数化构建:
def executeParallelBuilds(){
try {
parallel(
build1BUILD: {
def build1BUILD = build job: 'TA/test1', parameters: [string(name: "CPNUM_PARAM", value: 1.141)]
},
build2BUILD: {
def build2BUILD = build job: 'TA/test2', parameters: [string(name: "CPNUM_PARAM", value: 1.141)]
},
failFast: false
)
} catch (e) {
echo "An error ocurred while building"
currentBuild.result="UNSTABLE"
}
}
return this;
Now, I load and execute the groovy file with: 现在,我使用以下命令加载并执行groovy文件:
node('master'){
def executeGroovyFile = load buildFilePath
executeGroovyFile.executeParallelBuilds()
}
But it seems that my pipeline cant find the Buildjobs
by path. 但似乎我的管道无法通过路径找到
Buildjobs
。
[Pipeline] }
[Pipeline] // node
[Pipeline] node
Running on master in C:\DevApps\Jenkins\workspace\TA\pipeline_1.0_TEMPLATE
[Pipeline] {
[Pipeline] load
[Pipeline] { (D:\BuildResults_tmp\TA\MBE3\\buildString.groovy)
[Pipeline] }
[Pipeline] // load
[Pipeline] parallel
[Pipeline] [build1BUILD] { (Branch: build1BUILD)
[Pipeline] [build2BUILD] { (Branch: build2BUILD)
[Pipeline] [build1BUILD] build
[Pipeline] [build1BUILD] }
[build1BUILD] Failed in branch build1BUILD
[Pipeline] [build2BUILD] build
[Pipeline] [build2BUILD] }
[build2BUILD] Failed in branch build2BUILD
[Pipeline] // parallel
[Pipeline] echo
An error ocurred while building
[Pipeline] }
What am I doing wrong? 我究竟做错了什么? I load and execute the
.groovy
file on my master so that the pipeline should be able to find the other jobs. 我在主服务器上加载并执行
.groovy
文件,以便管道应该能够找到其他作业。 (Without node declaration I am not able to load and execute) (没有节点声明,我将无法加载和执行)
EDIT: What confuses me is, that I don't get the following error: 编辑:使我感到困惑的是,我没有得到以下错误:
No parameterized job named some-downtream-job-name found
找不到名为some-downtream-job-name的参数化作业
There was a problem with the build call. 构建调用存在问题。 I saved the whole code as String to a
.groovy
file. 我将整个代码作为String保存到
.groovy
文件中。 This gave me some struggling with the right notation. 这使我在正确的表示法上有些挣扎。 (quotes and double qoutes) After calling my script as:
(引号和双qoutes)以如下方式调用我的脚本后:
def build1BUILD = build job: BuildJobNameList[i], parameters: [string(name: "CPNUM_PARAM", value: 1.141)]
everything works fine 一切正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.