我使用Jenkins和Git SCM在GitHub上构build项目。 我已经告诉它build立了一个已经被强制推送的分支,现在我的构build失败了,因为每次启动都会尝试构build远程不再存在的提交:
19:30:31 Started by user admin 19:30:31 Building in workspace /Users/Shared/Jenkins/Home/workspace/myproject 19:30:31 [WS-CLEANUP] Deleting project workspace... 19:30:31 [WS-CLEANUP] Done 19:30:31 [ssh-agent] Looking for ssh-agent implementation... 19:30:31 [ssh-agent] Java/JNR ssh-agent 19:30:31 [ssh-agent] Skipped registering BouncyCastle, not running on a remote agent 19:30:31 [ssh-agent] Started. 19:30:31 [ssh-agent] Using credentials git (id_rsa) 19:30:31 Cloning the remote Git repository 19:30:31 Using shallow clone 19:30:31 Avoid fetching tags 19:30:31 Cloning repository https://github.com/myorg/myproject.git 19:30:31 > git init /Users/Shared/Jenkins/Home/workspace/myproject # timeout=10 19:30:31 Fetching upstream changes from https://github.com/myorg/myproject.git 19:30:31 > git --version # timeout=10 19:30:31 using GIT_ASKPASS to set credentials Jenkins GitHub login 19:30:31 > git fetch --no-tags --progress https://github.com/myorg/myproject.git +refs/heads/*:refs/remotes/origin/* --depth=1 19:30:43 > git config remote.origin.url https://github.com/myorg/myproject.git # timeout=10 19:30:43 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 19:30:43 > git config remote.origin.url https://github.com/myorg/myproject.git # timeout=10 19:30:43 Fetching upstream changes from https://github.com/myorg/myproject.git 19:30:43 using GIT_ASKPASS to set credentials Jenkins GitHub login 19:30:43 > git fetch --no-tags --progress https://github.com/myorg/myproject.git +refs/heads/*:refs/remotes/origin/* --depth=1 19:30:44 Seen branch in repository origin/master 19:30:44 Seen branch in repository origin/stable 19:30:44 Seen 2 remote branches 19:30:44 FATAL: Walk failure. 19:30:44 org.eclipse.jgit.errors.MissingObjectException: Missing commit 7253e881f2e53b7338b371cf979eccae7e9f68a7 19:30:44 at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:159) 19:30:44 at org.eclipse.jgit.revwalk.RevWalk.getCachedBytes(RevWalk.java:903) 19:30:44 at org.eclipse.jgit.revwalk.RevCommit.parseHeaders(RevCommit.java:155) 19:30:44 at org.eclipse.jgit.revwalk.PendingGenerator.next(PendingGenerator.java:147) 19:30:44 at org.eclipse.jgit.revwalk.StartGenerator.next(StartGenerator.java:184) 19:30:44 at org.eclipse.jgit.revwalk.RevWalk.next(RevWalk.java:435) 19:30:44 at org.eclipse.jgit.revwalk.RevWalk.iterator(RevWalk.java:1322) 19:30:44 Caused: org.eclipse.jgit.errors.RevWalkException: Walk failure. 19:30:44 at org.eclipse.jgit.revwalk.RevWalk.iterator(RevWalk.java:1324) 19:30:44 at hudson.plugins.git.util.GitUtils$1.invoke(GitUtils.java:182) 19:30:44 at hudson.plugins.git.util.GitUtils$1.invoke(GitUtils.java:146) 19:30:44 at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29) 19:30:44 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:64) 19:30:44 at hudson.plugins.git.util.GitUtils.filterTipBranches(GitUtils.java:146) 19:30:44 at hudson.plugins.git.util.DefaultBuildChooser.getAdvancedCandidateRevisions(DefaultBuildChooser.java:250) 19:30:44 at hudson.plugins.git.util.DefaultBuildChooser.getCandidateRevisions(DefaultBuildChooser.java:54) 19:30:44 at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:995) 19:30:44 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1098) 19:30:44 at hudson.scm.SCM.checkout(SCM.java:496) 19:30:44 at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) 19:30:44 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) 19:30:44 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 19:30:44 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 19:30:44 at hudson.model.Run.execute(Run.java:1728) 19:30:44 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 19:30:44 at hudson.model.ResourceController.execute(ResourceController.java:98) 19:30:44 at hudson.model.Executor.run(Executor.java:405) 19:30:44 Archiving artifacts 19:30:44 Finished: FAILURE
我怎么能告诉jenkins忘记这个特殊的SHA并转移到其他的?
嗨,你可以添加jenkinsGIT->分支要被build设 – >分支说明符由jenkins拉的分支
它会解决你的问题