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

Jenkins Git plugin only checks out tags on existing repository

XMLWordPrintable

    • 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
      

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

              Created:
              Updated: