Skip to content

Commit

Permalink
Promotions/hotfixes for anvilprod can be tested in hammerbox
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-ucsc committed May 2, 2024
1 parent 676e301 commit f71e32c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/anvilprod-hotfix.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/anvilprod-promotion.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions .github/pull_request_template.md.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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')
Expand Down Expand Up @@ -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`'
)
}),
Expand Down Expand Up @@ -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`')
Expand Down

0 comments on commit f71e32c

Please sign in to comment.