jenkinsci / jenkinsci/git-client-plugin

[JENKINS-61076] add a hex output of the error code in case of failure running git cli on windows

Open
#1,612 0 comments 0 reactions 0 assignees View on GitHub
component:git-client-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
152
Forks
402
Avg merge
6h 47m
Merged PRs (30d)
4

Description

if the git plugin fails to launch git on windows it logs the error as a signed int in the jobs console log.

however on windows the failure is likely to be a {{HRESULT }}which is an unsigned int and you need to know that in order to google to find the underlying cause.  Most users who have never interacted with the windows API probably don't know that.

therefore in addition to an error code (which could be returned by git/ssh) the request is to add the hex to the log with perhaps a pointer to the [MS documentation|https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55] and the git documentation (if there is any) explaining the error codes.  (Jenkins also has a lookup from HRESULT to human text - so as an added bonus this could be used as well).

```
[2020-02-13T11:19:27.516Z] using credential xxxxxxxxxxxxxxxx
[2020-02-13T11:19:27.536Z] Cloning the remote Git repository
[2020-02-13T11:19:27.536Z] Cloning with configured refspecs honoured and without tags
[2020-02-13T11:19:13.417Z] Cloning repository git@​github.com:myorg/myrepo.git
[2020-02-13T11:19:13.521Z] > git init C:\e4909a8e\workspace\_myrepo_PR-288 # timeout=10
[2020-02-13T11:19:28.304Z] ERROR: Error cloning remote repo 'origin'
[2020-02-13T11:19:28.304Z] hudson.plugins.git.GitException: Could not init C:\e4909a8e\workspace\_myrepo_PR-288
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:918)
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:710)
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
[2020-02-13T11:19:28.305Z] at hudson.remoting.UserRequest.perform(UserRequest.java:211)
[2020-02-13T11:19:28.305Z] at hudson.remoting.UserRequest.perform(UserRequest.java:54)
[2020-02-13T11:19:28.305Z] at hudson.remoting.Request$2.run(Request.java:369)
[2020-02-13T11:19:28.305Z] at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-02-13T11:19:28.305Z] at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:97)
[2020-02-13T11:19:28.305Z] at java.lang.Thread.run(Thread.java:748)
[2020-02-13T11:19:28.305Z] Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from xxx-xxx-xxx-xxx.ingress-nginx.ingress-nginx.svc.cluster.local/xxx.xxx.xxx.xxx:56774
[2020-02-13T11:19:28.305Z] at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
[2020-02-13T11:19:28.305Z] at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
[2020-02-13T11:19:28.305Z] at hudson.remoting.Channel.call(Channel.java:955)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
[2020-02-13T11:19:28.305Z] at sun.reflect.GeneratedMethodAccessor1158.invoke(Unknown Source)
[2020-02-13T11:19:28.305Z] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2020-02-13T11:19:28.305Z] at java.lang.reflect.Method.invoke(Method.java:498)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
[2020-02-13T11:19:28.305Z] at com.sun.proxy.$Proxy164.execute(Unknown Source)
[2020-02-13T11:19:28.305Z] at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
[2020-02-13T11:19:28.305Z] at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-02-13T11:19:28.305Z] ... 1 more
[2020-02-13T11:19:28.305Z] Caused by: hudson.plugins.git.GitException: Command "git init C:\e4909a8e\workspace\_myrepo_PR-288" returned status code -1073741502:
[2020-02-13T11:19:28.305Z] stdout:
[2020-02-13T11:19:28.305Z] stderr:
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2174)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2142)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2138)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1743)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:916)
[2020-02-13T11:19:28.305Z] ... 12 more

```

---
Originally reported by teilo, imported from: add a hex output of the error code in case of failure running git cli on windows


  • status: Open
  • priority: Minor
  • component(s): git-client-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251211-071809

Raw content of original issue

if the git plugin fails to launch git on windows it logs the error as a signed int in the jobs console log.

however on windows the failure is likely to be a {{HRESULT }}which is an unsigned int and you need to know that in order to google to find the underlying cause.  Most users who have never interacted with the windows API probably don't know that.

therefore in addition to an error code (which could be returned by git/ssh) the request is to add the hex to the log with perhaps a pointer to the [MS documentation|https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55] and the git documentation (if there is any) explaining the error codes.  (Jenkins also has a lookup from HRESULT to human text - so as an added bonus this could be used as well).


[2020-02-13T11:19:27.516Z] using credential xxxxxxxxxxxxxxxx

[2020-02-13T11:19:27.536Z] Cloning the remote Git repository
[2020-02-13T11:19:27.536Z] Cloning with configured refspecs honoured and without tags
[2020-02-13T11:19:13.417Z] Cloning repository git@github.com:myorg/myrepo.git
[2020-02-13T11:19:13.521Z] > git init C:\e4909a8e\workspace\_myrepo_PR-288 # timeout=10
[2020-02-13T11:19:28.304Z] ERROR: Error cloning remote repo 'origin'
[2020-02-13T11:19:28.304Z] hudson.plugins.git.GitException: Could not init C:\e4909a8e\workspace\_myrepo_PR-288
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:918)
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:710)
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
[2020-02-13T11:19:28.304Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
[2020-02-13T11:19:28.305Z] at hudson.remoting.UserRequest.perform(UserRequest.java:211)
[2020-02-13T11:19:28.305Z] at hudson.remoting.UserRequest.perform(UserRequest.java:54)
[2020-02-13T11:19:28.305Z] at hudson.remoting.Request$2.run(Request.java:369)
[2020-02-13T11:19:28.305Z] at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-02-13T11:19:28.305Z] at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:97)
[2020-02-13T11:19:28.305Z] at java.lang.Thread.run(Thread.java:748)
[2020-02-13T11:19:28.305Z] Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from xxx-xxx-xxx-xxx.ingress-nginx.ingress-nginx.svc.cluster.local/xxx.xxx.xxx.xxx:56774
[2020-02-13T11:19:28.305Z] at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
[2020-02-13T11:19:28.305Z] at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
[2020-02-13T11:19:28.305Z] at hudson.remoting.Channel.call(Channel.java:955)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
[2020-02-13T11:19:28.305Z] at sun.reflect.GeneratedMethodAccessor1158.invoke(Unknown Source)
[2020-02-13T11:19:28.305Z] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2020-02-13T11:19:28.305Z] at java.lang.reflect.Method.invoke(Method.java:498)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
[2020-02-13T11:19:28.305Z] at com.sun.proxy.$Proxy164.execute(Unknown Source)
[2020-02-13T11:19:28.305Z] at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
[2020-02-13T11:19:28.305Z] at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[2020-02-13T11:19:28.305Z] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[2020-02-13T11:19:28.305Z] ... 1 more
[2020-02-13T11:19:28.305Z] Caused by: hudson.plugins.git.GitException: Command "git init C:\e4909a8e\workspace\_myrepo_PR-288" returned status code -1073741502:
[2020-02-13T11:19:28.305Z] stdout:
[2020-02-13T11:19:28.305Z] stderr:
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2174)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2142)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2138)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1743)
[2020-02-13T11:19:28.305Z] at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:916)
[2020-02-13T11:19:28.305Z] ... 12 more

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.