A company uses Azure DevOps exclusively for source control (Git) and has a separate, on-premises Jenkins instance for building and deploying applications. They want to integrate their Azure DevOps Git repositories with Jenkins so that Jenkins builds are automatically triggered whenever new code is pushed to a specific branch in Azure DevOps. Which integration method should they configure?
- AInstall the Azure DevOps plugin in Jenkins and configure a build trigger.
- BConfigure a Service Hook in Azure DevOps to trigger a Jenkins build.
- CUse an Azure DevOps service connection to directly call Jenkins API.
- DSet up a scheduled job in Jenkins to poll the Azure DevOps Git repository.
Show answer & explanationAnswer & explanation
Correct answer: B. Configure a Service Hook in Azure DevOps to trigger a Jenkins build.
Azure DevOps Service Hooks are designed to integrate with external services by sending notifications or making API calls when specific events occur (e.g., code push). Configuring a service hook to trigger a Jenkins build when code is pushed to a branch is the most efficient and real-time integration method.
Why the other options are wrong
- A. The Azure DevOps plugin in Jenkins is primarily for Jenkins to interact with Azure DevOps (e.g., fetching code), not for Azure DevOps to push notifications to Jenkins for triggering builds.
- C. While possible, directly calling the Jenkins API from an Azure DevOps service connection would be more complex to set up for event-driven triggers than a dedicated service hook.
- D. Polling is inefficient, introduces latency, and wastes resources compared to an event-driven service hook.
Azure DevOps Service Hooks
A feature in Azure DevOps that allows you to integrate with external services by sending notifications or making API calls when specific events (e.g., code push, build completion) occur within Azure DevOps.
- Provides real-time, event-driven integration.
- Supports a wide range of external services (e.g., Jenkins, Slack, Webhooks).
- Configured at the project or organization level.
Memory trick: Think of Service Hooks as a messenger bird from Azure DevOps: when new code lands, it immediately flies to Jenkins and squawks, 'Build now!'