无法从声明式管道触发自由式作业

时间:2019-03-04 10:23:51

标签: jenkins jenkins-pipeline

我有一个Jenkins声明性管道作业,它需要触发下游自由式作业。我使用以下代码片段来做到这一点:

build job: 'DL_TVG_Backward_Compatibility_Verification', 
    parameters: [booleanParam(name: 'CHECK_CAM2', value: true), 
                    [$class: 'ListSubversionTagsParameterValue', 
                        name: 'CAM2_GOLDEN_TAG', tag: '', 
                        tagsDir: '<snip>/tags'], 
                    string(name: 'CAM2_SCENARIOS', value: ''), 
                    booleanParam(name: 'CHECK_CAM3', value: false), 
                    <snip>
                    [$class: 'NodeParameterValue', 
                        name: 'UPSTREAM_NODE', 
                        labels: ['jenkinswin10'], 
                        nodeEligibility: [$class: 'AllNodeEligibility']], 
                    string(name: 'EMAIL_RECIPIENTS', 
                            value: '<snip>')
                ]

下游作业失败:

[Pipeline] build (Building DL_TVG_Backward_Compatibility_Verification)
Scheduling project: DL_TVG_Backward_Compatibility_Verification
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] script
[Pipeline] {
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
ERROR: Failed to trigger build of DL_TVG_Backward_Compatibility_Verification
Finished: FAILURE

不幸的是,没有给出失败的原因。有没有办法获取有关原因的更多信息?

我不确定这行:

                    [$class: 'NodeParameterValue', 
                        name: 'UPSTREAM_NODE', 
                        labels: ['jenkinswin10'], 
                        nodeEligibility: [$class: 'AllNodeEligibility']],  

也许这是错误的。

您知道为什么此代码片段会失败吗?

1 个答案:

答案 0 :(得分:0)

  1. 您是否检查了詹金斯日志中的错误?看起来Jenkins找到了Backward-Job(控制台日志:“ Scheduling ...”)。
  2. 您的下游作业中是否有节点参数UPSTREAM_NODE?检查:How to trigger a jenkins build on specific node using pipeline plugin?
  3. 在构建步骤中,NodeParameterValue的语法看起来不错。检查:How to use a parameter from NodeLabelParameter Plugin with the "build" step of Jenkins Workflow
  4. 您是否检查了标签“ jenkinswin10”的配置?您是否已经在标签的一个代理上成功执行了构建?