Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to I do Do... While/Until Loop ?

dhanarajanr February 9, 2024

Hi All,

I am sending a web request(POST) to trigger the Bitbucket pipeline using Automation for Jira and since it is async API, I have to loop and do a subsequent web request(GET) to get the pipeline completion status. Can I achieve this? if yes kindly explain.

Thanks in advance.

2 answers

1 accepted

1 vote
Answer accepted
Kalyan Sattaluri
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.
February 9, 2024

*Theoretically* - you can write a new rule which does this for you.

  • Trigger -> incoming webhook (with your pipeline ID in your payload, count = 0)
  • Action -> Send web request to bitbucket to get status using ID from webhookData.
  • If Condition -> response has succeeded, you move on to do your next steps.
  • Else Condition -> if count is < *some number* (so you dont do this indefinately)
  •          Action - call the same webhook again (with the same ID in your payload, count = incremented count)

 

Once you have this new rule setup, you modify your original rule and after your POST action, you call this webhook rule and send your pipeline ID in the payload with count = 0, so the above steps discussed can be done.

dhanarajanr February 10, 2024

Thanks @Kalyan Sattaluri , this will suit my need. brillant

Like Kalyan Sattaluri likes this
1 vote
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.
February 9, 2024

Hi @dhanarajanr -- Welcome to the Atlassian Community!

No, that is not a capability of automation rules.

 

What problem are you trying to solve by doing this?  That is, why do this?  Knowing that may help the community to offer better suggestions.

 

Until we know that...some potential work-arounds are:

  • Perform the polling / waiting with another service outside of Jira, and then call Jira REST API functions to perform what you needed to do in an automation rule
  • Perform the polling / waiting with another service outside of Jira, and then use that to trigger a rule using a webhook
  • Using a scheduled trigger rule, and a built-in stopping condition check, periodically call your REST API function.  I recommend against this approach due to the possible impacts to automation usage, service limits, etc.

Kind regards,
Bill

dhanarajanr February 10, 2024

Thanks @Bill Sheboy for your response and approach options. I am planning to use the incoming webhook option suggested by @Kalyan Sattaluri as it suits my situation

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events