Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ When a commit is pushed to the `main` branch (e.g., when a pull request merges),
1. Open `team-members/<team>.csv`
1. Add a new line of the form `<username>,<role>`, where `<role>` should be `member`.

### Give someone runner management or merge-queue bypass without making them an org owner?

Add them to the `infrastructure` team (`team-members/infrastructure.csv`). That team:

- Holds GitHub's predefined **CI/CD admin** organization role, granting management of
org self-hosted runners and runner groups (plus Actions policies, secrets, variables,
and usage metrics). See `organization.tf`.
- Is a ruleset bypass actor on `osac` and `osac-test-infra`, so its members can bypass
the merge queue and required status checks on those repos. See `ruleset_bypass_team_ids`
in `repositories.tf`.

The broader `wg-infra` working group keeps the narrower `runner-manager` role and the same
bypass; `infrastructure` is a smaller team for people who need this without the rest of the
working-group context.

### Add a new repository?

1. Open `repositories.tf`
Expand Down
26 changes: 26 additions & 0 deletions organization.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,29 @@ resource "github_organization_role_team" "runner_manager_wg_infra" {
role_id = github_organization_role.runner_manager.role_id
team_slug = github_team.all["wg-infra"].slug
}

# Assign GitHub's predefined "CI/CD admin" organization role to the infrastructure
# team. It grants admin access to Actions policies, runners, runner groups, hosted
# compute network configs, secrets, variables, and usage metrics for the org -- a
# superset of the runner-manager role above -- without granting org-owner access.
data "github_organization_roles" "all" {}

locals {
# Predefined roles are returned with source = "Predefined". The API's exact
# spelling for this role's `name` isn't documented (GitHub's own docs example
# for the analogous "security manager" role uses the slug "security_manager"),
# so match the known spellings exactly rather than with a loose regex. If the
# lookup comes back empty, get the real value and pin role_id directly:
# gh api /orgs/osac-project/organization-roles --jq '.roles[] | select(.source=="Predefined") | {id, name}'
cicd_admin_role_names = ["CI/CD admin", "cicd_admin", "ci_cd_admin"]

cicd_admin_role_id = one([
for r in data.github_organization_roles.all.roles : r.id
if r.source == "Predefined" && contains(local.cicd_admin_role_names, r.name)
])
}

resource "github_organization_role_team" "cicd_admin_infrastructure" {
role_id = local.cicd_admin_role_id
team_slug = github_team.all["infrastructure"].slug
}
20 changes: 17 additions & 3 deletions repositories.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ module "repo_osac" {
{
team_id = "wg-infra"
permission = "admin"
},
{
team_id = "infrastructure"
permission = "push"
}
]
# Prow plugins handle approval via OWNERS (lgtm/approved labels), not native
Expand Down Expand Up @@ -184,7 +188,10 @@ module "repo_osac" {
{ context = "Run unit tests (osac-operator)", integration_id = 15368 },
{ context = "Run unit tests (bare-metal-fulfillment-operator)", integration_id = 15368 },
]
ruleset_bypass_team_ids = [github_team.all["wg-infra"].id]
ruleset_bypass_team_ids = [
github_team.all["wg-infra"].id,
github_team.all["infrastructure"].id,
]

merge_queue = {
merge_method = "SQUASH"
Expand Down Expand Up @@ -328,6 +335,10 @@ module "repo_osac_test_infra" {
{
team_id = "wg-infra"
permission = "admin"
},
{
team_id = "infrastructure"
permission = "push"
}
]
required_approvals = null
Expand All @@ -341,8 +352,11 @@ module "repo_osac_test_infra" {
# check_response_timeout_minutes for a check that never reports.
{ context = "pre-commit", integration_id = 15368 },
]
ruleset_bypass_team_ids = [github_team.all["wg-infra"].id]
environments = [{ name = "e2e-test" }]
ruleset_bypass_team_ids = [
github_team.all["wg-infra"].id,
github_team.all["infrastructure"].id,
]
environments = [{ name = "e2e-test" }]

merge_queue = {
merge_method = "SQUASH"
Expand Down
3 changes: 3 additions & 0 deletions team-members/infrastructure.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
username,role
omer-vishlitzky,member
minmzzhang,member
1 change: 1 addition & 0 deletions teams.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ observability-wg,observability working group,secret
personas-wg,Personas working group,secret
documentation-wg,Documentation working group,secret
wg-infra,OSAC Infrastructure working group,closed
infrastructure,Infrastructure & CI/CD operations - runners and merge-queue bypass,closed
Loading