使用Jenkins管道作业,我正在尝试打印TFS_CHANGESET
,但我得到的只是null
。有人可以检查下面的代码吗?
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
}
}
如果我尝试使用作业(不是管道)然后在构建时执行shell并检查TFS_CHANGESET
,我会得到正确的值。