Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Release automation rule doesn't work when a release is made via Rest API

Ismaeil Ghouneim July 11, 2024

We have an Automation Rule that typically triggers when a release gets released. However, I'm automating this process in the sense that, a github workflow creates the release and releases it using `https://***.atlassian.net/rest/api/3/version` and for some reason, this doesn't trigger the Automation Rule.

 

Why is that? Shouldn't the automation rule be executed whenever a release gets created regardless of whether it was made manually through JIRA UI or the RestAPI?

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2024

Hi @Ismaeil Ghouneim -- Welcome to the Atlassian Community!

To confirm, is this the Jira REST API endpoint you are using:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-post

Did you confirm the version was created successfully in the project?

Is your automation rule defined / scoped in the same project where the version was created?

 

As an experiment in one single Jira project, I used one automation rule to call the REST API to create a version and a second one to detect that a version was created, and both worked as expected.

 

Kind regards,
Bill

Ismaeil Ghouneim July 11, 2024

Thanks for answering Bill.

Pretty much yes, the release gets created successfully using this mentioned REST API and the rule is defined in the same project (that's why it works fine when the release is created via the UI). But the rule doesn't execute. I even had a look at the Audit Log and it's not there.

I even now tried using cURL directly to create the release via the API and it does the same behaviour, creates the release no problem but the trigger never gets executed.

 

FIX_VERSION="****"
CREATE_PAYLOAD="{\"name\":\"***\",\"project\":\"***\",\"releaseDate\":\"$(date +%F)\",\"released\": true}"
curl -X POST -v -H "Content-Type: application/json" -u "jira_token" -d "${CREATE_PAYLOAD}" https://******.atlassian.net/rest/api/3/version
 

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2024

I just tried using Postman and the version create was correctly detected to trigger a rule, so it does not seem to an active problem / incident.  Perhaps try the same thing as that would eliminate an issue with your call.

 

 

Ismaeil Ghouneim July 11, 2024

Aha! For anyone interested, I figured out what the issue was.

The order of my workflow execution was as follows:

  1. Create a version using POST with `released: true`
  2. Associate any ticket with that fix version

Apparently for JIRA, this creates an-already-released version which for some reason doesn't make the automation rule detect it. You see the trigger here basically works when an unreleased version is released. In short, the automation rule is triggered by the PUT method.

The order of execution that makes it work:

  1. Create a version using POST with `released: false`
  2. Associate tickets .. whatever
  3. Update the version using PUT (by version id) with `released: true`

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2024

That is interesting...I tried both: released: false and true.

As long has you have it working now, that is great!

Like Ismaeil Ghouneim likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events