From f71e32cda8e31149afc55520e75bcb2712b79e6f Mon Sep 17 00:00:00 2001 From: Hannes Schmidt Date: Wed, 1 May 2024 23:30:28 -0700 Subject: [PATCH] Promotions/hotfixes for anvilprod can be tested in hammerbox --- .github/PULL_REQUEST_TEMPLATE/anvilprod-hotfix.md | 2 +- .github/PULL_REQUEST_TEMPLATE/anvilprod-promotion.md | 2 +- .github/pull_request_template.md.template.py | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/anvilprod-hotfix.md b/.github/PULL_REQUEST_TEMPLATE/anvilprod-hotfix.md index 9880507e6..3cba1e11b 100644 --- a/.github/PULL_REQUEST_TEMPLATE/anvilprod-hotfix.md +++ b/.github/PULL_REQUEST_TEMPLATE/anvilprod-hotfix.md @@ -37,7 +37,7 @@ Connected issue: #0000 ### System administrator (after approval) - [ ] Actually approved the PR -- [ ] Labeled PR as `no sandbox` +- [ ] Decided if PR can be labeled `no sandbox` - [ ] A comment to this PR details the completed security design review - [ ] PR title is appropriate as title of merge commit - [ ] Moved ticket to *Approved* column diff --git a/.github/PULL_REQUEST_TEMPLATE/anvilprod-promotion.md b/.github/PULL_REQUEST_TEMPLATE/anvilprod-promotion.md index 0080665d1..00348cb9b 100644 --- a/.github/PULL_REQUEST_TEMPLATE/anvilprod-promotion.md +++ b/.github/PULL_REQUEST_TEMPLATE/anvilprod-promotion.md @@ -37,7 +37,7 @@ Connected issue: #0000 ### System administrator (after approval) - [ ] Actually approved the PR -- [ ] Labeled PR as `no sandbox` +- [ ] Decided if PR can be labeled `no sandbox` - [ ] Moved ticket to *Approved* column - [ ] PR is assigned to only the operator diff --git a/.github/pull_request_template.md.template.py b/.github/pull_request_template.md.template.py index a4e8e1a77..40f099c46 100644 --- a/.github/pull_request_template.md.template.py +++ b/.github/pull_request_template.md.template.py @@ -189,6 +189,9 @@ def downstream_deployments(self, target_branch) -> AbstractSet[str]: for b in self.promotion.target_branches ))) + def has_sandbox_for(self, target_branch: str) -> bool: + return {None} != set(self.target_deployments(target_branch).values()) + def labels_to_promote(self, target_branch: str) -> AbstractSet[str]: return OrderedSet([ 'deploy:shared', @@ -215,7 +218,7 @@ def shared_deploy_is_two_phase(self, target_branch: str) -> bool: # deleted immediately. Even with two phases, personal deployments will # break after the second phase but the fix is simply to rebase any # feature branches and redeploy. - return {None} != set(self.target_deployments(target_branch).values()) + return self.has_sandbox_for(target_branch) def shared_deploy_target(self, target_branch: str) -> str: return 'apply' + iif(self.shared_deploy_is_two_phase(target_branch), '_keep_unused') @@ -615,7 +618,7 @@ def emit(t: T, target_branch: str): 'type': 'cli', 'content': ( 'Decided if PR can be labeled `no sandbox`' - if t in (T.default, T.backport) else + if t.has_sandbox_for(target_branch) else 'Labeled PR as `no sandbox`' ) }), @@ -738,7 +741,7 @@ def emit(t: T, target_branch: str): for d in t.target_deployments(target_branch) ], ]), - iif(any(s is not None for s in t.target_deployments(target_branch).values()), { + iif(t.has_sandbox_for(target_branch), { 'type': 'cli', 'content': 'Added `sandbox` label', 'alt': iif(t is T.upgrade, None, 'or PR is labeled `no sandbox`')