Why is stash webhook causing git error?

I am running into the following failure when triggering a git-based (git 1.8.1.6) Jenkins job (Jenkins 1.583) from Stash (3.5.1) via the Stash Webhook (2.6.0). Doesn't happen all the time, but enough to be causing serious issues. Job is fine when fired manually. Using multi-scm jenkins plugin to handle pulling from extra git repo as well.

I tried the 2.7.1 version of the plugin, but it yields the same results and doesn't fire Jenkins if I omit the SHA1 for the commit. Omitting the branch generates another, similar error.

This is wreaking havoc with my builds and any help would be appreciated.

09-25-2015 10:25:29 commit notification b010153f447f81bf887cdd2e926dfee280bbb76c
09-25-2015 10:25:29 Building remotely on cmjcs66-4.docket15 (DockerBuilds-66) in workspace /home/ccad/jenkins/workspace/ACP_2.0_LBaaS_haproxy-RB_2.0
09-25-2015 10:25:29 [WS-CLEANUP] Deleting project workspace...
09-25-2015 10:25:29 [WS-CLEANUP] Done
09-25-2015 10:25:29 Cloning the remote Git repository
09-25-2015 10:25:29 Cloning repository http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git
09-25-2015 10:25:29  > /opt/software/git/current/bin/git init /home/ccad/jenkins/workspace/ACP_2.0_LBaaS_haproxy-RB_2.0/common # timeout=10
09-25-2015 10:25:29 Fetching upstream changes from http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git
09-25-2015 10:25:29  > /opt/software/git/current/bin/git --version # timeout=10
09-25-2015 10:25:29 using .gitcredentials to set credentials
09-25-2015 10:25:29  > /opt/software/git/current/bin/git config --local credential.username acpbuild # timeout=10
09-25-2015 10:25:29  > /opt/software/git/current/bin/git config --local credential.helper store --file=/tmp/git5360522749272368792.credentials # timeout=10
09-25-2015 10:25:29  > /opt/software/git/current/bin/git -c core.askpass=true fetch --tags --progress http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git +refs/heads/*:refs/remotes/origin/*
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config --local --remove-section credential # timeout=10
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config remote.origin.url http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git # timeout=10
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config remote.origin.url http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git # timeout=10
09-25-2015 10:25:30 Fetching upstream changes from http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git
09-25-2015 10:25:30 using .gitcredentials to set credentials
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config --local credential.username acpbuild # timeout=10
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config --local credential.helper store --file=/tmp/git1155834191242621464.credentials # timeout=10
09-25-2015 10:25:30  > /opt/software/git/current/bin/git -c core.askpass=true fetch --tags --progress http://acpbuild@areopagus/stash/scm/lbaas/lbaas_common.git +refs/heads/*:refs/remotes/origin/*
09-25-2015 10:25:30  > /opt/software/git/current/bin/git config --local --remove-section credential # timeout=10
09-25-2015 10:25:30  > /opt/software/git/current/bin/git rev-parse b010153f447f81bf887cdd2e926dfee280bbb76c^{commit} # timeout=10
09-25-2015 10:25:30 FATAL: Command "/opt/software/git/current/bin/git rev-parse b010153f447f81bf887cdd2e926dfee280bbb76c^{commit}" returned status code 128:
09-25-2015 10:25:30 stdout: b010153f447f81bf887cdd2e926dfee280bbb76c^{commit}
09-25-2015 10:25:30 
09-25-2015 10:25:30 stderr: fatal: ambiguous argument 'b010153f447f81bf887cdd2e926dfee280bbb76c^{commit}': unknown revision or path not in the working tree.
09-25-2015 10:25:30 Use '--' to separate paths from revisions, like this:
09-25-2015 10:25:30 'git <command> [<revision>...] -- [<file>...]'
09-25-2015 10:25:30 
09-25-2015 10:25:30 hudson.plugins.git.GitException: Command "/opt/software/git/current/bin/git rev-parse b010153f447f81bf887cdd2e926dfee280bbb76c^{commit}" returned status code 128:
09-25-2015 10:25:30 stdout: b010153f447f81bf887cdd2e926dfee280bbb76c^{commit}
09-25-2015 10:25:30 
09-25-2015 10:25:30 stderr: fatal: ambiguous argument 'b010153f447f81bf887cdd2e926dfee280bbb76c^{commit}': unknown revision or path not in the working tree.
09-25-2015 10:25:30 Use '--' to separate paths from revisions, like this:
09-25-2015 10:25:30 'git <command> [<revision>...] -- [<file>...]'
09-25-2015 10:25:30 
09-25-2015 10:25:30 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
09-25-2015 10:25:30 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1616)
09-25-2015 10:25:30 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1612)
09-25-2015 10:25:30 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1254)
09-25-2015 10:25:30 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1266)
09-25-2015 10:25:30 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:628)
09-25-2015 10:25:30 	at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316)
09-25-2015 10:25:30 	at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
 
09-25-2015 10:25:30 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
09-25-2015 10:25:30 	at java.lang.reflect.Method.invoke(Method.java:606)
09-25-2015 10:25:30 	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:310)
09-25-2015 10:25:30 	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:290)
09-25-2015 10:25:30 	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:249)
09-25-2015 10:25:30 	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
09-25-2015 10:25:30 	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
09-25-2015 10:25:30 	at hudson.remoting.Request$2.run(Request.java:328)
09-25-2015 10:25:30 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
09-25-2015 10:25:30 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
09-25-2015 10:25:30 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
09-25-2015 10:25:30 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
09-25-2015 10:25:30 	at java.lang.Thread.run(Thread.java:745)

8 answers

Do you have a Jenkins access log entry for what the request? Can you see what the request made to Jenkins was at that time? I'd be interested to see what the webhook notification sent in the request.

Hi Mike, Using the trigger button does not always seem to fire the jenkins hook properly, BUT, checking the Omit SHA1 for the commits appears to have cleared up the problem. I will keep you up to date if it starts failing again, but so far so good! Do you still want the log anyway? Thanks, Dave

A followup - Checking the Omit SHA1 Hash Code box appears to stop the job from triggering in Jenkins after a commit is down to the repo. I can trigger the job, but commits don't seem to be doing it. I think this is almost as bad. Either way I can't get the jobs to build. What do you need for more info from me?

The error message (at least from what I can see here) is that it looks like the notification to Jenkins is putting a commit hash in place of the branch, or something like that. Not 100% sure. But, would be helpful to see what the URL sent to Jenkins looked like.

As I noted, once I turn on the omit SHA1 box, the git operations go forward. The problem now is that commits don't appear to be triggering a build even though clicking the trigger jenkins button does in the hook configuration window. Where can I find what you need?

How are you running Jenkins? Based on the logs, looks like you might be using a Docker image?

No, it is running from an RPM install.

I think I have the same issue: commit notification null Building in workspace /var/lib/jenkins/jobs/Java-Backend/workspace > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url ssh://git@intranet.zuora.com:7999/zin/java-backend.git # timeout=10 Fetching upstream changes from ssh://git@intranet.zuora.com:7999/zin/java-backend.git > git --version # timeout=10 using GIT_SSH to set credentials > git -c core.askpass=true fetch --tags --progress ssh://git@intranet.zuora.com:7999/zin/java-backend.git +refs/heads/*:refs/remotes/origin/* > git rev-parse null^{commit} # timeout=10 FATAL: Command "git rev-parse null^{commit}" returned status code 128: stdout: null^{commit} stderr: fatal: ambiguous argument 'null^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' hudson.plugins.git.GitException: Command "git rev-parse null^{commit}" returned status code 128: stdout: null^{commit} stderr: fatal: ambiguous argument 'null^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' I think this is the bit of log you want, if not let me know: <?xml version="1.0" encoding="UTF-8"?> <feed xmlns="http://www.w3.org/2005/Atom"><title>Hudson log</title><link type="text/html" href="http://build-insights.zeta.tools:8080/"; rel="alternate"/><updated>2015-10-16T12:41:53Z</updated><author><name>Jenkins Server</name></author><id>urn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66</id><entry><title>Scheduling Java-Backend to build commit null</title><link type="text/html" href="http://build-insights.zeta.tools:8080/log"; rel="alternate"/><id>122</id><published>2015-10-16T12:41:53Z</published><updated>2015-10-16T12:41:53Z</updated><content>Oct 16, 2015 5:41:53 AM hudson.plugins.git.GitStatus$JenkinsAbstractProjectListener onNotifyCommit INFO: Scheduling Java-Backend to build commit null </content></entry><entry><title>Scheduling Java-Backend to build commit null</title><link type="text/html" href="http://build-insights.zeta.tools:8080/log"; rel="alternate"/><id>121</id><published>2015-10-16T12:38:36Z</published><updated>2015-10-16T12:38:36Z</updated><content>Oct 16, 2015 5:38:36 AM hudson.plugins.git.GitStatus$JenkinsAbstractProjectListener onNotifyCommit INFO: Scheduling Java-Backend to build commit null </content></entry><entry><title>Scheduling Java-Backend to build commit null</title><link type="text/html" href="http://build-insights.zeta.tools:8080/log"; rel="alternate"/><id>120</id><published>2015-10-16T12:37:48Z</published><updated>2015-10-16T12:37:48Z</updated><content>Oct 16, 2015 5:37:48 AM hudson.plugins.git.GitStatus$JenkinsAbstractProjectListener onNotifyCommit INFO: Scheduling Java-Backend to build commit null

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

118 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you