gpt4 book ai didi

Jenkins 参数化构建 : build fails due to git parameter includes {^commit}

转载 作者:行者123 更新时间:2023-12-04 01:50:05 24 4
gpt4 key购买 nike

我想设置一个参数化构建,以便用户可以选择分支,然后按“构建”来构建该分支。

在配置中,我添加了一个 git 参数“branch”,如下所示: enter image description here

然后我在管道定义中添加了“分支”参数作为分支说明符,如下所示: enter image description here

当我开始构建时,我可以毫无问题地选择分支。在这个例子中/origin/feature/kvarntorp-test1。但是构建将失败,并显示以下控制台输出:

Started by user xxxx Lightweight checkout support not available, falling back to full checkout. Checking out git ssh://gitolite@tuleap.ermms.se/ermms/acm.git into /var/lib/jenkins/workspace/6smCustomBuild@script to read ci/jenkins/6msBuildAndTest.groovy

> git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository
> git config remote.origin.url ssh://gitolite@tuleap.ermms.se/ermms/acm.git # timeout=10 Fetching upstream changes from ssh://gitolite@tuleap.ermms.se/ermms/acm.git
> git --version # timeout=10 using GIT_SSH to set credentials
> git fetch --tags --progress ssh://gitolite@tuleap.ermms.se/ermms/acm.git +refs/heads/:refs/remotes/origin/
> git rev-parse /origin/feature/kvarntorp-test1^{commit} # timeout=10
> git rev-parse refs/remotes/origin//origin/feature/kvarntorp-test1^{commit} # timeout=10
> git rev-parse /origin/feature/kvarntorp-test1^{commit} # timeout=10

ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
ERROR: Maximum checkout retry attempts reached, aborting Finished: FAILURE

所以 Jenkins 找不到分支/origin/feature/kvarntorp-test1 因为他正在搜索/origin/feature/kvarntorp-test1^{commit}

^{commit} 从何而来?我能以某种方式删除构建配置中的 ^{commit} 吗?我是否配置了构建错误?

我尝试了不同的名称而不是“分支”。 Git PullRequest job failed. Couldn't find any revision to build. Verify the repository and branch configuration for this job建议我应该使用默认值“master”的 sha1。我尝试将 sha1 作为 Git 参数名称,将 ${sha1} 作为分支说明符。构建失败,控制台输出如下:

hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${sha1}:refs/remotes/origin/${sha1} --prune" returned status code 128:stdout: stderr: fatal: Couldn't find remote ref refs/heads/${sha1}fatal: The remote end hung up unexpectedly    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721)    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)    at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351)    at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:196)    at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:172)    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:108)    at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67)    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:298)    at hudson.model.ResourceController.execute(ResourceController.java:97)    at hudson.model.Executor.run(Executor.java:429)Finished: FAILURE

最佳答案

我成功了。这是两件事的结合。首先,我必须按照 Jenkins Git Branch not working with Environment Variables 中的描述取消选中轻量级结账。 .

但这并没有解决问题。我还必须将参数名称设置为 sha1,将分支说明符设置为 ${sha1}。

关于Jenkins 参数化构建 : build fails due to git parameter includes {^commit},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53555633/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com