jenkinsci / jenkinsci/git-plugin

[JENKINS-72428] The tag specified when downloading the code is inconsistent with the actual downloaded code branch.

Open
#3,821 2 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:critical resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

1 def scmVars = checkout([$class: "GitSCM", branches: [[name: "${BRANCH}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "CleanBeforeCheckout", deleteUntrackedNestedRepositories: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${CERT_ID}", url: "$CODE"]]])

2 def scmVars = checkout scmGit(branches: [[name: "${BRANCH}"]], extensions: [[$class: "CleanBeforeCheckout", deleteUntrackedNestedRepositories: true]], userRemoteConfigs: [[credentialsId: "${CERT_ID}", url: "$CODE"]])

Neither method can correctly identify the tag.

 

 

The dramatic thing is that after I pulled the 5.2.0 hpi from the official version and deployed it again, it worked, but currently I am still using the 5.2.0 version.

Another interesting thing is that the commit id I pulled cannot be found in the latest commits of all branches and tags.

 

Another point is that I first created a branch and tag with the same name, and then deleted the branch.

---
Originally reported by bobo200128, imported from: The tag specified when downloading the code is inconsistent with the actual downloaded code branch.


  • status: Open
  • priority: Critical
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue

1 def scmVars = checkout([$class: "GitSCM", branches: [[name: "${BRANCH}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: "CleanBeforeCheckout", deleteUntrackedNestedRepositories: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: "${CERT_ID}", url: "$CODE"]]])
2 def scmVars = checkout scmGit(branches: [[name: "${BRANCH}"]], extensions: [[$class: "CleanBeforeCheckout", deleteUntrackedNestedRepositories: true]], userRemoteConfigs: [[credentialsId: "${CERT_ID}", url: "$CODE"]])

Neither method can correctly identify the tag.

 

 

The dramatic thing is that after I pulled the 5.2.0 hpi from the official version and deployed it again, it worked, but currently I am still using the 5.2.0 version.

Another interesting thing is that the commit id I pulled cannot be found in the latest commits of all branches and tags.

 

Another point is that I first created a branch and tag with the same name, and then deleted the branch.

environment

```
jenkins Jenkins 2.401.3

git plugin 5.2.0
```

7 attachments

- [Jenkinsfile111.txt](https://issues.jenkins.io/secure/attachment/61683/Jenkinsfile111.txt)
- [企业微信截图_17017743931135.png](https://issues.jenkins.io/secure/attachment/61669/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17017743931135.png)
> ![企业微信截图_17017743931135.png](https://issues.jenkins.io/secure/attachment/61669/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17017743931135.png)
- [企业微信截图_17017745593110.png](https://issues.jenkins.io/secure/attachment/61670/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17017745593110.png)
> ![企业微信截图_17017745593110.png](https://issues.jenkins.io/secure/attachment/61670/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17017745593110.png)
- [企业微信截图_17017745958764.png](https://issues.jenkins.io/secure/attachment/61671/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17017745958764.png)
> ![企业微信截图_17017745958764.png](https://issues.jenkins.io/secure/attachment/61671/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17017745958764.png)
- [企业微信截图_17018324165070.png](https://issues.jenkins.io/secure/attachment/61684/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17018324165070.png)
> ![企业微信截图_17018324165070.png](https://issues.jenkins.io/secure/attachment/61684/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17018324165070.png)
- [企业微信截图_17018324851358.png](https://issues.jenkins.io/secure/attachment/61685/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17018324851358.png)
> ![企业微信截图_17018324851358.png](https://issues.jenkins.io/secure/attachment/61685/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17018324851358.png)
- [企业微信截图_17018325311910.png](https://issues.jenkins.io/secure/attachment/61686/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17018325311910.png)
> ![企业微信截图_17018325311910.png](https://issues.jenkins.io/secure/attachment/61686/%26%2320225%3B%26%2319994%3B%26%2324494%3B%26%2320449%3B%26%2325130%3B%26%2322270%3B_17018325311910.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.