Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

governance: add job to remove inactive users #3832

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
periodics:
- name: periodic-community-remove-inactive-users-from-orgs-yaml
cron: "15 1 1 3,6,9,12 *" # At 01:15 on day-of-month 1 in March, June, September, and December.
cluster: kubevirt-prow-control-plane
extra_refs:
- org: kubevirt
repo: community
base_ref: main
workdir: true
- org: kubevirt
repo: project-infra
base_ref: main
annotations:
testgrid-create-test-group: "false"
labels:
preset-github-credentials: "true"
decorate: true
spec:
containers:
- args:
- |
# install yq
curl -Lo ./yq https://github.com/mikefarah/yq/releases/download/v4.44.6/yq_linux_amd64
chmod +x ./yq && mv ./yq /usr/local/bin/yq

ARTIFACTS=/tmp/artifacts
export ARTIFACTS
mkdir "${ARTIFACTS}"

PROJECT_INFRA_DIR=$(cd ../project-infra && pwd)
ORGS_YAML=${PROJECT_INFRA_DIR}/github/ci/prow-deploy/kustom/base/configs/current/orgs/orgs.yaml
CONTRIBUTIONS_OUTPUT_FILE_NAME="${ARTIFACTS}/contributions-report.yaml"

go run ./generators/cmd/contributions \
--github-token /etc/github/oauth \
--report-output-file-path ${CONTRIBUTIONS_OUTPUT_FILE_NAME} \
--months 12

for githubUser in $(yq '.result.inactiveUsers[]' < ${CONTRIBUTIONS_OUTPUT_FILE_NAME}); do
sed -i -r '/\s+- '"$githubUser"'/d' ${ORGS_YAML}
done

git-pr.sh \
-c "echo 42" \
-p $PROJECT_INFRA_DIR \
-r project-infra \
-b remove-inactive-users-from-orgs-yaml \
-s 'Remove inactive users from orgs.yaml' \
-B $'Automatic run of k/community generators/cmd/contributions.\n\nFYI:'"$(for githubUser in $(yq '.result.inactiveUsers[]' < ${CONTRIBUTIONS_OUTPUT_FILE_NAME}); do echo "@$githubUser"; done)"'\n\n/cc @aburdenthehand @kubevirt/sig-buildsystem'
command:
- /usr/local/bin/runner.sh
- /bin/bash
- -ce
image: quay.io/kubevirtci/pr-creator:v20240913-6773146
securityContext:
privileged: true
resources:
requests:
memory: "1Gi"
limits:
memory: "1Gi"

112 changes: 0 additions & 112 deletions hack/remove-users-without-contributions.sh

This file was deleted.