詹金斯管道分支

Jenkins Pipeline Branch

我认为这是我想做的一件简单的事情,但正如我发现的那样,使用 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.access0(CliGitAPIImpl.java:78)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.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 插件似乎没有解析 Contributing 变量?然而这在 Freestyle 项目中有效吗?

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

P.S。我正在 运行 更新所有内容的最新版本

我在网上查找了您的错误,看起来您在配置管道时需要做一些小改动:

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

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

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