The Automation Rule fails if the rule includes an Archived project
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
An automation rule fails fails with the error below if the rule scope includes an archived project:
Either you or the rule actor for this rule is missing some required permissions:
Note that having archived projects in the rule scope will also cause another issue which is described in the KB article Cannot enable or save Automation rule due to the error "Either you or the rule actor for this rule is missing some required permissions.
環境
- 9.4.0 以降の任意のバージョンの Jira Server/Data Center
- Automation For Jira (A4J) Server/Data Center on any version from 9.2.0
診断
シナリオ 1
- Set up a new Jira Software Data Center 9.12.12 with Automation for Jira 9.0.3.
- Create two projects with sample data.
- Create a new rule: "When the custom field Priority is changed, add a comment to the issue." Set the project scope to these two projects.
- Edit one issue to trigger the rule to make sure it is working well.
- Archive one of the projects.
- Edit one issue to trigger the rule again, and it is still working well in Automation for Jira 9.0.3.
- Upgrade Automation for Jira to 9.2.0.
- Edit one issue to trigger the rule, and now it fails.
シナリオ 2
- Set up a new Jira Software Data Center 9.12.12 with Automation for Jira 9.2.0.
- Create 2 projects.
- Create a rule and set the scope as the 2 projects.
- Test and verify the rule is working well.
- Archive one of the projects.
- Test again and the rule fails.
原因
In Automation For Jira 9.2.0, additional checks are added to verify permissions before executing the rule, so the behaviour is different from the one in Automation for Jira 9.0.3. This is done to validate the rule. In this scenario, if one of the projects is archived, the actor will not have permission to add a comment on an issue in that project, which makes the rule invalid. You can verify this by trying to edit and publish the rule without removing the archived project. You will see the same error. In order to get the rule working, invalid projects need to be excluded from selection.
ソリューション
Remove the archived projects from the rule scope.
To find all the rules that reference a project, you can run this query, replacing PROJKEY
by the actual project key:
SELECT rc."NAME",p.pname,p.pkey
FROM "AO_589059_RULE_CONFIG" rc
JOIN "AO_589059_RULE_CFG_PROJ_ASSOC" rcpa ON rc."ID"=rcpa."RULE_CONFIG_ID"
JOIN project p ON p.id=CAST(rcpa."PROJECT_ID" AS INT)
WHERE p.pkey='PROJKEY'
To identify the list of all the automation rules which are using an archived project in their scope, you can run the following SQL query below:
SELECT
rule_project_assoc."RULE_CONFIG_ID",
rule_config."NAME",
p.id,
p.pname,
p.pkey
FROM
propertyentry pe
JOIN
project p ON pe.entity_id = p.id
JOIN
"AO_589059_RULE_CFG_PROJ_ASSOC" rule_project_assoc ON p.id = CAST(rule_project_assoc."PROJECT_ID" AS INT)
JOIN
"AO_589059_RULE_CONFIG" rule_config ON rule_project_assoc."RULE_CONFIG_ID" = rule_config."ID"
WHERE
property_key = 'jira.archiving.projects'
ORDER BY
rule_project_assoc."RULE_CONFIG_ID";
These queries were made on PostgreSQL. Other DB engines might require removing the double-quote characters and possibly other adjustments.