Summary
At a stage in the workflow of a JIRA issue, you may want to do some action against the Confluence instance. For instance, create a skeleton design page or add a comment to an existing page. By taking advantage of the normal Confluence notification support, this could be used to involve non-developers in the workflow of an issue including people that may not have direct access to JIRA. This is relatively easy to do.
It is assumed you are familiar with JIRA workflow design and editing. You should also be comfortable running CLI actions from the command line first.
Steps
- Determine the CLI action(s) you want to run on your Confluence instance.
- Use the Confluence CLI client to test running of the action(s) to ensure you have the right parameters and it does everything you need. In the case of creating a page, make sure the page looks they way you want it.
- Use addPage to create a new page. An alternative is to use storePage if you want to create a page or overwrite an existing page.
- A better alternative may be to use copyPage to copy a template page. Use descendents parameter to copy a whole tree of template pages.
- Recommend using wiki markup (default) as it is normally easier to deal with. An alternative is to use storage format (noConvert parameter) but make sure it is accurate by copying from an example page storage view.
- Recommend the following to help you will problem determinate: How to add advanced logging.
- Edit your workflow.
- Select to Add a post function in the appropriate transition.
- Select CLI action.
- Select Confluence in the Product pulldown.
- Copy the single CLI action from step 2 into the Action field. Note that Substitution variables can be used.
- If you have multiple actions, use the run action in the Action field and all the individual actions in the Data field, one per line.
- Save.
- Publish the workflow.
- Test on an example issue by running the workflow step.
- Verify the page is created as expected.
Advanced Examples
The above shows the setup required to run a Confluence action as part of a JIRA workflow. Once that is mastered, you can easily extend your example to cover more advanced user scenarios. That usually means a more complicated Confluence action needs to be run. It is best and fastest to construct that by using the Confluence client to test first and then once you are happy with the result, it can be copied back into the JIRA post function. Here are some scenarios: