我的第一个管道脚本抛出如下错误:
Also: java.lang.NoSuchMethodError: No such DSL method '$' found among steps [ <big text here>]
它按预期触发了下游_1和下游_2作业,但最终因上述错误而失败,这是我拥有的常规脚本,有任何帮助/指针来解决此问题吗?
pipeline {
agent
{
node {
label 'my_server'
}
}
stages
{
stage('Start') {
steps {
sh 'ls'
}
}
stage('End') {
steps {
script {
def jobsString = "downstream_1,downstream_2"
ArrayList jobsList = jobsString.split('\\,')
def parallelJobs2Run = [:]
jobsList.each { job ->
echo "Run parallel for job ${job}"
parallelJobs2Run["${job}"] = { ->
echo "Calling job ${job}"
jobResults=build job: "${job}",
parameters: [
string(name: 'param1', value: "value1"),
string(name: 'param2', value: "value2")
],
propagate: true,
wait: true
buildNumber = ${jobResults.number}
echo "${job} Build number |${buildNumber}| result: |${jobResults.result}|"
echo "See details on: |${jobResults.absoluteUrl}|"
}
};
parallel parallelJobs2Run
}
}
}
}
}
答案 0 :(得分:0)
此行
buildNumber = ${jobResults.number}
应该是
buildNumber = jobResults.number
或
buildNumber = "${jobResults.number}"