I’m working on setting up automation between Jenkins and Jira. What I want to achieve is pretty straightforward but I’m not sure about the best approach.
When my Jenkins pipeline fails during build or testing phases, I need it to automatically create a ticket in Jira (could be a bug or task type). Then when the same pipeline runs successfully again, it should automatically close that ticket without any manual work.
I’ve looked into some plugins but I’m not sure which combination works best for this workflow. Has anyone implemented something similar? What’s the most reliable way to handle the ticket lifecycle automatically based on Jenkins build status?
Any guidance on the configuration steps would be really helpful.
You’ll need to plan the ticket matching carefully. I built something like this using Jenkins webhooks + JIRA’s REST API. Here’s what worked for me: embed unique IDs in both the ticket summary and Jenkins build metadata. I use project name + git commit hash. Way more reliable than plugins, which crash under heavy load. When builds pass, I send a POST to JIRA’s transition endpoint and search for open tickets with matching IDs. Watch out for multiple builds on the same branch running at once - you’ll get orphaned tickets that never close automatically.
i did this too! used the jira plugin and setup post-build actions. just put your jira creds in the global settings and make triggers for ticket creation on build fail and res it when it passes. linking tickets was a bit tricky tho - i go by build names or git hashes.
We rolled this out at my company six months ago. The biggest pain point? Keeping ticket states synced across multiple build cycles. Use the Jenkins JIRA Plugin with a custom JIRA field that stores the Jenkins job ID - this stops duplicate tickets when builds fail back-to-back. For the automation, write a pipeline script that checks for existing open tickets before creating new ones. Ticket resolution runs smooth once you nail the JQL queries to match failed builds with their tickets. Don’t forget proper error handling - network hiccups between Jenkins and JIRA will break everything.