Skip to content

Commit 716eaa3

Browse files
authored
Merge pull request #374 from stackhpc/epoxy-master-bp
Add stackhpc/master and Epoxy branch protection
2 parents 265fa85 + f974549 commit 716eaa3

File tree

2 files changed

+149
-0
lines changed

2 files changed

+149
-0
lines changed

terraform/github/branches.tf

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,77 @@ resource "github_branch_protection" "kayobe_branch_protection_caracal" {
204204
}
205205
}
206206

207+
resource "github_branch_protection" "kayobe_branch_protection_epoxy" {
208+
for_each = toset(var.repositories["Kayobe"])
209+
repository_id = data.github_repository.repositories[each.key].node_id
210+
211+
pattern = "stackhpc/2025.1"
212+
require_conversation_resolution = true
213+
allows_deletions = false
214+
allows_force_pushes = false
215+
216+
required_pull_request_reviews {
217+
dismiss_stale_reviews = true
218+
require_code_owner_reviews = true
219+
required_approving_review_count = 1
220+
}
221+
222+
push_restrictions = [
223+
resource.github_team.organisation_teams["Developers"].node_id
224+
]
225+
226+
required_status_checks {
227+
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/2025.1", lookup(var.required_status_checks, each.key, {
228+
"default" : [
229+
"tox / Tox pep8 with Python 3.12",
230+
"tox / Tox py3 with Python 3.12",
231+
"tox / Tox py3 with Python 3.10"
232+
]
233+
}).default)
234+
strict = false
235+
}
236+
237+
lifecycle {
238+
prevent_destroy = true
239+
}
240+
}
241+
242+
243+
resource "github_branch_protection" "kayobe_branch_protection_master" {
244+
for_each = toset(var.repositories["Kayobe"])
245+
repository_id = data.github_repository.repositories[each.key].node_id
246+
247+
pattern = "stackhpc/master"
248+
require_conversation_resolution = true
249+
allows_deletions = false
250+
allows_force_pushes = false
251+
252+
required_pull_request_reviews {
253+
dismiss_stale_reviews = true
254+
require_code_owner_reviews = true
255+
required_approving_review_count = 1
256+
}
257+
258+
push_restrictions = [
259+
resource.github_team.organisation_teams["Developers"].node_id
260+
]
261+
262+
required_status_checks {
263+
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/master", lookup(var.required_status_checks, each.key, {
264+
"default" : [
265+
"tox / Tox pep8 with Python 3.12",
266+
"tox / Tox py3 with Python 3.12",
267+
"tox / Tox py3 with Python 3.10"
268+
]
269+
}).default)
270+
strict = false
271+
}
272+
273+
lifecycle {
274+
prevent_destroy = true
275+
}
276+
}
277+
207278
resource "github_branch_protection" "openstack_branch_protection_py_3-6" {
208279
for_each = toset(var.repositories["OpenStack"])
209280
repository_id = data.github_repository.repositories[each.key].node_id
@@ -346,6 +417,76 @@ resource "github_branch_protection" "openstack_branch_protection_caracal" {
346417
}
347418
}
348419

420+
resource "github_branch_protection" "openstack_branch_protection_epoxy" {
421+
for_each = toset(var.repositories["OpenStack"])
422+
repository_id = data.github_repository.repositories[each.key].node_id
423+
424+
pattern = "stackhpc/2025.1"
425+
require_conversation_resolution = true
426+
allows_deletions = false
427+
allows_force_pushes = false
428+
429+
push_restrictions = [
430+
resource.github_team.organisation_teams["Developers"].node_id
431+
]
432+
433+
required_pull_request_reviews {
434+
dismiss_stale_reviews = true
435+
require_code_owner_reviews = true
436+
required_approving_review_count = 1
437+
}
438+
439+
required_status_checks {
440+
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/2025.1", lookup(var.required_status_checks, each.key, {
441+
"default" : [
442+
"tox / Tox pep8 with Python 3.12",
443+
"tox / Tox py3 with Python 3.12",
444+
"tox / Tox py3 with Python 3.10"
445+
]
446+
}).default)
447+
strict = false
448+
}
449+
450+
lifecycle {
451+
prevent_destroy = false
452+
}
453+
}
454+
455+
resource "github_branch_protection" "openstack_branch_protection_master" {
456+
for_each = toset(var.repositories["OpenStack"])
457+
repository_id = data.github_repository.repositories[each.key].node_id
458+
459+
pattern = "stackhpc/master"
460+
require_conversation_resolution = true
461+
allows_deletions = false
462+
allows_force_pushes = false
463+
464+
push_restrictions = [
465+
resource.github_team.organisation_teams["Developers"].node_id
466+
]
467+
468+
required_pull_request_reviews {
469+
dismiss_stale_reviews = true
470+
require_code_owner_reviews = true
471+
required_approving_review_count = 1
472+
}
473+
474+
required_status_checks {
475+
contexts = lookup(lookup(var.required_status_checks, each.key, {}), "stackhpc/master", lookup(var.required_status_checks, each.key, {
476+
"default" : [
477+
"tox / Tox pep8 with Python 3.12",
478+
"tox / Tox py3 with Python 3.12",
479+
"tox / Tox py3 with Python 3.10"
480+
]
481+
}).default)
482+
strict = false
483+
}
484+
485+
lifecycle {
486+
prevent_destroy = false
487+
}
488+
}
489+
349490
resource "github_branch_protection" "platform_branch_protection" {
350491
for_each = toset(var.repositories["Platform"])
351492
repository_id = data.github_repository.repositories[each.key].node_id

terraform/github/import_resources.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ def main() -> None:
235235
branch_protection_resource = BranchProtection(team_id.name.lower(
236236
), {f"{name}:stackhpc/2024.1": name for name in team_repositories}, parsed_args.dry_run, "_caracal")
237237
branch_protection_resource.refresh_resource()
238+
# Epoxy branch protection
239+
branch_protection_resource = BranchProtection(team_id.name.lower(
240+
), {f"{name}:stackhpc/2025.1": name for name in team_repositories}, parsed_args.dry_run, "_epoxy")
241+
branch_protection_resource.refresh_resource()
242+
# Master branch protection
243+
branch_protection_resource = BranchProtection(team_id.name.lower(
244+
), {f"{name}:stackhpc/master": name for name in team_repositories}, parsed_args.dry_run, "_master")
245+
branch_protection_resource.refresh_resource()
238246
elif team_id == TeamID.SMSLAB:
239247
branch_protection_resource = BranchProtection(team_id.name.lower(
240248
), {f"{name}:smslab/[y,z,2]*": name for name in team_repositories}, parsed_args.dry_run)

0 commit comments

Comments
 (0)