From JIRA Workflow, Pass Arguments To and Run Shell Script or Atlassian CLI

I need to create a Confluence page from JIRA. How does one get a JIRA workflow transition to pass arguments to a shell script or Confluence CLI (shell script preferred). Accepting return codes a bonus. Please advise. Thanks, Mikael.

4 answers

0 vote

You'll need to write a workflow post-function that makes the calls you need.

I'd actually start with Jamie's script runner ( https://studio.plugins.atlassian.com/wiki/display/GRV/Script+Runner ), as that gives you a lot of flexibility.

On the return code side, I think I'd shy away from that directly because you'll end up with users hanging around waiting for a response when they've done something simple. But you can do it.

Nic, thanks for your tip on script runner and suggesting post-function as the path.

Mikael Sikora added a comment - 30/May/12 12:53 PM

Janet and John,

Thanks for your research and suggestions. I will check out Workflow Plugin Modules
(https://developer.atlassian.com/display/JIRADEV/Workflow+Plugin+Modules) and Applying post functions to transitions (https://confluence.atlassian.com/display/JIRA050/Configuring+Workflow) to see if they have what I need as a solution.

Regards,

Mikael

Janet Albion [Atlassian] added a comment - 29/May/12 7:03 AM

Hi Mikael,

We believe that to achieve this requirement, the JIRA instance need to be customised or a plugin need to be developed. Since both customization and development related query is beyond the scope of our support, we strongly recommend you to create a query in https://answers.atlassian.com/ .

Do let us know if you have any other query.

Cheers,
Janet

Mikael Sikora added a comment - 29/May/12 1:52 PM

Janet,

Thanks for your investigation into my question and your suggestions. Neither customizing my JIRA instance or creating a plugin is within the scope of my project. As an alternate approach, I am thinking of creating a custom hidden field "Create Confluence Page" that is a yes/no flag, that when at a particular workflow transition is triggered, the field is flagged as yes. Then I can use JIRA CLI to query for all issues with that field and use Confluence CLI to create a release page for all ones flagged as yes. After the page is created, the flag is set to no.

Please advise on how to create a custom field that is a) hidden and b) is automatically flagged during a workflow transition.

Thanks,

Mikael

John Garcia [Atlassian] added a comment - 29/May/12 6:06 PM

Mikael,

My research on this issue has revealed that post-functions cannot be applied to custom fields at this time. You may find that some of the experts at Answers or possibly a plugin might be of assistance with this issue.

More information related to custom fields can be found at this link

Let us know right away if there's anything we can do to assist you further.

Thanks!
John Garcia
Atlassian Support - SF

Praising myself:

http://confluence.kepler-rominfo.com/display/JJUP20/system

Your postfunction is this:

string [] rets = system("/opt/scripts/myscript.sh param1 param2");

it returns system exit code, first 4k from output and error streams.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

798 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you