GIT_LOCAL_BRANCH var is not setting when we enabled for "check out to matching local branch" via declarative pipeline

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When we enabled "Check out to matching local branch" in the Jenkins UI, it worked fine, and we could see that the "GIT_LOCAL_BRANCH" variable was getting the appropriate branch value. However, when we tried to enable it in the code using a declarative pipeline, we did not see the "GIT_LOCAL_BRANCH" variable. Below is the snippet of code we are using. Could you please have a look and help me out with this?

       

      Code Snippet:-

      checkout([
      $class: 'GitSCM',
      branches: scm.branches, // Jenkins job should add "Discover branches" and "Discover tags" to "Behaviors" subsection within the "Branch Sources" section
      extensions: [
      pruneTags(true), // Prune stale tags
      [$class: 'CloneOption', noTags: false], // Fetch tags
      [$class: 'LocalBranch', localBranch: "**"], // evaluate branch name
      [$class: 'PruneStaleBranch'], // Prune stale branches
      [$class: 'WipeWorkspace'] // Wipe out the workspace before cloning to ensure it is clean
      ],
      userRemoteConfigs: scm.userRemoteConfigs
      ])

       

       

            Assignee:
            Unassigned
            Reporter:
            Pasupula
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: