• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • tfs-plugin
    • None
    • tfs_plugin version 5.126.0
      jenkins version 2.75

      Using Jenkins pipeline job, I am trying to print the TFS_CHANGESET but I get {{null }}

      I also notice environment variables TFS_WORKSPACE / TFS_WORKFOLDER / TFS_PROJECTPATH / TFS_SERVERURL / TFS_USERNAME show "null" as well.

      example code:

      import hudson.plugins.tfs.TeamFoundationServerScm
      node {
        serverUrl = "http://SERVERNAME:8080/tfs/ORG"
        projectPath = "\$/DigitalPlatforms/Syndication/Dev"
          try {
              deleteDir()
              stage 'download-from-scm'
              def workspace = pwd() + '/' + "Hudson-testingtfs-MASTER"
              ws("/var/lib/jenkins/testing/testingtfs" + '/' + "Hudson-testingtfs-MASTER") {
              def out = checkout changelog: false, poll: false, scm: [$class: 'TeamFoundationServerScm', credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'], projectPath: "${projectPath}", serverUrl: "${serverUrl}", useOverwrite: true, useUpdate: true, workspaceName: 'Hudson-${JOB_NAME}-${NODE_NAME}']
      
      echo "${workspace}/${env.TFS_CHANGESET}"  //null for TFS_CHANGESET
      echo "${env.TFS_CHANGESET}"  //null
      }
              } catch (err) {
                   currentBuild.result = 'FAILED'
                   throw err
                   }
      }
      

          [JENKINS-48847] tfs_changeset not working

          Roshan Shetty created issue -
          Roshan Shetty made changes -
          Description Original: Using Jenkins pipeline job, I am trying to print the {{TFS_CHANGESET}} but I get {{null output.}}

          {{Looks like all TFS_* variables output as null.}}

          {{example code:}}
          {code:java}
          import hudson.plugins.tfs.TeamFoundationServerScm
          node {
            serverUrl = "http://SERVERNAME:8080/tfs/ORG"
            projectPath = "\$/DigitalPlatforms/Syndication/Dev"
              try {
                  deleteDir()
                  stage 'download-from-scm'
                  def workspace = pwd() + '/' + "Hudson-testingtfs-MASTER"
                  ws("/var/lib/jenkins/testing/testingtfs" + '/' + "Hudson-testingtfs-MASTER") {
                  def out = checkout changelog: false, poll: false, scm: [$class: 'TeamFoundationServerScm', credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'], projectPath: "${projectPath}", serverUrl: "${serverUrl}", useOverwrite: true, useUpdate: true, workspaceName: 'Hudson-${JOB_NAME}-${NODE_NAME}']

          echo "${workspace}/${env.TFS_CHANGESET}" //null for TFS_CHANGESET
          echo "${env.TFS_CHANGESET}" //null
          }
                  } catch (err) {
                       currentBuild.result = 'FAILED'
                       throw err
                       }
          }
          {code}
          New: Using Jenkins pipeline job, I am trying to print the *{{TFS_CHANGESET}}* but I get {{null }}

          I also notice environment variables TFS_WORKSPACE /TFS_WORKFOLDER/TFS_PROJECTPATH /TFS_SERVERURLTFS_USERNAME show "null" as well.

          {{example code:}}
          {code:java}
          import hudson.plugins.tfs.TeamFoundationServerScm
          node {
            serverUrl = "http://SERVERNAME:8080/tfs/ORG"
            projectPath = "\$/DigitalPlatforms/Syndication/Dev"
              try {
                  deleteDir()
                  stage 'download-from-scm'
                  def workspace = pwd() + '/' + "Hudson-testingtfs-MASTER"
                  ws("/var/lib/jenkins/testing/testingtfs" + '/' + "Hudson-testingtfs-MASTER") {
                  def out = checkout changelog: false, poll: false, scm: [$class: 'TeamFoundationServerScm', credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'], projectPath: "${projectPath}", serverUrl: "${serverUrl}", useOverwrite: true, useUpdate: true, workspaceName: 'Hudson-${JOB_NAME}-${NODE_NAME}']

          echo "${workspace}/${env.TFS_CHANGESET}" //null for TFS_CHANGESET
          echo "${env.TFS_CHANGESET}" //null
          }
                  } catch (err) {
                       currentBuild.result = 'FAILED'
                       throw err
                       }
          }
          {code}
          Roshan Shetty made changes -
          Description Original: Using Jenkins pipeline job, I am trying to print the *{{TFS_CHANGESET}}* but I get {{null }}

          I also notice environment variables TFS_WORKSPACE /TFS_WORKFOLDER/TFS_PROJECTPATH /TFS_SERVERURLTFS_USERNAME show "null" as well.

          {{example code:}}
          {code:java}
          import hudson.plugins.tfs.TeamFoundationServerScm
          node {
            serverUrl = "http://SERVERNAME:8080/tfs/ORG"
            projectPath = "\$/DigitalPlatforms/Syndication/Dev"
              try {
                  deleteDir()
                  stage 'download-from-scm'
                  def workspace = pwd() + '/' + "Hudson-testingtfs-MASTER"
                  ws("/var/lib/jenkins/testing/testingtfs" + '/' + "Hudson-testingtfs-MASTER") {
                  def out = checkout changelog: false, poll: false, scm: [$class: 'TeamFoundationServerScm', credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'], projectPath: "${projectPath}", serverUrl: "${serverUrl}", useOverwrite: true, useUpdate: true, workspaceName: 'Hudson-${JOB_NAME}-${NODE_NAME}']

          echo "${workspace}/${env.TFS_CHANGESET}" //null for TFS_CHANGESET
          echo "${env.TFS_CHANGESET}" //null
          }
                  } catch (err) {
                       currentBuild.result = 'FAILED'
                       throw err
                       }
          }
          {code}
          New: Using Jenkins pipeline job, I am trying to print the *{{TFS_CHANGESET}}* but I get \{\{null }}

          I also notice environment variables TFS_WORKSPACE / TFS_WORKFOLDER / TFS_PROJECTPATH / TFS_SERVERURL / TFS_USERNAME show "null" as well.

          {{example code:}}
          {code:java}
          import hudson.plugins.tfs.TeamFoundationServerScm
          node {
            serverUrl = "http://SERVERNAME:8080/tfs/ORG"
            projectPath = "\$/DigitalPlatforms/Syndication/Dev"
              try {
                  deleteDir()
                  stage 'download-from-scm'
                  def workspace = pwd() + '/' + "Hudson-testingtfs-MASTER"
                  ws("/var/lib/jenkins/testing/testingtfs" + '/' + "Hudson-testingtfs-MASTER") {
                  def out = checkout changelog: false, poll: false, scm: [$class: 'TeamFoundationServerScm', credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'], projectPath: "${projectPath}", serverUrl: "${serverUrl}", useOverwrite: true, useUpdate: true, workspaceName: 'Hudson-${JOB_NAME}-${NODE_NAME}']

          echo "${workspace}/${env.TFS_CHANGESET}" //null for TFS_CHANGESET
          echo "${env.TFS_CHANGESET}" //null
          }
                  } catch (err) {
                       currentBuild.result = 'FAILED'
                       throw err
                       }
          }
          {code}
          Jason Prickett made changes -
          Assignee New: Jason Prickett [ jpricketmsft ]
          Jason Prickett made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

            jpricketmsft Jason Prickett
            rshetty Roshan Shetty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: