jenkinsci / jenkinsci/git-plugin
[JENKINS-67984] Jenkins Git plugin only checks out tags on existing repository
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
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
```
---
Originally reported by
ilcatania, imported from: Jenkins Git plugin only checks out tags on existing repository
Raw content of original issue
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
environment
```
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
```
1 attachment
- [jenkins-no-git-full-log.txt](https://issues.jenkins.io/secure/attachment/57418/jenkins-no-git-full-log.txt)
Contributor guide
Assessment
This issue has not been assessed yet.