Skip to content

Instantly share code, notes, and snippets.

@Semant1ka
Last active October 19, 2017 16:54
Show Gist options
  • Save Semant1ka/6c9e8cb272a764ae4f759be017823e0c to your computer and use it in GitHub Desktop.
Save Semant1ka/6c9e8cb272a764ae4f759be017823e0c to your computer and use it in GitHub Desktop.

illustration

Recently, I have set up an interaction between TFS and Jenkins, fortunately, there are some decent articles available on this topic:

However, I run into some uneven issues that I solved only after playing around with both TFS and Jenkins.

My setup was TFS 2015 and latest Jenkins TFS Plugin. Jenkins build was a pipeline which accepts parameters and generates unittests results.

  1. The first thing I have bumped into was the fact that TFS build can't track Jenkins build status. The solution for that was to check only Capture console output and wait for completion in Queue Jenkins Job step setup, and Capture pipeline output and wait for pipeline completion should be left unchecked.

    pipe_screen

  2. Secondly, I have tried syncing tests results after each pipeline step which generates them. Also, all my test results files had different names so I was not able to use **/* notation. The above approach didn't work and TFS build was able to see only one test result instead of three expected. The solution for that was to push all the results in the end of pipeline:

step([$class: 'TeamCollectResultsPostBuildAction',
requestedResults: [[includes: '**/*tests.xml', teamResultType: 'JUNIT']]])
  1. The third issue appeared when I tried to pass parameters like branch name into Jenkins pipeline. Pipeline was failing to accept parameters send from TFS, so I ended up with configuration below:

    param_screen

    It seems that parameters which you want to pass from TFS build should be referenced in Jenkins with this kind of notation "${params.BRANCH}", reference like branch = BRANCH might not work in pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment