Jenkins multibranch管道作业CHANGE_ID未设置

时间:2017-06-26 09:54:01

标签: github jenkins jenkins-pipeline pull-request multibranch-pipeline

我已经使用MultiBranch管道设置了Jenkins的工作。 Github是SCM并配置了一个webhook,用于在PR提交上触发构建。 (现有的或新的PR)。

构建被触发,一切正常1,但是没有设置CHANGE_ID(null)。我们需要将CHANGE_ID传递给Sonar。

我很难理解,在这种情况下设置了这个参数,以及为什么它在我们的例子中为空。

请从Jenkins Multibranch的角度考虑这个问题。 我们的(git相关)插件安装在这里[2]。

1从詹金斯登录。

    [Mon Jun 26 11:32:48 CEST 2017] Received Push event to branch BE-7394 in repository ServiceHouse/api UPDATED event from 172.18.0.1 ⇒ http://jenkins2.servicehouse.nl:8080/github-webhook/ with timestamp Mon Jun 26 11:32:43 CEST 2017
11:32:50 Connecting to https://api.github.com using shojenkinsuser/******
Looking up ServiceHouse/api

11:32:50 Connecting to https://api.github.com using shojenkinsuser/******
Looking up ServiceHouse/api

  Getting remote branches...

    Checking branch BE-7394
  Getting remote branches...

    Checking branch BE-7394
      ‘Jenkinsfile’ found
    Met criteria
Changes detected: BE-7394 (01293286b6ee34056d8c92e21a6d39d18e537a81 → 35c16ef01bba5d27dd040a881cd3734fef271fd7)
Scheduled build for branch: BE-7394

  0 branches were processed (query completed)

Done examining ServiceHouse/api

[2] Git相关的已安装插件: git related plugins

1 个答案:

答案 0 :(得分:0)

branch-api-plugin(setup source)中的这个变量sutup,我们让它适用于pull请求或更改请求。

对于表单的分支 - ,它没有填充。

我可以建议你使用:

BUILD_NUMBER
The current build number, such as "153"

BUILD_ID
The current build ID, identical to BUILD_NUMBER for builds created in 
1.597+, but a YYYY-MM-DD_hh-mm-ss timestamp for older builds