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

`checkout scm` returns inconsistent values for branch name property

XMLWordPrintable

      Using same Jenkinsfile for jenkins piepline and jenkins multi-branch project returns different values for branch name property for result of `checkout scm` command.

      I am trying to extract branch name without remote name. e.g. dev and not origin/dev

       

      script {

      scmVars = checkout scm

      echo "scmVars: ${scmVars}"

      }

       

      For jenkins multibranch pipeline project I am getting exepected value:

      scmVars: [*GIT_BRANCH:dev*, GIT_COMMIT:32f5748fb219621babebcf680040578aa5cd8a20, GIT_PREVIOUS_COMMIT:3c83fcf5c404b37ebde858de5d2194ea9cc0c06d, GIT_PREVIOUS_SUCCESSFUL_COMMIT:3c83fcf5c404b37ebde858de5d2194ea9cc0c06d, GIT_URL:http://myproject]

       

      For jenkins pipeline project I am getting:

      scmVars: GIT_BRANCH:origin/dev, GIT_COMMIT:32f5748fb219621babebcf680040578aa5cd8a20, GIT_PREVIOUS_COMMIT:32f5748fb219621babebcf680040578aa5cd8a20, GIT_PREVIOUS_SUCCESSFUL_COMMIT:1a9cf9e3c15055bb70d72fc1670759f48e88ddde, GIT_URL:[http://myproj.com]/]

      .

       

       

       

            Unassigned Unassigned
            tenstriker Nirav Patel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: