Jenkins pipeline script to checkout code from tfs with credential

1.3k Views Asked by At

I am pretty new in Jenkins and continuous integration.Here I mentioned the problem I faced while using groovy in Pipe line.

node('node-name')
{
    stage 'Checkout code'

    bat 'http://devtfsappd00.avi.com:8080/tfs/Example_DevCollection'
}

Just a very basic pipeline script. Which says :

'http:' is not recognized as an internal or external command, operable program or batch file. ERROR: script returned exit code 1 Finished: FAILURE

1

There are 1 best solutions below

0
On

Here is code to checkout files from TFS from within the Jenkins pipeline script:

checkout([$class: 'TeamFoundationServerScm', credentialsConfigurer: [$class: 'AutomaticCredentialsConfigurer'], projectPath: '$/TFS/Server_Path', serverUrl: 'http://tfs-server-url/', useOverwrite: true, useUpdate: true, workspaceName: 'Hudson-${JOB_NAME}-${NODE_NAME}'])