-
Bug
-
Resolution: Not A Defect
-
Major
-
None
-
Jenkins 2.440.3
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
])