-
Bug
-
Resolution: Unresolved
-
Major
-
Jenkins 2.319.3
org.jenkins-ci.main:jenkins-war:2.319.3
org.jenkins-ci.plugins:git-client:3.11.0
org.jenkins-ci.plugins:git:4.10.3
git version 2.35
When specifying tag checkout behaviour explicitly in the git plugin, tags are only checked out if the workspace already exists and contains a git repository.
Reproduce by creating a git repository containing the following Jenkinsfile:
pipeline { agent any options { skipDefaultCheckout(true) } triggers { githubPush() } stages { stage('Clone repository') { steps { cleanWs() checkout([ $class: 'GitSCM', branches: scm.branches, doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations, extensions: scm.extensions + [[$class: 'CloneOption', noTags: false, reference: '', shallow: false]], submoduleCfg: [], userRemoteConfigs: scm.userRemoteConfigs ]) checkout([ $class: 'GitSCM', branches: scm.branches, doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations, extensions: scm.extensions + [[$class: 'CloneOption', noTags: false, reference: '', shallow: false]], submoduleCfg: [], userRemoteConfigs: scm.userRemoteConfigs ]) } } } }
and you will see this happens in the build log - I have attached the full build log for reference:
10:47:01 > /usr/bin/git fetch --no-tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags.git +refs/heads/master:refs/remotes/origin/master # timeout=10 10:47:02 > /usr/bin/git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags.git +refs/heads/master:refs/remotes/origin/master # timeout=10
- relates to
-
JENKINS-45164 In jenkins pipeline a "checkout scm" now adds "--no-tags" instead of "--tags" for git projects
-
- Closed
-
[JENKINS-67984] Jenkins Git plugin only checks out tags on existing repository
Environment |
Original:
Jenkins 2.319.3
org.jenkins-ci.main:jenkins-war:2.319.3 org.jenkins-ci.plugins:git-client:3.11.0 org.jenkins-ci.plugins:git:4.10.3 |
New:
Jenkins 2.319.3
org.jenkins-ci.main:jenkins-war:2.319.3 org.jenkins-ci.plugins:git-client:3.11.0 org.jenkins-ci.plugins:git:4.10.3 git version 2.35 |
Link |
New:
This issue relates to |
Rank | New: Ranked higher |
To clarify, I've marked the severity as major because several versioning schemes use existing tags to calculate CI/CD build versions, and they calculate the wrong version if no tags are checked out.
It took me several hours to troubleshoot this issue after noticing my build artifact versions were calculated incorrectly. I would imagine others will be similarly impacted.
For examples of versioning tools broken by this bug: jgitver (maven/gradle), setuptools_scm (python), sbt-git-versioning (scala)