From 1ce8236de49f7510b3a31e892e10efe2b1c7558c Mon Sep 17 00:00:00 2001 From: Alex Welsh Date: Thu, 4 Jun 2026 13:29:19 +0100 Subject: [PATCH] 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. --- terraform/github/branches.tf | 16 ++++------------ terraform/github/import_resources.py | 2 +- terraform/github/terraform.tfvars.json | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/terraform/github/branches.tf b/terraform/github/branches.tf index 678a617e..739291fe 100644 --- a/terraform/github/branches.tf +++ b/terraform/github/branches.tf @@ -104,11 +104,7 @@ resource "github_branch_protection" "kayobe_branch_protection_py_3-6" { for_each = toset(var.repositories["Kayobe"]) repository_id = data.github_repository.repositories[each.key].node_id - # NOTE(Alex-Welsh): The pattern here is not ideal but it is difficult to - # achieve more precision with the matching tools that GitHub provides. - # https://stackoverflow.com/questions/53135414/how-to-apply-one-github-branch-rule-to-multiple-branches - # Remember to update import_resources.py! - pattern = "stackhpc/[vwxy]*" + pattern = "stackhpc/yoga" require_conversation_resolution = true allows_deletions = false allows_force_pushes = false @@ -128,7 +124,7 @@ resource "github_branch_protection" "kayobe_branch_protection_py_3-6" { } required_status_checks { - contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/[vwxy]*", lookup(var.required_status_checks, each.key, { + contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/yoga", lookup(var.required_status_checks, each.key, { "default" : [ "tox / Tox pep8 with Python 3.8", "tox / Tox py3 with Python 3.8" @@ -377,11 +373,7 @@ resource "github_branch_protection" "openstack_branch_protection_py_3-6" { for_each = toset(var.repositories["OpenStack"]) repository_id = data.github_repository.repositories[each.key].node_id - # NOTE(Alex-Welsh): The pattern here is not ideal but it is difficult to - # achieve more precision with the matching tools that GitHub provides. - # https://stackoverflow.com/questions/53135414/how-to-apply-one-github-branch-rule-to-multiple-branches - # Remember to update import_resources.py! - pattern = "stackhpc/[vwxy]*" + pattern = "stackhpc/yoga" require_conversation_resolution = true allows_deletions = false allows_force_pushes = false @@ -401,7 +393,7 @@ resource "github_branch_protection" "openstack_branch_protection_py_3-6" { } required_status_checks { - contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/[vwxy]*", lookup(var.required_status_checks, each.key, { + contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/yoga", lookup(var.required_status_checks, each.key, { "default" : [ "tox / Tox pep8 with Python 3.8", "tox / Tox py3 with Python 3.8" diff --git a/terraform/github/import_resources.py b/terraform/github/import_resources.py index a03477cd..01fbc5c5 100755 --- a/terraform/github/import_resources.py +++ b/terraform/github/import_resources.py @@ -220,7 +220,7 @@ def main() -> None: if team_id == TeamID.KAYOBE or team_id == TeamID.OPENSTACK: # Pre-Zed branch protection branch_protection_resource = BranchProtection(team_id.name.lower( - ), {f"{name}:stackhpc/[vwxy]*": name for name in team_repositories}, parsed_args.dry_run, "_py_3-6") + ), {f"{name}:stackhpc/yoga": name for name in team_repositories}, parsed_args.dry_run, "_py_3-6") branch_protection_resource.refresh_resource() # Zed branch protection branch_protection_resource = BranchProtection(team_id.name.lower( diff --git a/terraform/github/terraform.tfvars.json b/terraform/github/terraform.tfvars.json index c8ade82a..e7147e37 100644 --- a/terraform/github/terraform.tfvars.json +++ b/terraform/github/terraform.tfvars.json @@ -361,7 +361,7 @@ "aio (Ubuntu Jammy OVN) / All in one", "aio upgrade (Rocky 9 OVN) / All in one" ], - "stackhpc/[vwxy]*": [ + "stackhpc/yoga": [ "Tox pep8 with Python 3.8", "Tox releasenotes with Python 3.8", "Build Kayobe Image / Build kayobe image",