4

I have my working copy of git repository (not bare repo). I also setup local jenkins and my jobs were pointing to this repo. Everything worked fine. I think I've updated jenkins yesterday and this morning I discovered that my jobs started failing. Because they can not fetch source from my repo (it gets timeout).

So I started investigation. I decided to repeat git command lines in terminal to check if I can report the issue. Here is what I'm doing:

git config remote.origin.url file:///Users/eugenmartynov/Development/source/company/app-android
git fetch origin

And it hangs. And I don't have a clue what to check else.

I have git version 2.8.3. But it doesn't matter because I see same behaviour with using default version from Xcode tools

This is what I see if I try turn git trace logging:

git fetch origin
14:25:53.549772 git.c:350               trace: built-in: git 'fetch' 'origin'
14:25:53.553987 run-command.c:336       trace: run_command: 'git-upload-pack '\''/Users/eugenmartynov/Development/source/company/app-android/.git'\'''
14:25:53.554490 run-command.c:195       trace: exec: '/bin/sh' '-c' 'git-upload-pack '\''/Users/eugenmartynov/Development/source/company/app-android/.git'\''' 'git-upload-pack '\''/Users/eugenmartynov/Development/source/company/app-android/.git'\'''
14:25:53.570196 run-command.c:336       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'

Here is log for past success job:

Started by an SCM change
Building in workspace /Users/eugenmartynov/.jenkins/workspace/android-feature-lov-563-general-cards
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url file:///Users/eugenmartynov/Development/source/company/app-android/.git # timeout=10
Fetching upstream changes from file:///Users/eugenmartynov/Development/source/company/app-android/.git
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress file:///Users/eugenmartynov/Development/source/company/app-android/.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/feature/lov-563-general-cards^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/feature/lov-563-general-cards^{commit} # timeout=10
Checking out Revision 932fc80699e765c1854c52051e0605698196d707 (refs/remotes/origin/feature/lov-563-general-cards)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 932fc80699e765c1854c52051e0605698196d707
 > git rev-list d35e0f1cee060b91366840296efc08854a8257b0 # timeout=10
 ....

Here is log for first failed job:

Started by an SCM change
Building in workspace /Users/eugenmartynov/.jenkins/workspace/android-feature-lov-563-general-cards
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url file:///Users/eugenmartynov/Development/source/company/app-android/.git # timeout=10
Fetching upstream changes from file:///Users/eugenmartynov/Development/source/company/app-android/.git
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress file:///Users/eugenmartynov/Development/source/company/app-android/.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from file:///Users/eugenmartynov/Development/source/company/app-android/.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
    at hudson.scm.SCM.checkout(SCM.java:485)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "git -c core.askpass=true fetch --tags --progress file:///Users/eugenmartynov/Development/source/company/app-android/.git +refs/heads/*:refs/remotes/origin/*" returned status code 141:
stdout: 
stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
    ... 11 more
ERROR: null
Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114

1 Answers1

1

I guess you are using wrong url. For a local path you just use the path. Your url looks like an UNC path, i.e. Users is a host name and the rest is shared directory. So, it tries to resolve a host name which could take some time.

Your url is missing disk name. I guess it is Windows.

So, you could just provide full path, I guess git remote set-url origin c:/Users/eugenmartynov/Development/source/company/app-android. Or if I am right, you could put more slashes: file://///c:/....

BTW, git fetch could accept URLs, not necessary to add remotes.

kan
  • 28,279
  • 7
  • 71
  • 101
  • Two comments, 1) I'm on Mac machine, 2) it was working before, what changed? – Eugen Martynov May 31 '16 at 12:43
  • @EugenMartynov Hm, weird... Try to use just path then: `git fetch /Users/eugenmartynov/Development/source/company/app-android/.git ...`. Does Jenkins run as the same user? Does it actually have access to a home directory? – kan May 31 '16 at 13:19
  • It runs as the same user. `git fetch` also hangs – Eugen Martynov May 31 '16 at 13:22
  • @EugenMartynov It could be broken installation. E.g. http://stackoverflow.com/questions/12613315/git-hangs-indefinitely-broke-with-osx-credential-helper-i-think Try to download fresh git distributive and use it directly. – kan May 31 '16 at 13:35
  • It is also not a case. I'm closing the questions, since I pointed my local jenkins to remote git, don't have time more to spend on it – Eugen Martynov May 31 '16 at 14:07