首页 文章

如何在jenkins中使用gerrit触发器插件为变更集执行Jenkinsfile?

提问于
浏览
3

我们在Jenkins中使用gerrit-trigger,当推送新的变更集进行审核时会触发构建 .

现在我们要介绍管道并使用解决方案Defining a pipeline in scm

因此,我们期望在构建被触发时,管道插件下方可以检查此refspec

enter image description here

但是 ${GERRIT_REFSPEC} 在这里没有效果,它仍然检查主人

> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision adf5d360582b1b24f088cfa8ac0f0ebf64a57692 (refs/remotes/origin/master)
Commit message: "DO:CI End of summer"
 > git config core.sparsecheckout # timeout=10
 > git checkout -f adf5d360582b1b24f088cfa8ac0f0ebf64a57692

有什么建议它是如何工作的?

3 回答

  • 1

    我想你需要设置:

    Repositories > Refspec               = $GERRIT_REFSPEC:$GERRIT_REFSPEC
    Branches to build > Branch Specifier = $GERRIT_REFSPEC
    

    重要提示:不要忘记取消选中“ Lightweight checkout ”选项 .

  • 0

    或者你可以在Jenkins的工作中使用 .

    Refspec:$

    分支说明符:FETCH_HEAD .

  • 6

    取消选中“轻量级结账”就够了! gerrit-trigger插件应该提到这个!我浪费了半天!

相关问题