Jira Ops Integration With Jenkins
Go To System In JIRA and Then Navigate to Webhooks
-
Use HTTPS In the Webhook for Jenkins as HTTP is not supported for Jira Webhooks.
Step 1: Ensure that the "Issue updated" checkbox is selected. This will send webhook events whenever an issue is updated.
- Step 2: Define your JQL filter in the textbox below, depending on the conditions under which you want the webhook to trigger. For example, the current JQL
status = "In Progress"
triggers events only when the issue status is "In Progress". You can modify this JQL as needed to suit your specific requirements.
- Step 2: Define your JQL filter in the textbox below, depending on the conditions under which you want the webhook to trigger. For example, the current JQL
-
JENKINS-CONFIGURATION
Go To Manage Jenkins-> Plugins and Install
Generic Webhook Trigger
.Go to the job configuration.
In the Build Triggers section, check the Generic Webhook Trigger option.
Add the token you are using (e.g.,
ATATT3xFfGF0IvfTjCMdwSF2YmhyzPfr1WRmOZRnT0EHGeWi8Lxaqhlvcxf5zmOcOhGTff2ZWsjPAZj----------------------------------------------
Add the Token as Credential and Not Plain Text for Security Concerns.
Add the Configuration to edit the pipeline accordingly in the pipeline under
triggers
pipeline {
agent any
triggers {
GenericTrigger(
causeString: 'Triggered by Jira Issue Transition',
printContributedVariables: true,
printPostContent: true,
)
}
stages {
stage('Build') {
steps {
echo "Triggered by Jira Issue transition to 'In Progress'"
}
}
}
}
Transition Your Jira Ticket and Check Jenkins Build
CONCLUSION
By configuring a webhook in Jira with an HTTPS URL and defining a JQL filter, you can trigger Jenkins pipelines based on specific issue transitions, such as when an issue status changes to "In Progress" etc. Additionally, the article covers how to securely manage tokens in Jenkins and configure the pipeline to respond to Jira-triggered events, enabling seamless automation between the two tools.
Subscribe to my newsletter
Read articles from Tanuj Arora directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by