The problem is that when developers make commits with multiple ticket references like “PROJ-98765: TASK-11223 implemented new feature”, the Jenkins job updates both tickets automatically. I only want it to update the first Jira ticket mentioned in the commit message (PROJ-98765 in this example).
Is there a way to configure the JiraIssueUpdater to only process the first ticket reference instead of all of them? Maybe there’s a different issue selector class I should be using?
Easiest fix? Just change your commit message format. Have devs put the main ticket first, then mention any others in the description. Way simpler than messing with Jenkins configs or writing custom scripts.
Hit this same issue six months back. DefaultIssueSelector won’t let you pick which tickets to process, so I went with pipeline scripting instead. Here’s what worked: grab the commit messages first, run a regex to find just the first ticket reference, then feed that to JiraIssueUpdater. I used currentBuild.changeSets to pull the messages, filtered with regex, and tweaked the SCM context on the fly. You get full control over ticket updates and can still use the existing Jira plugin. The trick is catching the data before it hits the issue selector - don’t bother trying to configure the selector.
DefaultIssueSelector grabs all ticket references from commit messages, which leads to the problem you’re facing. Unfortunately, there’s no built-in selector to limit it to just the first ticket. A practical solution would be to preprocess the commit message by using regex to extract the first ticket ID. Replace the commit message temporarily with just that ticket reference for triggering the updater, and if necessary, restore the original message afterward. Alternatively, consider bypassing the plugin and using the Jira REST API directly for more control over the updates.
u can create a custom regex to grab just the 1st ticket. i faced the same issue & parsed commit msgs b4 hitting the Jira updater. try def firstTicket = commitMessage.find(/[A-Z]+-\d+/) & update that ticket instead of using the default.
I’ve worked with Jenkins Jira integrations for years - the built-in selectors suck for custom logic like this.
Skip the Jenkins plugins and automate this with Latenode instead. Set up a webhook to catch Git commits, use regex to grab the first ticket from the commit message, then hit Jira’s API directly to update that specific ticket.
You get full control over the logic. Want only the first ticket updated? Done. Need different messages based on commit content? Easy. Throw in Slack notifications or other system updates while you’re at it.
I built something similar last year for custom Jira updates based on deployment status. Took 30 minutes in Latenode vs days fighting Jenkins plugin limitations.