0
votes

I tried to connect my Jenkins server to VSTS repo by following this Link.

https://blogs.msdn.microsoft.com/devops/2017/04/25/vsts-visual-studio-team-services-integration-with-jenkins/

enter image description here

However, the options are different from the tutorial. There is no way to set a rule for Pull Request, which is what I am trying to do.

I set a new build definition to make the Jenkins build work on every commit, but doesn't work for Pull Request.

enter image description here

1
Hi, Which version of TFS Plugin is installed (if any) in your Jenkins server? Which version of Jenkins do you use? Have you selected version 2.* of the Queue Jenkins Job task in your build definition? Have you configured your Jenkins job as explained on GitHub?alexr

1 Answers

0
votes

To queue Jenkins job for VSTS pull request build validation, you can follow below steps:

  1. Create a job in Jenkins

    First, you need to create a job in Jenkins. If you have already create, then skip this step.

  2. Create and configure build definition for PR build validation

    Seems you already created a build definition named Jenkins, then add Jenkins Queue Job task.

    If you didn’t configure your Jenkins as an endpoint in your VSTS project, you can click New button to specify server URL, username and password to login the Jenkins. Then specify the Jenkins job for queuing.

    enter image description here

    Note: If your Jenkins setup as a local server (the url as http://localhost:8080), then you need to queue VSTS build by private agent which also located in the same machine.

  3. Add build policy as the target branch policy

    In the build policy, you can set the Trigger as Automatic, the Policy requirement as Required, and the Build expiration is Immediately.

    enter image description here

Now when pull request is created or updated for merging into the target branch, VSTS build will be triggered immediately, and the Jenkins job will also be queued during VSTS build.