Skip to content

Commit

Permalink
CI: add job name validation
Browse files Browse the repository at this point in the history
[ upstream commit 3f5e735 ]

This commit adds validation for `commit_status_start` job.
This job is used in workflows that is triggered by Ariane to set the run status to pending.
Ariane is going to depend on this job being existed and its name is "Commit Status Start".
Also, the trigger syntax of `link-build-commits.yaml` is changed because `yq` is throwing an error.

Signed-off-by: Birol Bilgin <birol@cilium.io>
Signed-off-by: Gilberto Bertin <jibi@cilium.io>
  • Loading branch information
brlbil authored and jibi committed May 14, 2024
1 parent eb21b0b commit 8d3a1d6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/lint-build-commits.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Build Commits

# Any change in triggers needs to be reflected in the concurrency group.
on: [pull_request]
on:
pull_request: {}

permissions: read-all

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/lint-workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,27 @@ jobs:
fi
done
exit ${EXIT}
- name: Validate Commit Status Start Job
shell: bash
run: |
EXIT=0
cd src/github.com/cilium/cilium/.github/workflows
for FILE in *.yaml; do
# we only care about workflows that has ariane workflow_dispatch events
IS_ARIANE_DISPATCH=$(yq '.on.workflow_dispatch.inputs.PR-number' $FILE)
if [ "$IS_ARIANE_DISPATCH" == "null" ]; then
continue
fi
JOB=$(yq '.jobs | to_entries | .[] | select(.key == "commit-status-start")' $FILE)
if [ "$JOB" == "" ]; then
echo "commit-status-start job is missing in file $FILE"
EXIT=1
fi
JOB_NAME=$(echo "${JOB}" | yq '.value.name')
if [ "$JOB_NAME" != "Commit Status Start" ]; then
echo "commit-status-start job name must be set as 'Commit Status Start' in file $FILE"
EXIT=1
fi
done
exit ${EXIT}

0 comments on commit 8d3a1d6

Please sign in to comment.