-
Bug
-
Resolution: Unresolved
-
Minor
-
Jenkins: 2.263.3
Jira-trigger-pluin: 1.0.1
Jira: 8.12.2
Given the following conditions:
- Jira project named test with the following workflow
Create -> Step1 -> Step2 -> Step3 -> Step4
- Jira Webhook configured with
Build when an issue is updated in JIRA: JQL filter: project = "test"
- Jenkins Wrapper Job with:
- JQL filter: project = test and status in (Step1, Step3)
- Jira Field Matcher: Jira field ID = status
- Issue Attribute Path populates a Jenkins Parameter named JIRA_STATUS with issue attribute path status.name
- System Groovy script that reads JIRA_STATUS and runs one of the following
- Jenkins Job for Step1
This job will eventually contact jira and transition JIRA_ISSUE_KEY to Step2 - Jenkins Job for Step3
This job will eventually contact jira and transition JIRA_ISSUE_KEY to Step4
- Jenkins Job for Step1
The expected behaviour is for the Wrapper job to be triggered only when issue is moved to Step1 or Step3.
The above flow works great, until I introduced automation in Jira side to (Jira ScriptRunner Post-Function - Fast-track transition an issue).
When certain conditions are met Jira transitions the issue from Step2 to Step3.
This happens very fast (~ 1 second after the Jenkins job for Step1 transition the issue to Step2).
When this happens Jenkins receives two web hooks and triggers the Job for Step2 twice (instead of acting only on the second one):
First webhook: From Step1 to Step 2
Feb 01, 2021 10:57:51 PM FINEST com.ceilfors.jenkins.plugins.jiratrigger.webhook.JiraWebhook { "timestamp": 1612213070500, "webhookEvent": "jira:issue_updated", "issue_event_type_name": "issue_generic" ..... "changelog": { "id": "2279644", "items": [ { "field": "status", "fieldtype": "jira", "from": "10910", "fromString": "Step1", "to": "10911", "toString": "Step2" } ] } } Feb 01, 2021 10:57:51 PM FINE com.ceilfors.jenkins.plugins.jiratrigger.JiraTrigger [PR_WRAPPER] - Processing PR-174 - ChangelogGroup{author=null, created=null, items=[ChangelogItem{fieldType=JIRA, field=status, from=10910, fromString=Step1, to=10911, toString=Step2}]} Feb 01, 2021 10:57:51 PM FINE com.ceilfors.jenkins.plugins.jiratrigger.JiraTrigger [PR_WRAPPER] - Scheduling build for PR-174 - ChangelogGroup{author=null, created=null, items=[ChangelogItem{fieldType=JIRA, field=status, from=10910, fromString=Step1, to=10911, toString=Step2}]}
Second webhook: From Step2 to Step 3
Feb 01, 2021 10:57:51 PM FINEST com.ceilfors.jenkins.plugins.jiratrigger.webhook.JiraWebhook { "timestamp": 1612213071127, "webhookEvent": "jira:issue_updated", "issue_event_type_name": "issue_generic" ..... "changelog": { "id": "2279645", "items": [ { "field": "status", "fieldtype": "jira", "from": "10911", "fromString": "Step2", "to": "10915", "toString": "Step3" } ] } } Feb 01, 2021 10:57:52 PM FINE com.ceilfors.jenkins.plugins.jiratrigger.JiraTrigger [PR_WRAPPER] - Processing PR-174 - ChangelogGroup{author=null, created=null, items=[ChangelogItem{fieldType=JIRA, field=status, from=10911, fromString=Step2, to=10915, toString=Step3}]} Feb 01, 2021 10:57:52 PM FINE com.ceilfors.jenkins.plugins.jiratrigger.JiraTrigger [PR_WRAPPER] - Scheduling build for PR-174 - ChangelogGroup{author=null, created=null, items=[ChangelogItem{fieldType=JIRA, field=status, from=10911, fromString=Step2, to=10915, toString=Step3}]}