jderusse / docker-gitsplit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins build does not split

redthor opened this issue · comments

Hi there,
When running this docker image in a Jenkins build I get all the Fetching <repo> messages but then it just finishes with SUCCESS.

When running it locally I get the Fetching <repo> messages and then I see all the Splitting refs/heads/master for <repo> as well (as expected).

From what I can tell it is doing https://github.com/jderusse/docker-gitsplit/blob/master/gitsplit#L132
def _init_workspace(self) but not def _split_project(self) when Jenkins runs the image.

It is unusual that the two environments would work differently given that it is running through a docker container...

Any help would be appreciated. Thanks.

It can be the way Jenkins clone the repository at first. Try things like

  - git config remote.origin.fetch "+refs/*:refs/*"
  - git config remote.origin.mirror true
  - git fetch --unshallow

Before running the split

That's it, perfect thanks!

The only modification I made is I dropped the --unshallow param. I didn't need it and when it is on I get a git error.

What I did, was add this to the build steps before docker run:

git config remote.origin.fetch "+refs/*:refs/*"
git config remote.origin.mirror true
git fetch

Note, I looked at the Jenkins Job SCM advanced settings but they didn't appear to solve the issue.