詹金斯管道分支



我认为这是我想做的一件简单的事情,但正如我所发现的,Jenkins 似乎没有什么是简单的。

基本上我想要的只是:

  • 当开发人员将新代码推送到 BitBucket 中的分支时,我希望有一个 webhook 告诉 Jenkins 构建该分支并报告构建状态。

网络钩子正在工作。但是,无论我尝试什么,我都无法让 Jenkins 克隆并签出感兴趣的提交,以便它可以使用该提交的 Jenkinsfile 来启动管道。我总是得到类似的东西:

eneric Cause
GenericWebhookEnvironmentContributor
Received:
{"pullRequest": {"fromRef": {"latestCommit": "f6be891de5c8d66023030d31e36a9fb9b01ef973"}}}

Contributing variables:
commitId = f6be891de5c8d66023030d31e36a9fb9b01ef973

hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/${commitId}:refs/remotes/origin/${commitId}" returned status code 128:
stdout: 
stderr: fatal: Couldn't find remote ref refs/heads/${commitId}
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2172)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1864)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:545)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:358)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:197)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:173)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:113)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:299)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

如您所见,Git 插件似乎没有解析贡献变量?然而,这在自由式项目中有效吗?

我做错了吗?在刚刚推送以运行管道的任何提交中简单地使用 Jenkinsfile 的最简单方法是什么?

附言我正在运行所有内容的最新版本

我在网上查找了您的错误,看起来您在配置管道时需要进行一个小的更改:

您需要取消选中一个轻量级结帐复选框。

请查看此 git 问题:https://github.com/jenkinsci/ghprb-plugin/issues/507#issuecomment-299481993

https://github.com/jenkinsci/ghprb-plugin/issues/507#issuecomment-326014594

最新更新