From db3a95bc27626e99628b3944f6fab0cc97eadf0d Mon Sep 17 00:00:00 2001 From: Sushanta Das Date: Wed, 14 Aug 2024 12:44:10 +0530 Subject: [PATCH] add github workflow to check task owners --- .github/workflows/check-task-owners.yaml | 15 +++++++++++ hack/check-task-owners.sh | 25 +++++++++++++++++++ task/acs-deploy-check/OWNERS | 5 ++++ task/acs-image-check/OWNERS | 5 ++++ task/acs-image-scan/OWNERS | 5 ++++ task/buildah-remote-oci-ta/OWNERS | 5 ++++ .../OWNERS | 5 ++++ task/gather-deploy-images/OWNERS | 5 ++++ task/rpm-ostree/OWNERS | 6 +++++ task/upload-sbom-to-trustification/OWNERS | 5 ++++ 10 files changed, 81 insertions(+) create mode 100644 .github/workflows/check-task-owners.yaml create mode 100755 hack/check-task-owners.sh create mode 100644 task/acs-deploy-check/OWNERS create mode 100644 task/acs-image-check/OWNERS create mode 100644 task/acs-image-scan/OWNERS create mode 100644 task/buildah-remote-oci-ta/OWNERS create mode 100644 task/download-sbom-from-url-in-attestation/OWNERS create mode 100644 task/gather-deploy-images/OWNERS create mode 100644 task/rpm-ostree/OWNERS create mode 100644 task/upload-sbom-to-trustification/OWNERS diff --git a/.github/workflows/check-task-owners.yaml b/.github/workflows/check-task-owners.yaml new file mode 100644 index 0000000000..fe2685b207 --- /dev/null +++ b/.github/workflows/check-task-owners.yaml @@ -0,0 +1,15 @@ +name: Validate PR - check task owners +'on': + pull_request: + branches: [main] +jobs: + check: + name: Check Task OWNERS + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Check task owners + run: | + ./hack/check-task-owners.sh diff --git a/hack/check-task-owners.sh b/hack/check-task-owners.sh new file mode 100755 index 0000000000..4c31bfe597 --- /dev/null +++ b/hack/check-task-owners.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +check_result=$(mktemp) + +# Check the OWNERS file is present for each task +find task/ -mindepth 1 -maxdepth 1 -type d | \ + while read -r task_dir; do + owners_file="$task_dir/OWNERS" + if [ ! -e "$owners_file" ]; then + echo "error: missing owners file $owners_file" >>"$check_result" + continue + fi + approvers=$(yq '.approvers[]' $owners_file) + reviewers=$(yq '.reviwers[]' $owners_file) + if [ -z "$approvers" ] && [ -z "$reviewers" ]; then + echo "error: $task_dir/OWNERS don't have atleast 1 approver and 1 reviewer" >>"$check_result" + fi + done + +if [ -s "$check_result" ]; then + cat "$check_result" + echo "Please add OWNERS file with atleast 1 approver and 1 reviewer" + exit 1 +fi + diff --git a/task/acs-deploy-check/OWNERS b/task/acs-deploy-check/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/acs-deploy-check/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team diff --git a/task/acs-image-check/OWNERS b/task/acs-image-check/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/acs-image-check/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team diff --git a/task/acs-image-scan/OWNERS b/task/acs-image-scan/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/acs-image-scan/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team diff --git a/task/buildah-remote-oci-ta/OWNERS b/task/buildah-remote-oci-ta/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/buildah-remote-oci-ta/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team diff --git a/task/download-sbom-from-url-in-attestation/OWNERS b/task/download-sbom-from-url-in-attestation/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/download-sbom-from-url-in-attestation/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team diff --git a/task/gather-deploy-images/OWNERS b/task/gather-deploy-images/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/gather-deploy-images/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team diff --git a/task/rpm-ostree/OWNERS b/task/rpm-ostree/OWNERS new file mode 100644 index 0000000000..9410aae190 --- /dev/null +++ b/task/rpm-ostree/OWNERS @@ -0,0 +1,6 @@ + +#See the OWNERS docs: https://go.k8s.io/owners +approvers: + - cgwalters +reviewers: + - cgwalters diff --git a/task/upload-sbom-to-trustification/OWNERS b/task/upload-sbom-to-trustification/OWNERS new file mode 100644 index 0000000000..d3f0ff4a7e --- /dev/null +++ b/task/upload-sbom-to-trustification/OWNERS @@ -0,0 +1,5 @@ +# See the OWNERS docs: https://go.k8s.io/owners +approvers: + - build-team +reviewers: + - build-team