gradle-advanced-build-version icon indicating copy to clipboard operation
gradle-advanced-build-version copied to clipboard

GIT_COMMIT_COUNT always returns 1 on Jenkins

Open michal-krasowski-red opened this issue 2 years ago • 1 comments

Set up a jenkins pipeline job that checks out the repo and runs the gradle build.

It looks like that when the repo is in detached head state, the commit count is always 1 according to this plugin.

michal-krasowski-red avatar Oct 13 '21 09:10 michal-krasowski-red

You could verify that the commit count is 1 e.g. with git log --oneline | wc -l.

CIs like Jenkins or CircleCI checking out repositories with --depth=1 parameter. You should clone your repository with full history or unshallow an already exisiting one:

$ git fetch --help

       --unshallow
           If the source repository is complete, convert a shallow repository to a complete one, removing all the
           limitations imposed by shallow repositories.

           If the source repository is shallow, fetch as much as possible so that the current repository has the
           same history as the source repository.

xabolcs avatar Sep 20 '22 15:09 xabolcs