Partager via


Create a service hook for Azure DevOps with Jenkins

TFS 2018

If you use Jenkins to build your apps, you can store your code in Azure DevOps and continue to use Jenkins for your continuous integration builds. You can trigger a Jenkins build when you push code to your project's Git repository or when you check in code to Team Foundation version control.

Important

Azure DevOps no longer supports Alternate Credentials authentication since the beginning of March 2, 2020. If you're still using Alternate Credentials, we strongly encourage you to switch to a more secure authentication method (for example, personal access tokens). Learn more.

Configure Jenkins

  1. If you haven't already, set up a Jenkins server.

  2. If you're setting up Jenkins on-premises, enable HTTPS.

  3. Add or change hudson.plugins.git.GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL system property as disabled before -jar parameter inside of <arguments> tag in jenkins.xml configuration file.

    -Dhudson.plugins.git.GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL=disabled

Set up a Jenkins build

  1. In Jenkins, create a new item.

    New item link in Jenkins
  2. Create the type of build that's appropriate for your project.

    Build name and type in Jenkins
  3. Set the URL for your Git repository in Azure DevOps Services. The URL is in the form https://dev.azure.com/{orgName}/DefaultCollection/_git/{projectName}.

    Source code management settings with Git selected

Trigger Jenkins

  1. Go to your project Service Hooks page:

    https://dev.azure.com/{orgName}/{project_name}/_apps/hub/ms.vss-servicehooks-web.manageServiceHooks-project

    Screenshot of project administration page, TFS.

    Select Create Subscription.

  2. Add Jenkins.

    Select target service dialog box, Jenkins selected
  3. Pick the event from Azure DevOps Services that you want to trigger a Jenkins build.

    Configure event dialog box
  4. Configure the action to take in Jenkins.

Now, when that event occurs in Azure DevOps Services, your Jenkins build gets triggered.

Pricing

Azure DevOps Services doesn't charge for the framework for integrating with external services. Check out the specific service's site for pricing related to their services.

Q & A

Q: Can I build part of my app in Azure DevOps Services and part in Jenkins?

A: Yes. You can trigger a Jenkins build when your Azure DevOps Services build is completed so that you use both systems to build your app.

Q: Can I programmatically create subscriptions?

A: Yes, use REST APIs.