Skip to content

Commit 1ce8236

Browse files
committed
Remove branch protection for vwx releases
This change adapts our old branch protection rules - matching stackhpc/[vwxy]* to instead only match stackhpc/yoga for two reasons: 1. Older releases (V/W/X) are no longer supported 2. branch protection rules with wildcard matching regularly breaks our automation. For example, stackhpc/yoga-community files matches the existing rules, and is a common branch name for our automation, which can then no longer be deleted. This is a common occurance when re-creating an existing automated PR.
1 parent e2afa8b commit 1ce8236

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

terraform/github/branches.tf

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ resource "github_branch_protection" "kayobe_branch_protection_py_3-6" {
104104
for_each = toset(var.repositories["Kayobe"])
105105
repository_id = data.github_repository.repositories[each.key].node_id
106106

107-
# NOTE(Alex-Welsh): The pattern here is not ideal but it is difficult to
108-
# achieve more precision with the matching tools that GitHub provides.
109-
# https://stackoverflow.com/questions/53135414/how-to-apply-one-github-branch-rule-to-multiple-branches
110-
# Remember to update import_resources.py!
111-
pattern = "stackhpc/[vwxy]*"
107+
pattern = "stackhpc/yoga"
112108
require_conversation_resolution = true
113109
allows_deletions = false
114110
allows_force_pushes = false
@@ -128,7 +124,7 @@ resource "github_branch_protection" "kayobe_branch_protection_py_3-6" {
128124
}
129125

130126
required_status_checks {
131-
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/[vwxy]*", lookup(var.required_status_checks, each.key, {
127+
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/yoga", lookup(var.required_status_checks, each.key, {
132128
"default" : [
133129
"tox / Tox pep8 with Python 3.8",
134130
"tox / Tox py3 with Python 3.8"
@@ -377,11 +373,7 @@ resource "github_branch_protection" "openstack_branch_protection_py_3-6" {
377373
for_each = toset(var.repositories["OpenStack"])
378374
repository_id = data.github_repository.repositories[each.key].node_id
379375

380-
# NOTE(Alex-Welsh): The pattern here is not ideal but it is difficult to
381-
# achieve more precision with the matching tools that GitHub provides.
382-
# https://stackoverflow.com/questions/53135414/how-to-apply-one-github-branch-rule-to-multiple-branches
383-
# Remember to update import_resources.py!
384-
pattern = "stackhpc/[vwxy]*"
376+
pattern = "stackhpc/yoga"
385377
require_conversation_resolution = true
386378
allows_deletions = false
387379
allows_force_pushes = false
@@ -401,7 +393,7 @@ resource "github_branch_protection" "openstack_branch_protection_py_3-6" {
401393
}
402394

403395
required_status_checks {
404-
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/[vwxy]*", lookup(var.required_status_checks, each.key, {
396+
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/yoga", lookup(var.required_status_checks, each.key, {
405397
"default" : [
406398
"tox / Tox pep8 with Python 3.8",
407399
"tox / Tox py3 with Python 3.8"

terraform/github/import_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def main() -> None:
220220
if team_id == TeamID.KAYOBE or team_id == TeamID.OPENSTACK:
221221
# Pre-Zed branch protection
222222
branch_protection_resource = BranchProtection(team_id.name.lower(
223-
), {f"{name}:stackhpc/[vwxy]*": name for name in team_repositories}, parsed_args.dry_run, "_py_3-6")
223+
), {f"{name}:stackhpc/yoga": name for name in team_repositories}, parsed_args.dry_run, "_py_3-6")
224224
branch_protection_resource.refresh_resource()
225225
# Zed branch protection
226226
branch_protection_resource = BranchProtection(team_id.name.lower(

terraform/github/terraform.tfvars.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@
361361
"aio (Ubuntu Jammy OVN) / All in one",
362362
"aio upgrade (Rocky 9 OVN) / All in one"
363363
],
364-
"stackhpc/[vwxy]*": [
364+
"stackhpc/yoga": [
365365
"Tox pep8 with Python 3.8",
366366
"Tox releasenotes with Python 3.8",
367367
"Build Kayobe Image / Build kayobe image",

0 commit comments

Comments
 (0)