简体   繁体   中英

Hudson + Windows + GitHub + Git Plugin = really really slow fetch stage

I'm setting up my first Hudson + Git project (previously done many with Hudson + SVN). I expected the clone stage to be slow, as our repository is quite large, but subsequent builds where a fetch + merge is being used are just as long. The following options are enabled:

  • Merge before build
  • Clean after checkout

I am doing a "Wipe out workspace". 做“擦掉工作区”。

...
Fetching changes from the remote Git repository
Fetching upstream changes from git@github.com:username/ProjectFoo.git
[Foo] $ git fetch -t git@github.com:username/ProjectFoo.git +refs/heads/*:refs/remotes/origin/*

At this point it stalls for a very long time. Once it finally finishes, it appears to progress as expected:

[Foo] $ git ls-tree HEAD
[Foo] $ git rev-parse origin/mybranch
Commencing build of Revision c883d59dd5a506a0b586f679a256f539712bfccc (origin/mybranch)
GitAPI created
Checking out Revision c883d59dd5a506a0b586f679a256f539712bfccc (origin/mybranch)
[Foo] $ git checkout -f c883d59dd5a506a0b586f679a256f539712bfccc
[Foo] $ git tag -a -f -m "Hudson Build #2" hudson-Foo-2
Recording changes in branch origin/mybranch
[Foo] $ git whatchanged --no-abbrev -M --pretty=raw c883d59dd5a506a0b586f679a256f539712bfccc..c883d59dd5a506a0b586f679a256f539712bfccc
Cleaning workspace
[Foo] $ git clean -fdx
...

When I run the same fetch command from the Git Bash command line, it runs almost instantaneously.

Any idea what might be going on? Or hints to speed things up? Note, the cloned repository is 210MB. (About a decade's worth of code history.)

I've run into this problem as well, and figured out a workaround. When Hudson runs as a service, something is missing that your normal desktop environment has, which causes something to do with the network to have to re-load for each process. msys-1.0.dll attempts to load something in netapi32.dll which causes it to take so long. So I just downloaded plink.exe from PuTTY, and set my GIT_SSH env to use that instead. Problem averted.

This might be a late answer. but it does solve the extreme-slow problem when Jenkins/Hudson runs as a windows service, on my environment.
The key point is to make git get the rsa keys in a windows service account! I made it works as below:

  1. open Control Panel->Administrative Tools-> Services, and find "Jenkins".
  2. Right click to open Properties->Log On, and assign Jenkins Log On as a user with administrator access.
  3. restart Jenkins, and "git fetch" goes lightning as it is on linux.

The solution provided by ccutrer, did not work for me in the original trial, because plink cannot get rsa key from pageant (pageant is in another user session!). When my steps deployed, either openssh and plink could work well by then.

Could you try an anonymous access instead of an authenticated one for your fetch?

$ git config remote.origin.url git://github.com/username/ProjectFoo.git   # read-only
$ git config remote.origin.pushurl git@github.com:username/ProjectFoo.git # authenticated

and see if the fetch is still slow within the Hudson job?

See for illustration " Using Github with MsysGit ".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM