Ohey, we have an existing automation that runs monthly and puts an "engineering-rca" label on any new RCA Confluence pages ("publishing" pages labeled engineering-rca-draft by replacing them with engineering-rca). We wanted to add to that, so that for any page that has the label engineering-rca added:
create a task in RETRO project with same title as the RCA page.
Fill in the Documentation Link field with the link to the RCA page.
Fill in the Description with the link to the RCA page.
Assign the issue to the listed owner of the the RCA page.
Add the label engineering-rca
add a link for this issue to the RCA page (preferably at the top), if possible.
Bonus: link the Jira issues listed in the Preventive Actions section of the RCA Confluence page to the RETRO RCA ticket, or suggest an alternative way to approach this.
This was accomplished with two automations:
Scope: all Spaces - must Check to allow other rule actions to trigger this rule.
When Page labeled with engineering-rca
Create new Task in RETRO
Summary: {{page.title}}
Description: [{{page.title}}|{{page.url}}]
Labels: engineering-rca
Additional fields:
{
"fields": {
"Documentation Link": "{{page.url}}"
}
}
Check to see if there is already a RETRO task associated with this page (in the event that the engineering-rca label was removed and then added back)
Web request for API Jira for issues linked to this page that also contain the engineering-rca label.
issue in (issuesWithRemoteLinksByGlobalId('appId=OURAPPID&pageId={{page.id}}')) and labels = "engineering-rca"
Only proceed if size of results = 0
Send web request to obtain existing page content
Create taskParagraph variable to prepend new task to top of page inside of an Info panel.
<ac:structured-macro ac:name="info" ac:schema-version="1" ac:macro-id="OURPANELMACROID">
<ac:rich-text-body>
<p>Jira Issue: <ac:structured-macro ac:name="jira" ac:schema-version="1" ac:macro-id="OURJIRAMACROID">
<ac:parameter ac:name="key">{{createdIssue.key}}</ac:parameter>
<ac:parameter ac:name="serverId">OURJIRASERVERID</ac:parameter>
<ac:parameter ac:name="server">System Jira</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro><p>
(This content above was obtained by copying it from the storage format of an existing page.)
Send web request to update existing page content
PUT https://OURSITE.atlassian.net/wiki/api/v2/pages/{{page.id}}
Custom data:
{
"id": "{{page.id}}",
"status": "current",
"title": "{{webResponse.body.title}}",
"body": {
"representation": "storage",
"value": "{{taskParagraph.jsonEncode}}{{webResponse.body.body.storage.value.jsonEncode}}"
},
"version": {
"number": {{webResponse.body.version.number.plus(1)}},
"message": "Adding RETRO Task"
}
}
[Caveat: Linking of issues on RCA Confluence Page relies on “automatic” creation of remote links, which apparently is triggered by selecting Inline, Card, or Embed Views for a Jira “Smart Link”. (I opened a ticket about this.]
Scope: project RETRO - must Check to allow other rule actions to trigger this rule.
When Issue is created where Issue Type = Task and Labels = engineering-rca
Create pageId variable by extracting Page Id from Documentation Link:
{{issue."Documentation Link".match("./pages/(.)")}}
Create pageQuery variable:
issue in (issuesWithRemoteLinksByGlobalId('appId=OURAPPID&pageId={{pageId}}'))
Sparse documentation: workItemsWithRemoteLinksByGlobalId()
appId of Confluence server can be found by inspecting Application Links in Jira:
Branch rule for JQL: {{pageQuery}}
For each issue found, link it as “addresses the Trigger issue”
Darryl Lee
Sr. Atlassian Systems Engineer
Roku, Inc.
San Jose, CA
199 accepted answers
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
1 comment