We are implementing CI/CD for our .NET projects which sourced under TFS.
I cannot find a way to add my TFS project URL inside the Jenkins job configuration. Only URl I can supply is for GIT.
Cannot find a plugin for TFS inside Jenkins.
Can someone please guide to integrate Jenkins with TFS repository?
CodePudding user response:
The Team Foundation Server (TFS) (Now known as Azure DevOps) supports both GIT and TFVC version control. If you have a git repository then you can simply use the git option where you can provide clone URL, Tags/branch, and credential. But if you are using TFVC, then you will have to use a workaround approach as the plugin for the team foundation server is suspended.
The workaround approach for TFVC is to check out the code manually using the command line.
For that, you will need to have a team explorer available on the slave machine. Team explorer comes with the visual studio installation but if you want to avoid installing the full package of the visual studio then you can download team explorer from here. You will also have to ensure that the path to TF.exe is added to the PATH environment variable on the slave machine. You can use dir tf.exe /S
from the root of c: to find the full path of tf.exe. To test if tf
command line is added to the environment variable path on the slave device, open the cmd line and run tf vc
.
In Jenkins,
For Freestyle Project :
Create a New Project
Add slave/agent label to "Restrict where this project can be run"
Select None in Source Cide Management
In build step, add "execute windows batch command"
In the "execute windows batch command" step, add tf get command as per documentation
For Pipeline job:
pipeline {
agent { label "LABEL_OF_SLAVE" }
stages {
stage('Checkout') {
steps {
bat 'TF_GET_COMMAND'
}
}
}
}
Hope this workaround helps !!
CodePudding user response:
If using a TFS/Azure DevOps hosted git repo, you just need the git plugin installed and reference the repo url as usual.
The tfs-plugin is only necessary to access TFVC repos. But it has been suspended from the plugin distribution site due to securty vulnerabilities. It is still available from the JenkinsCI Github repo for manual installation. Make aure to have installed the githplugin first via normal menas so all dependencies are installed.
Microsoft have formally abandoned support for their Azure plugins and also done so silently for the tfs-plugin, so no fixes are expected, unless a maintainer steps up.
A simpler option for interacting with the TFVC repos is the tf
command line client, which is what the tfs-plugin bundles (and was the source of the licensing issue which caused the initial plugin suspension). It needs to be installed locally on the agents, manually or using Custom Tool plugin and invoked via a shell step (or via a custom managed script step.
More discussion on community.jenkins.io