jenkins管道tfs_changeset无法正常工作

时间:2017-12-19 19:01:59

标签: jenkins jenkins-pipeline

使用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,我会得到正确的值。

詹金斯版本:2.75 管道插件:1.5.3.1 Team Foundation Server插件:5.126.0

0 个答案:

没有答案