CircleCI-Public / jira-connect-orb

Display the status of CircleCI workflows and deployments in Jira!
https://circleci.com/orbs/registry/orb/circleci/jira
MIT License
25 stars 27 forks source link

Does orb support parallelism and complex workflows? #14

Closed fatbeard2 closed 4 years ago

fatbeard2 commented 5 years ago

Orb version

1.0.5

What happened

First of all, thanks for this plugin. I was able setup orb/plugin/config so it would update build status for ticket in Jira. So, the configuration, plugin setup, etc. are correct. But I've got a CircleCI workflow setup in a slightly more complex manner than example config. Here's a screenshot

image

Note: teaspoon_tests, rspec_tests and cucumber_test have parallelism setup to > 1

So I'd like to know if there's a way to setup orb in a way that it will notify JIRA only once, when all jobs in the pipeline are done(succeeded or failed)

Here's what I tried so far:

  1. Added post-steps: - jira/notify to each job. But this leads to JIRA api being called multiple times. 1 time per job + jobs with parallelism call it once for every parallel executor. As far as I understand this means that only latest result will be displayed in JIRA. If one job fails and reports failed status, and another job after that succeeds JIRA will display successful build status.

  2. Tried to add it as a separate job in the workflow that runs after all jobs are done, but it is only executed if all previous jobs are successful(didn't find a way to make it happen in either case). As far as I understand it means that JIRA will only receive successful states. It looks something like this image

So, I'm looking for some guidance here. Is there a way to make it work? Are my assumptions about how it works correct? I'm happy to provide any further details.

lokst commented 4 years ago

@fatbeard2 One suggestion is to add a separate workflow that will: 1) Invoke the https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/api-changes.md#get-workflowid API to get the pipeline_id from the response 2) Invoke the https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/api-changes.md#get-pipelineid API passing pipeline_id as a parameter to get the id of the other workflow 3) Poll the https://github.com/CircleCI-Public/api-preview-docs/blob/master/docs/api-changes.md#get-workflowidjob API to get the jobs running in that workflow and their statuses, until the outcome is known 4) Invoke jira/notify accordingly

lokst commented 4 years ago

Closing this issue for now as I think the above suggestion might be viable, but feel free to reopen it.

fatbeard2 commented 4 years ago

@lokst Thanks