1

I am using Jenkins with Git SCM to build a project on GitHub. I have told it to build a branch that has been force-pushed over, and now my build fails because every time it starts it tries to build the commit that no longer exists on the remote:

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

How can I tell Jenkins to just forget about this particular SHA and move on to other ones?

-1

Hi you can add the branch to be pulled by jenkins in Jenkins GIT-> Branch to be build->branch specifier

It will solve your issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.