Skip to content

Commit

Permalink
kube-style org automation (#25)
Browse files Browse the repository at this point in the history
* init kube-style org config

Signed-off-by: Ian Rudie <[email protected]>

* update teams, refine org

Signed-off-by: Ian Rudie <[email protected]>

* begin working on the script which manages the org

Signed-off-by: Ian Rudie <[email protected]>

* define workflow to update org, dry run only

Signed-off-by: Ian Rudie <[email protected]>

* update.sh fix to prevent unintended file execution

Signed-off-by: Ian Rudie <[email protected]>

* add notify-call-to-vote team to org

Signed-off-by: Ian Rudie <[email protected]>

---------

Signed-off-by: Ian Rudie <[email protected]>
  • Loading branch information
ilrudie authored Dec 11, 2024
1 parent 5248dcc commit 5a96b62
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/manage-org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Manage K8sGateway Org
on:
push:
branches:
- main
paths:
- org.yaml
jobs:
prep:
runs-on: ubuntu-latest
steps:
- name: checkout community repo
uses: actions/checkout@v4
- name: create token
run: |
echo $GH_TOK >> ./GH_TOK
env:
GH_TOK: ${{secrets.GATEWAYBOT}}
- name: update org
run: |
script/org/update.sh # --confirm
66 changes: 66 additions & 0 deletions org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
orgs:
k8sgateway:
admins:
- ilevine
- ilrudie
- linsun
- nfuden
- sam-heilbron
- williamgrh
- yuval-k
members:
- artberger
- craigbox
- danehans
- jbohanon
- jenshu
- josh-pritchard
- kevin-shelaga
- lgadban
- Nadine2016
- shashankram
- sheidkamp
- Sodman
- stevenctl
teams:
community-maintainers:
description: ""
members:
- craigbox
- danehans
- ilrudie
- jenshu
- linsun
privacy: closed
repos:
community: maintain
controller-maintainers:
description: ""
members:
- danehans
- jenshu
- lgadban
- nfuden
- sam-heilbron
- shashankram
- sheidkamp
- stevenctl
- yuval-k
privacy: closed
repos:
k8sgateway: maintain
documentation-maintainers:
description: ""
members:
- artberger
- craigbox
- Nadine2016
- williamgrh
privacy: closed
repos:
k8sgateway.io: maintain
notify-call-to-vote:
description: This team grants no permissions, it should be notified of all votes.
members:
- ilrudie
privacy: closed
47 changes: 47 additions & 0 deletions script/org/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail
set -x

REPO_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)
readonly REPO_ROOT

# these org admins are required for safety!
# peribolos requires that the user it runs as be an org admin, also for safety
readonly org_admins=(
ilevine
ilrudie
linsun
yuval-k
)

cd "${REPO_ROOT}"

readonly BIN_PATH="${REPO_ROOT}/bin"

cmd="${BIN_PATH}/peribolos"

# remove any existing peribolos, always install to prevent execution of an unintended file
if [ -e "${cmd}" ]; then
rm "${cmd}"
fi

# install peribolos
GOBIN=${BIN_PATH} go install sigs.k8s.io/prow/cmd/peribolos@main

# maybe add --ignore-invitees
args=(
--github-token-path="${REPO_ROOT}/GH_TOK"
--config-path="${REPO_ROOT}/org.yaml"
--fix-org
--fix-org-members
--fix-teams
--fix-team-members
--fix-team-repos
"${org_admins[@]/#/--required-admins=}"
)

# if you are feeling brave, run this script with org:admin and add the `--confirm`
"${cmd}" "${args[@]}" "${@}"

0 comments on commit 5a96b62

Please sign in to comment.