简体   繁体   中英

Jenkins multibranch pipeline job CHANGE_ID not set

I have setup a job with Jenkins with MultiBranch pipeline. Github is the SCM and is configured, with a webhook to fire a build on a PR commit. (Existing or new PR).

The build is triggered, all goes fine 1 , however the CHANGE_ID is not set (null). We need the CHANGE_ID to pass on to Sonar.

I am struggling to understand, in which cases this parameter is set, and why it's null in our case.

Please consider this question from a Jenkins Multibranch perspective. Our (git related) plugin installations is here [2] .

1 logging from Jenkins.

    [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 related Installed plugins: git相关的插件

This variable sutup in the branch-api-plugin ( setup source ) and we have it working for pull requests or change requests.

For branches of the form -, it is not filled.

I can advise you to use:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM