gradle-advanced-build-version
gradle-advanced-build-version copied to clipboard
GIT_COMMIT_COUNT always returns 1 on Jenkins
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.
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.