Automation for Jira - Writing a rule that clones stories (and their sub-tasks) linked to an Epic when the Epic is cloned
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
要約
Automation for Jira に付属する [課題を複製] アクションにはいくつかの制限事項があります。たとえば、このアクションには、エピック課題にリンクされているストーリーを複製するオプションはありません。
This limitation is tracked in the feature request JIRAAUTOSERVER-741 - Getting issue details... STATUS
The purpose of this knowledge article is to provide an example of automation rule that will automatically clone all the stories to an Epic along with their sub-tasks, when the Epic is cloned from the UI.
環境
- Jira Server / Data Center 8.0.0 以降のバージョン
- Automation for Jira 7.4.0 以降のバージョン
ソリューション
The solution consist in configuring 2 automation rules, along with some preliminary steps.
Preliminary step
This step consists in creating a new type of issue link, that will be used by the 2 automation rules:
- Log in as a Jira Admin user
- Go to ⚙ > Issues > Issue Linking
- Create a new type of link, using the parameters below:
- Name: Cloners (via rule)
- Outward Link Description: clones (via rule)
- Inward Link Description: is cloned (via rule) by
- After the link is created, it should appear as illustrated in the screenshot below:
Configuration of Automation Rule 1
新規トリガー: 課題がリンクされました
- リンクタイプ: Cloners
新しい条件: 課題フィールドの条件
- 最初の値: 課題タイプ
- 条件: イコール
- 第 2 の値: エピック
ブランチ ルール / 関連する課題
- 関連課題のタイプ: JQL
JQL:
"Epic Link" = {{destinationIssue}}
- プロジェクトに限定されたルール: <ここに自分のプロジェクト名を入力>
Make sure to untick the option Only include issues that have changed since the last time this rule executed
ブランチ:
新しいアクション: 課題の複製
- プロジェクト: 同じプロジェクト
- 課題タイプ: 同じ課題タイプ
要約:
{{issue.summary}}
- 設定するフィールドを選択: [エピックリンク] > [課題をトリガー]
New Action: Link Issues
- This issue: "is cloned (via rule) by"
- Issue: "Most recently created issue"
メイン ブランチに戻る:
New Action: Edit Issue
- 設定するフィールドを選択: [エピック名] > ([...] をクリックして選択)[Copy from with the following parameters (次のパラメーターを指定するコピー元)]:
- 値のコピー元となる課題: 現在の課題
- 値のコピー元となるフィールド: 要約
ルール全体を示すスクリーンショット
Configuration of Automation Rule 2
For this rule, make sure to tick the option Allow rule trigger in the Rule Details page, in order to allow the 1st rule to trigger this 2nd rule, as illustrated below:
新規トリガー: 課題がリンクされました
- Link Types: Cloners (via rule)
新しい条件: 課題フィールドの条件
- 最初の値: 課題タイプ
- 条件: イコール
- Second Value: Story
ブランチ ルール / 関連する課題
- 関連課題のタイプ: JQL
JQL:
parent = {{destinationIssue}}
- プロジェクトに限定されたルール: <ここに自分のプロジェクト名を入力>
Make sure to untick the option Only include issues that have changed since the last time this rule executed
ブランチ:
新しいアクション: 課題の複製
- プロジェクト: 同じプロジェクト
- Issue Type: Sub-task
- Parent issue: "Trigger Issue"
要約:
{{issue.summary}}
ルール全体を示すスクリーンショット
ルールの動作を確認する
Let's assume that we have an Epic issue linked to 2 stories, and each stories has a few sub-tasks, as shown in the screenshots below:
- Epic Issue
- Story 1 and its sub-tasks
- Story 2 and its sub-tasks
Let's clone this Epic, by going to More > Clone:
After the Epic is cloned:
- make sure to refresh the page. You will see that the new Epic was created with 2 cloned stories linked to it:
- if you click on each cloned story, you will see that they were created with the cloned sub-tasks as well:
- cloned Story 1
- cloned Story 2
- cloned Story 1