Create a service hook for Jenkins
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
This article describes how to set up a service hook for your Azure DevOps project to trigger a Jenkins build. If you use Jenkins to build your apps, you can store your code in a Git repository and use Jenkins for your continuous integration builds. You can trigger a Jenkins build when you push code to your Git repository or when you check in code to a Team Foundation Version Control (TFVC) repository.
You can build part of your app in Azure Pipelines and part in Jenkins. You can trigger a Jenkins build when your Azure Pipelines build is completed so that you use both systems to build your app.
Azure DevOps doesn't charge for setting up service hooks or integrating with external services, and Jenkins is fully open-source and free to use.
Create a Jenkins service hook
To manage service hooks for an Azure DevOps organization or project, you must have Owner or Project Collection Administrator role in the organization.
Configure Jenkins
If you don't have one, set up a Jenkins server.
If you set up Jenkins on-premises, enable HTTPS.
In your jenkins.xml configuration file, set the hudson.plugins.git.GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL system property to
disabled
by adding or updating the following line in the<arguments>
tag, before the-jar
parameter:-Dhudson.plugins.git.GitStatus.NOTIFY_COMMIT_ACCESS_CONTROL=disabled
.
Set up a Jenkins build
In Jenkins, create a new item.
Select the type of build that's appropriate for your project.
Enter the URL for your Git repository.
Set up the Jenkins service hook
In your Azure DevOps project, go to Project settings > Service hooks at
https://<organization-name>/<project-name>/_settings/serviceHooks
.On the Service Hooks page, select the + icon or Create subscription.
On the Service screen, select Jenkins, and then select Next.
On the Trigger screen, select and configure the Azure DevOps event you want to trigger a Jenkins build, and then select Next.
On the Action screen, configure the Jenkins action to take when the event occurs.
Select Test to test the service hook, and Finish to finish the configuration.
Now when the event occurs in the Git repository, it triggers a Jenkins build.
Tip
You can also create a service hook subscription programmatically with REST APIs. For more information, see Create a service hook subscription programmatically.