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

Git Pipeline step will not checkout a tag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None
    • Git plugin 4.6.0

      I have the following step on a pipeline:

      git url: 'git@gitlab.v.com:v/v-apps-infra/v-apps-infra.git',
                          branch: "vms-r${env.BUILD_ID}"
      

      Plugin fails to check out the tag with the following log:

      Cloning the remote Git repository
      Avoid second fetch
      Cloning repository git@gitlab.v.com:v/v-apps-infra/v-apps-infra.git
       > git init /home/jenkins/agent/workspace/v-apps-app1+PROD # timeout=10
      Fetching upstream changes from git@gitlab.v.com:v/v-apps-infra/v-apps-infra.git
       > git --version # timeout=10
       > git --version # 'git version 2.20.1'
       > git fetch --tags --force --progress -- git@gitlab.v.com:v/v-apps-infra/v-apps-infra.git +refs/heads/*:refs/remotes/origin/* # timeout=10
       > git config remote.origin.url git@gitlab.v.com:v/v-apps-infra/v-apps-infra.git # timeout=10
       > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
       > git rev-parse refs/remotes/origin/app1-r263^{commit} # timeout=10
       > git rev-parse origin/app1-r263^{commit} # timeout=10
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

      Documentation for pipeline step clearly says tags are supported for the branch parameter:

      Branch to be checked out in the workspace. Default is 'master'.Note that this must be a local branch name like 'master' or 'develop' or a tag name. Remote branch names like 'origin/master' and 'origin/develop' are not supported as the branch argument. SHA-1 hashes are not supported as the branch argument. Remote branch names and SHA-1 hashes are supported by the general purpose checkout step.
      

      But as we can see in the output, the plugin tries to rev-parse the tag name under `refs/remotes/origin/` and `origin/` but does not try `tags/` or just the tag name, which would work.

            markewaite Mark Waite
            brunojcm Bruno Medeiros
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: