Skip to content

Commit

Permalink
Merge branch 'main' into fix_optional_test-rock_jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
clay-lake authored Dec 3, 2024
2 parents 366a0f7 + e8490f6 commit 04b5f00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions .github/actions/validate-actor/validate-actor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,31 @@ workspace=$3
image_path=$4

echo "github.actor: ${actor}"
actor=$(echo "$actor" | sed 's/\[/\\[/g;s/\]/\\]/g') # Escape square brackets for actors like renovate[bot]
echo "admin-only: ${admin_only}"
if [[ ${admin_only} == true ]]; then
exit_status=0
echo "Expanding team mentions in the CODEOWNERS file"
cp ${workspace}/CODEOWNERS ${workspace}/CODEOWNERS.bak
teams=$(grep -oE '@[[:alnum:]_.-]+\/[[:alnum:]_.-]+' ${workspace}/CODEOWNERS || true | sort | uniq)
codeowners_file=$(mktemp)
cp ${workspace}/CODEOWNERS ${codeowners_file}
teams=$(grep -oE '@[[:alnum:]_.-]+\/[[:alnum:]_.-]+' ${codeowners_file} || true | sort | uniq)

for team in ${teams}; do
org=$(echo ${team} | cut -d'/' -f1 | sed 's/@//')
team_name=$(echo ${team} | cut -d'/' -f2)
members=$(gh api "/orgs/${org}/teams/${team_name}/members" | jq -r '.[].login')
replacement=$(echo "${members}" | xargs -I {} echo -n "@{} " | awk '{$1=$1};1')
sed -i "s|${team}|${replacement}|g" ${workspace}/CODEOWNERS
sed -i "s|${team}|${replacement}|g" ${codeowners_file}
done

if grep -wq "@${actor}" ${workspace}/CODEOWNERS; then
if grep -wq "@${actor}" ${codeowners_file}; then
echo "The workflow is triggered by ${actor} as the code owner"
elif cat ${workspace}/${image_path}/contacts.yaml | yq ".maintainers" | grep "\- " | grep -wq "${actor}"; then
echo "The workflow is triggered by ${actor} as a maintainer of the image ${image_path}"
else
echo "The workflow is triggered by a user neither as a code owner nor a maintainer of the image ${image_path}"
exit_status=1
fi
mv ${workspace}/CODEOWNERS.bak ${workspace}/CODEOWNERS
exit ${exit_status}
else
echo "The workflow is not restricted to non-code-owner or non-maintainer users"
Expand Down
14 changes: 7 additions & 7 deletions oci/mock-rock/_releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@
"1.1-22.04": {
"end-of-life": "2030-05-01T00:00:00Z",
"candidate": {
"target": "942"
"target": "951"
},
"beta": {
"target": "942"
"target": "951"
},
"edge": {
"target": "942"
"target": "951"
}
},
"1-22.04": {
"end-of-life": "2030-05-01T00:00:00Z",
"candidate": {
"target": "942"
"target": "951"
},
"beta": {
"target": "942"
"target": "951"
},
"edge": {
"target": "942"
"target": "951"
}
},
"1.2-22.04": {
"end-of-life": "2030-05-01T00:00:00Z",
"beta": {
"target": "943"
"target": "952"
},
"edge": {
"target": "1.2-22.04_beta"
Expand Down
2 changes: 1 addition & 1 deletion oci/mock-rock/contacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ notify:
- fbdezwkcxpfofpysjore1wpfoc

maintainers:
- cjdc
- cjdcordeiro
- clay-lake
- linostar
- rebornplusplus
Expand Down

0 comments on commit 04b5f00

Please sign in to comment.