Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-67984

Jenkins Git plugin only checks out tags on existing repository

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • 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
      

          [JENKINS-67984] Jenkins Git plugin only checks out tags on existing repository

          markewaite ok thank you for replying back. If any more info is needed or this should be assigned to someone else please let me know.

          Gabriele Catania added a comment - markewaite ok thank you for replying back. If any more info is needed or this should be assigned to someone else please let me know.

          Hi, any news on this one please? Would appreciate pointers on how to solve, thank you very much

          Gabriele Catania added a comment - Hi, any news on this one please? Would appreciate pointers on how to solve, thank you very much

          markewaite can you help with this? Or can you point me to someone who can please? Thanks

          Gabriele Catania added a comment - markewaite can you help with this? Or can you point me to someone who can please? Thanks

          Mark Waite added a comment - - edited

          Sorry ilcatania but the time that I've been able to give to the git plugin and specific questions like this has been limited by my involvement in other projects like She Code Africa Contributhon and Google Summer of Code. It will likely be several more weeks before I could look into this further.

          You could ask the question on community.jenkins.io to see if others there could help.

          You could ask the question in the gitter chat channels in case someone offers help there.

          Mark Waite added a comment - - edited Sorry ilcatania but the time that I've been able to give to the git plugin and specific questions like this has been limited by my involvement in other projects like She Code Africa Contributhon and Google Summer of Code . It will likely be several more weeks before I could look into this further. You could ask the question on community.jenkins.io to see if others there could help. You could ask the question in the gitter chat channels in case someone offers help there.

          Gabriele Catania added a comment - - edited

          I've tried posting this in the jenkins community forum here: https://community.jenkins.io/t/jenkins-git-plugin-only-checks-out-tags-on-existing-repository/2101 but the only reply I got was from a person telling me I was doing things wrong, and pointing me to the git plugin source code.

          I've also posted in the gitter channels (which I can't easily link to from my work computer since infosec blocks the URLs) but have not gotten a single answer there.

          It would be great if someone could at least independently confirm that this is a bug, I spent quite some time trying to build a self contained reproducible example and I am a bit frustrated that I have not gotten at least some kind of feedback on whether the issue is legitimate or not.

          Gabriele Catania added a comment - - edited I've tried posting this in the jenkins community forum here: https://community.jenkins.io/t/jenkins-git-plugin-only-checks-out-tags-on-existing-repository/2101 but the only reply I got was from a person telling me I was doing things wrong, and pointing me to the git plugin source code. I've also posted in the gitter channels (which I can't easily link to from my work computer since infosec blocks the URLs) but have not gotten a single answer there. It would be great if someone could at least independently confirm that this is a bug, I spent quite some time trying to build a self contained reproducible example and I am a bit frustrated that I have not gotten at least some kind of feedback on whether the issue is legitimate or not.

          This is a very good issue report, thank you. Didn't have time to test and reproduce but:

          Can you check if enabling Preserve second fetch during checkout in the global configuration helps?

          I can see that there is an initial fetch being done https://github.com/jenkinsci/git-plugin/blob/git-4.11.1/src/main/java/hudson/plugins/git/GitSCM.java#L1212-L1221 without regard if tags are needed or not. After this, determineSecondFetch is being run and I think there is no regard whether tags are needed or not, either.

          Finally, the plugin decided to 10:47:01 Avoid second fetch as seen in your log.

          There are some tests for this like https://github.com/jenkinsci/git-plugin/blob/8d93ac3e1141c3e3f645569be9cfaa0cc9d61b62/src/test/java/hudson/plugins/git/GitSCMTest.java#L555-L583

          I have to admit I never understood the fetch logic of this plugin and it seems convoluted indeed.

          Marcin Cieślak added a comment - This is a very good issue report, thank you. Didn't have time to test and reproduce but: Can you check if enabling Preserve second fetch during checkout in the global configuration helps? I can see that there is an initial fetch being done https://github.com/jenkinsci/git-plugin/blob/git-4.11.1/src/main/java/hudson/plugins/git/GitSCM.java#L1212-L1221 without regard if tags are needed or not. After this, determineSecondFetch is being run and I think there is no regard whether tags are needed or not, either. Finally, the plugin decided to 10:47:01 Avoid second fetch as seen in your log. There are some tests for this like https://github.com/jenkinsci/git-plugin/blob/8d93ac3e1141c3e3f645569be9cfaa0cc9d61b62/src/test/java/hudson/plugins/git/GitSCMTest.java#L555-L583 I have to admit I never understood the fetch logic of this plugin and it seems convoluted indeed.

          Marcin Cieślak added a comment - - edited

          Strange, I could reproduce this only once on a fresh Jenkins installation.

          Now I always see tags being fetched:

          Obtained Jenkinsfile from git https://github.com/ilCatania/jenkins-git-no-tags
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /home/saper/.jenkins/workspace/original-no-tags
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Clone repository)
          [Pipeline] cleanWs
          [WS-CLEANUP] Deleting project workspace...
          [WS-CLEANUP] Deferred wipeout is used...
          [WS-CLEANUP] done
          [Pipeline] checkout
          Selected Git installation does not exist. Using Default
          The recommended git tool is: NONE
          No credentials specified
          Cloning the remote Git repository
          Cloning repository https://github.com/ilCatania/jenkins-git-no-tags
           > git init /home/saper/.jenkins/workspace/original-no-tags # timeout=10
          Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags
           > git --version # timeout=10
           > git --version # 'git version 2.36.0'
           > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10
           > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10
           > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
          Avoid second fetch
           > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
          Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10
          Commit message: "initial commit"
          First time build. Skipping changelog.
          [Pipeline] checkout
          Selected Git installation does not exist. Using Default
          The recommended git tool is: NONE
          No credentials specified
           > git rev-parse --resolve-git-dir /home/saper/.jenkins/workspace/original-no-tags/.git # timeout=10
          Fetching changes from the remote Git repository
           > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10
          Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags
           > git --version # timeout=10
           > git --version # 'git version 2.36.0'
           > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10
           > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
          Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10
          Commit message: "initial commit"
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS 

          Tried to reproduce with

          Jenkins 2.332.2
          Git client plugin Version 3.11.0
          Git plugin Version 4.11.1

          Marcin Cieślak added a comment - - edited Strange, I could reproduce this only once on a fresh Jenkins installation. Now I always see tags being fetched: Obtained Jenkinsfile from git https://github.com/ilCatania/jenkins-git-no-tags [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /home/saper/.jenkins/workspace/original-no-tags [Pipeline] { [Pipeline] stage [Pipeline] { (Clone repository) [Pipeline] cleanWs [WS-CLEANUP] Deleting project workspace... [WS-CLEANUP] Deferred wipeout is used... [WS-CLEANUP] done [Pipeline] checkout Selected Git installation does not exist. Using Default The recommended git tool is: NONE No credentials specified Cloning the remote Git repository Cloning repository https://github.com/ilCatania/jenkins-git-no-tags > git init /home/saper/.jenkins/workspace/original-no-tags # timeout=10 Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags > git --version # timeout=10 > git --version # 'git version 2.36.0' > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 Avoid second fetch > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10 Commit message: "initial commit" First time build. Skipping changelog. [Pipeline] checkout Selected Git installation does not exist. Using Default The recommended git tool is: NONE No credentials specified > git rev-parse --resolve-git-dir /home/saper/.jenkins/workspace/original-no-tags/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10 Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags > git --version # timeout=10 > git --version # 'git version 2.36.0' > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10 Commit message: "initial commit" [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS Tried to reproduce with Jenkins 2.332.2 Git client plugin Version 3.11.0 Git plugin Version 4.11.1

          Marcin Cieślak added a comment - - edited

          I have fixed some other issues with this Jenkins (plugin installation) and I cannot reproduce it:

           

          Obtained Jenkinsfile from git https://github.com/ilCatania/jenkins-git-no-tags
          [Pipeline] Start of Pipeline
          [Pipeline] node
          Running on Jenkins in /home/saper/.jenkins/workspace/test-git
          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (Clone repository)
          [Pipeline] cleanWs
          [WS-CLEANUP] Deleting project workspace...
          [WS-CLEANUP] Deferred wipeout is used...
          [WS-CLEANUP] done
          [Pipeline] checkout
          Selected Git installation does not exist. Using Default
          The recommended git tool is: NONE
          No credentials specified
          Cloning the remote Git repository
          Cloning repository https://github.com/ilCatania/jenkins-git-no-tags
           > git init /home/saper/.jenkins/workspace/test-git # timeout=10
          Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags
           > git --version # timeout=10
           > git --version # 'git version 2.36.0'
           > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10
           > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10
           > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
          Avoid second fetch
           > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
          Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10
          Commit message: "initial commit"
          First time build. Skipping changelog.
          [Pipeline] checkout
          Selected Git installation does not exist. Using Default
          The recommended git tool is: NONE
          No credentials specified
           > git rev-parse --resolve-git-dir /home/saper/.jenkins/workspace/test-git/.git # timeout=10
          Fetching changes from the remote Git repository
           > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10
          Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags
           > git --version # timeout=10
           > git --version # 'git version 2.36.0'
           > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10
           > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
          Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10
          Commit message: "initial commit"
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          Finished: SUCCESS
           

          I've had some issues with locale settings, are you running Jenkins with LANG=C ?

          Marcin Cieślak added a comment - - edited I have fixed some other issues with this Jenkins (plugin installation) and I cannot reproduce it:   Obtained Jenkinsfile from git https://github.com/ilCatania/jenkins-git-no-tags [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in /home/saper/.jenkins/workspace/test-git [Pipeline] { [Pipeline] stage [Pipeline] { (Clone repository) [Pipeline] cleanWs [WS-CLEANUP] Deleting project workspace... [WS-CLEANUP] Deferred wipeout is used... [WS-CLEANUP] done [Pipeline] checkout Selected Git installation does not exist. Using Default The recommended git tool is: NONE No credentials specified Cloning the remote Git repository Cloning repository https://github.com/ilCatania/jenkins-git-no-tags > git init /home/saper/.jenkins/workspace/test-git # timeout=10 Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags > git --version # timeout=10 > git --version # 'git version 2.36.0' > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 Avoid second fetch > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10 Commit message: "initial commit" First time build. Skipping changelog. [Pipeline] checkout Selected Git installation does not exist. Using Default The recommended git tool is: NONE No credentials specified > git rev-parse --resolve-git-dir /home/saper/.jenkins/workspace/test-git/.git # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags # timeout=10 Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags > git --version # timeout=10 > git --version # 'git version 2.36.0' > git fetch --tags --force --progress -- https://github.com/ilCatania/jenkins-git-no-tags +refs/heads/*:refs/remotes/origin/* # timeout=10 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 Checking out Revision 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 (refs/remotes/origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 0d6b4accd5eba0c2e8efaa47fac5dcb76b030201 # timeout=10 Commit message: "initial commit" [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS I've had some issues with locale settings, are you running Jenkins with LANG=C ?

          hi saper thank you for looking into it.

          I am running with LANG=en_US.UTF-8 according to system information.

          I tried enabling the "preserve second fetch" option, which ironically in the tooltip says "If you have to enable this due to a bug, please create a jira"

          Anyway, indeed with the "preserve second fetch" option it looks like the second fetch indeed looks at tags, but to be honest now I can't quite tell for sure what's happening:

          [2022-04-27T20:26:39.452Z] [Pipeline] checkout
          [2022-04-27T20:26:39.469Z] The recommended git tool is: NONE
          [2022-04-27T20:26:39.637Z] using credential github-app
          [2022-04-27T20:26:39.653Z] Cloning the remote Git repository
          [2022-04-27T20:26:39.653Z] Cloning with configured refspecs honoured and without tags
          [2022-04-27T20:26:40.096Z] Pruning obsolete local branches
          [2022-04-27T20:26:40.096Z] Pruning obsolete local tags that do not exist on remotes
          [2022-04-27T20:26:40.112Z] Fetching without tags
          [2022-04-27T20:26:39.673Z] Cloning repository https://github.com/ilCatania/jenkins-git-no-tags.git
          [2022-04-27T20:26:39.673Z]  > /export/home/anaconda/2020.02/bin/git init /export/data/ci/jenkins/workspace/s_jenkins-git-no-tags_master # timeout=10
          [2022-04-27T20:26:39.682Z] Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags.git
          [2022-04-27T20:26:39.682Z]  > /export/home/anaconda/2020.02/bin/git --version # timeout=10
          [2022-04-27T20:26:39.685Z]  > git --version # 'git version 2.35.3'
          [2022-04-27T20:26:39.685Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania
          [2022-04-27T20:26:39.686Z]  > /export/home/anaconda/2020.02/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
          [2022-04-27T20:26:40.066Z]  > /export/home/anaconda/2020.02/bin/git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10
          [2022-04-27T20:26:40.070Z]  > /export/home/anaconda/2020.02/bin/git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master # timeout=10
          [2022-04-27T20:26:40.086Z]  > /export/home/anaconda/2020.02/bin/git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10
          [2022-04-27T20:26:40.102Z]  > /export/home/anaconda/2020.02/bin/git show-ref --tags -d # timeout=10
          [2022-04-27T20:26:40.118Z] Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags.git
          [2022-04-27T20:26:40.118Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania
          [2022-04-27T20:26:40.119Z]  > /export/home/anaconda/2020.02/bin/git fetch --tags --force --progress --prune -- https://github.com/ilCatania/jenkins-git-no-tags.git +refs/heads/master:refs/remotes/origin/master # timeout=10
          [2022-04-27T20:26:40.666Z] Checking out Revision 7912da59315e5959de99fc58a190171d74f3198b (master)
          [2022-04-27T20:26:40.706Z] Commit message: "retry double checkout"
          [2022-04-27T20:26:40.672Z]  > /export/home/anaconda/2020.02/bin/git config core.sparsecheckout # timeout=10
          [2022-04-27T20:26:40.676Z]  > /export/home/anaconda/2020.02/bin/git checkout -f 7912da59315e5959de99fc58a190171d74f3198b # timeout=10
          [2022-04-27T20:26:40.712Z]  > /export/home/anaconda/2020.02/bin/git rev-list --no-walk b065c52da9fb8e0a07ca2e0d3dba544438412bf6 # timeout=10
          [2022-04-27T20:26:41.332Z] [GitHub Checks] GitHub check (name: Jenkins, status: in_progress) has been published.
          [2022-04-27T20:26:42.008Z] [Pipeline] checkout
          [2022-04-27T20:26:42.023Z] The recommended git tool is: NONE
          [2022-04-27T20:26:42.193Z] using credential github-app
          [2022-04-27T20:26:42.211Z] Fetching changes from the remote Git repository
          [2022-04-27T20:26:42.229Z] Pruning obsolete local branches
          [2022-04-27T20:26:42.229Z] Pruning obsolete local tags that do not exist on remotes
          [2022-04-27T20:26:42.524Z] Fetching without tags
          [2022-04-27T20:26:42.832Z] Checking out Revision 7912da59315e5959de99fc58a190171d74f3198b (master)
          [2022-04-27T20:26:42.864Z] Commit message: "retry double checkout"
          [2022-04-27T20:26:42.203Z]  > /export/home/anaconda/2020.02/bin/git rev-parse --resolve-git-dir /export/data/ci/jenkins/workspace/s_jenkins-git-no-tags_master/.git # timeout=10
          [2022-04-27T20:26:42.219Z]  > /export/home/anaconda/2020.02/bin/git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10
          [2022-04-27T20:26:42.235Z]  > /export/home/anaconda/2020.02/bin/git show-ref --tags -d # timeout=10
          [2022-04-27T20:26:42.253Z]  > /export/home/anaconda/2020.02/bin/git --version # timeout=10
          [2022-04-27T20:26:42.256Z]  > git --version # 'git version 2.35.3'
          [2022-04-27T20:26:42.256Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania
          [2022-04-27T20:26:42.257Z]  > /export/home/anaconda/2020.02/bin/git ls-remote -t -- https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10
          [2022-04-27T20:26:42.531Z] Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags.git
          [2022-04-27T20:26:42.531Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania
          [2022-04-27T20:26:42.531Z]  > /export/home/anaconda/2020.02/bin/git fetch --tags --force --progress --prune -- https://github.com/ilCatania/jenkins-git-no-tags.git +refs/heads/master:refs/remotes/origin/master # timeout=10
          [2022-04-27T20:26:42.839Z]  > /export/home/anaconda/2020.02/bin/git config core.sparsecheckout # timeout=10
          [2022-04-27T20:26:42.842Z]  > /export/home/anaconda/2020.02/bin/git checkout -f 7912da59315e5959de99fc58a190171d74f3198b # timeout=10
          [2022-04-27T20:26:43.545Z] [GitHub Checks] GitHub check (name: Jenkins, status: in_progress) has been published.
          

          I guess my main point is, if someone is trying to set this up, he's in for a lot of weirdness and several hours trying to figure it out

          Gabriele Catania added a comment - hi saper thank you for looking into it. I am running with LANG=en_US.UTF-8 according to system information. I tried enabling the "preserve second fetch" option, which ironically in the tooltip says "If you have to enable this due to a bug, please create a jira" Anyway, indeed with the "preserve second fetch" option it looks like the second fetch indeed looks at tags, but to be honest now I can't quite tell for sure what's happening: [2022-04-27T20:26:39.452Z] [Pipeline] checkout [2022-04-27T20:26:39.469Z] The recommended git tool is: NONE [2022-04-27T20:26:39.637Z] using credential github-app [2022-04-27T20:26:39.653Z] Cloning the remote Git repository [2022-04-27T20:26:39.653Z] Cloning with configured refspecs honoured and without tags [2022-04-27T20:26:40.096Z] Pruning obsolete local branches [2022-04-27T20:26:40.096Z] Pruning obsolete local tags that do not exist on remotes [2022-04-27T20:26:40.112Z] Fetching without tags [2022-04-27T20:26:39.673Z] Cloning repository https://github.com/ilCatania/jenkins-git-no-tags.git [2022-04-27T20:26:39.673Z] > /export/home/anaconda/2020.02/bin/git init /export/data/ci/jenkins/workspace/s_jenkins-git-no-tags_master # timeout=10 [2022-04-27T20:26:39.682Z] Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags.git [2022-04-27T20:26:39.682Z] > /export/home/anaconda/2020.02/bin/git --version # timeout=10 [2022-04-27T20:26:39.685Z] > git --version # 'git version 2.35.3' [2022-04-27T20:26:39.685Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania [2022-04-27T20:26:39.686Z] > /export/home/anaconda/2020.02/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 [2022-04-27T20:26:40.066Z] > /export/home/anaconda/2020.02/bin/git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10 [2022-04-27T20:26:40.070Z] > /export/home/anaconda/2020.02/bin/git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master # timeout=10 [2022-04-27T20:26:40.086Z] > /export/home/anaconda/2020.02/bin/git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10 [2022-04-27T20:26:40.102Z] > /export/home/anaconda/2020.02/bin/git show-ref --tags -d # timeout=10 [2022-04-27T20:26:40.118Z] Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags.git [2022-04-27T20:26:40.118Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania [2022-04-27T20:26:40.119Z] > /export/home/anaconda/2020.02/bin/git fetch --tags --force --progress --prune -- https://github.com/ilCatania/jenkins-git-no-tags.git +refs/heads/master:refs/remotes/origin/master # timeout=10 [2022-04-27T20:26:40.666Z] Checking out Revision 7912da59315e5959de99fc58a190171d74f3198b (master) [2022-04-27T20:26:40.706Z] Commit message: "retry double checkout" [2022-04-27T20:26:40.672Z] > /export/home/anaconda/2020.02/bin/git config core.sparsecheckout # timeout=10 [2022-04-27T20:26:40.676Z] > /export/home/anaconda/2020.02/bin/git checkout -f 7912da59315e5959de99fc58a190171d74f3198b # timeout=10 [2022-04-27T20:26:40.712Z] > /export/home/anaconda/2020.02/bin/git rev-list --no-walk b065c52da9fb8e0a07ca2e0d3dba544438412bf6 # timeout=10 [2022-04-27T20:26:41.332Z] [GitHub Checks] GitHub check (name: Jenkins, status: in_progress) has been published. [2022-04-27T20:26:42.008Z] [Pipeline] checkout [2022-04-27T20:26:42.023Z] The recommended git tool is: NONE [2022-04-27T20:26:42.193Z] using credential github-app [2022-04-27T20:26:42.211Z] Fetching changes from the remote Git repository [2022-04-27T20:26:42.229Z] Pruning obsolete local branches [2022-04-27T20:26:42.229Z] Pruning obsolete local tags that do not exist on remotes [2022-04-27T20:26:42.524Z] Fetching without tags [2022-04-27T20:26:42.832Z] Checking out Revision 7912da59315e5959de99fc58a190171d74f3198b (master) [2022-04-27T20:26:42.864Z] Commit message: "retry double checkout" [2022-04-27T20:26:42.203Z] > /export/home/anaconda/2020.02/bin/git rev-parse --resolve-git-dir /export/data/ci/jenkins/workspace/s_jenkins-git-no-tags_master/.git # timeout=10 [2022-04-27T20:26:42.219Z] > /export/home/anaconda/2020.02/bin/git config remote.origin.url https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10 [2022-04-27T20:26:42.235Z] > /export/home/anaconda/2020.02/bin/git show-ref --tags -d # timeout=10 [2022-04-27T20:26:42.253Z] > /export/home/anaconda/2020.02/bin/git --version # timeout=10 [2022-04-27T20:26:42.256Z] > git --version # 'git version 2.35.3' [2022-04-27T20:26:42.256Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania [2022-04-27T20:26:42.257Z] > /export/home/anaconda/2020.02/bin/git ls-remote -t -- https://github.com/ilCatania/jenkins-git-no-tags.git # timeout=10 [2022-04-27T20:26:42.531Z] Fetching upstream changes from https://github.com/ilCatania/jenkins-git-no-tags.git [2022-04-27T20:26:42.531Z] using GIT_ASKPASS to set credentials GitHub integration for ilCatania [2022-04-27T20:26:42.531Z] > /export/home/anaconda/2020.02/bin/git fetch --tags --force --progress --prune -- https://github.com/ilCatania/jenkins-git-no-tags.git +refs/heads/master:refs/remotes/origin/master # timeout=10 [2022-04-27T20:26:42.839Z] > /export/home/anaconda/2020.02/bin/git config core.sparsecheckout # timeout=10 [2022-04-27T20:26:42.842Z] > /export/home/anaconda/2020.02/bin/git checkout -f 7912da59315e5959de99fc58a190171d74f3198b # timeout=10 [2022-04-27T20:26:43.545Z] [GitHub Checks] GitHub check (name: Jenkins, status: in_progress) has been published. I guess my main point is, if someone is trying to set this up, he's in for a lot of weirdness and several hours trying to figure it out

          Maybe to would be more helpful if your Jenkinsfile tried fetching only once and then try to check if any tags are available indeed (I have added 1.0 in my fork - https://github.com/saper/jenkins-git-no-tags/releases/tag/1.0 - maybe just a simple git tag -l check

          Also your output is a bit different now - can you try to update your plugins and maybe Jenkins - since I could not reproduce your problem at all using newest plugins.

          Marcin Cieślak added a comment - Maybe to would be more helpful if your Jenkinsfile tried fetching only once and then try to check if any tags are available indeed (I have added 1.0 in my fork - https://github.com/saper/jenkins-git-no-tags/releases/tag/1.0 - maybe just a simple git tag -l check Also your output is a bit different now - can you try to update your plugins and maybe Jenkins - since I could not reproduce your problem at all using newest plugins.

            Unassigned Unassigned
            ilcatania Gabriele Catania
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: