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

The tag specified when downloading the code is inconsistent with the actual downloaded code branch.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • git-plugin
    • None
    • jenkins Jenkins 2.401.3
      git plugin 5.2.0

      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.

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

          Mark Waite added a comment -

          You've not provided enough information for me to duplicate the failure. You didn't provide the complete Pipeline definition (including parameter definitions). You didn't describe the type of Pipeline job (is it a Pipeline defined directly in the job, a Pipeline from SCM, a multibranch Pipeline from SCM, or an organization folder from SCM).

          The hint about creating a branch and a tag with same name and then deleting the branch might indicate some issue related to the workspace if you are reusing the workspace from one run of the job to the next. If you are reusing the workspace from one run of the job to the next and you deleted the branch on the remote, then you may benefit by enabling the extension that prunes local branches when they are deleted from the remote.

          Mark Waite added a comment - You've not provided enough information for me to duplicate the failure. You didn't provide the complete Pipeline definition (including parameter definitions). You didn't describe the type of Pipeline job (is it a Pipeline defined directly in the job, a Pipeline from SCM, a multibranch Pipeline from SCM, or an organization folder from SCM). The hint about creating a branch and a tag with same name and then deleting the branch might indicate some issue related to the workspace if you are reusing the workspace from one run of the job to the next. If you are reusing the workspace from one run of the job to the next and you deleted the branch on the remote, then you may benefit by enabling the extension that prunes local branches when they are deleted from the remote.

          bobo200128 added a comment - - edited

          I added the jenkinsfile I used, please take a look.

           

          Regarding deleting the workspace, I execute delete every time. You can take a look at the configuration in extensions.

           

          The code is obtained by executing the jenkinsfile through the pipeline.

          bobo200128 added a comment - - edited I added the jenkinsfile I used, please take a look.   Regarding deleting the workspace, I execute delete every time. You can take a look at the configuration in extensions.   The code is obtained by executing the jenkinsfile through the pipeline.

            Unassigned Unassigned
            bobo200128 bobo200128
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: