【问题标题】:Jenkins multibranch pipeline job CHANGE_ID not setJenkins 多分支管道作业 CHANGE_ID 未设置
【发布时间】:2017-11-29 03:18:00
【问题描述】:

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

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

我很难理解,在哪些情况下会设置此参数,以及为什么在我们的情况下它为 null。

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

1 来自 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 相关已安装插件:

【问题讨论】:

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


    【解决方案1】:

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

    对于表格的分支-,它没有填写。

    我可以建议您使用:

    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
    

    【讨论】:

    • “对于表格的分支 - 未填写”是什么意思。 ?
    • 哦。对于与掩码不匹配的分支 PR- 或 CR- CHANGE_ID 未填充
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-16
    • 1970-01-01
    相关资源
    最近更新 更多