-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
rapids-check-pr-job-dependencies
script (#30)
This PR adds a new script, `rapids-check-pr-job-dependencies`. This script is intended to be used in a new check job in the `shared-action-workflows` repository. The script checks the `pr-builder` job in the `pr.yaml` workflow file to ensure that it depends on all of the other jobs in the workflow file. This is necessary because our branch protections are configured to depend on the `pr-builder` job, so it's implied that that job will depend on all of the other jobs in the workflow. Depends on rapidsai/ci-imgs#30.
- Loading branch information
1 parent
4664eb1
commit ab18a78
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
# Checks whether a particular GitHub workflow job depends on all of the | ||
# other jobs in the workflow. | ||
# | ||
# This is necessary since the RAPIDS branch protections are configured to require | ||
# the "pr-builder" job to pass for all PRs. It's implied that that job depends | ||
# on all other jobs in the workflow. | ||
set -euo pipefail | ||
|
||
export WORKFLOW_FILE=${WORKFLOW_FILE:-".github/workflows/pr.yaml"} | ||
export PR_BUILDER_JOB_NAME=${PR_BUILDER_JOB_NAME:-"pr-builder"} | ||
|
||
WORKFLOW_JOBS=$(yq '((.jobs | keys | sort) - [env(PR_BUILDER_JOB_NAME)]) | join(" ")' "${WORKFLOW_FILE}") | ||
|
||
PR_BUILDER_JOB_NEEDS=$(yq '(.jobs.[env(PR_BUILDER_JOB_NAME)].needs | sort) | join(" ")' "${WORKFLOW_FILE}") | ||
|
||
if [ "${WORKFLOW_JOBS}" != "${PR_BUILDER_JOB_NEEDS}" ]; then | ||
echo "'${PR_BUILDER_JOB_NAME}' is missing a dependency." | ||
echo "Update '${WORKFLOW_FILE}' to include all other jobs for '${PR_BUILDER_JOB_NAME}'" | ||
echo "" | ||
echo "Workflow jobs: ${WORKFLOW_JOBS}" | ||
echo "'${PR_BUILDER_JOB_NAME}' job dependencies: ${PR_BUILDER_JOB_NEEDS}" | ||
exit 1 | ||
fi | ||
|
||
echo "${PR_BUILDER_JOB_NAME} depends on all other jobs." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters