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

Allow jobs to be ignored in rapids-check-pr-job-dependencies #106

Merged
merged 3 commits into from
May 3, 2024

Conversation

ajschmidt8
Copy link
Member

@ajschmidt8 ajschmidt8 commented May 3, 2024

The rapids-check-pr-job-dependencies script is responsible for ensuring that the pr-builder job used by RAPIDS depends on all other jobs in the pr.yaml workflow. This is important because the pr-builder job is the only job that RAPIDS requires to pass before merging.

Previously, there was no way to ignore certain jobs from this check. This made it difficult to add optional jobs to the pr.yaml workflow.

This PR addresses that issue by allowing the rapids-check-pr-job-dependencies script to accept a positional argument of space-delimited job names that should be ignored.

The argument can be used like this:

rapids-check-pr-job-dependencies "job1 job2 job3"

It is intended to be used in our shared workflows like this:

- name: Check workflow file dependencies
  if: ${{ inputs.enable_check_pr_job_dependencies }}
  run: rapids-check-pr-job-dependencies "${IGNORED_JOBS}"
  env:
    IGNORED_JOBS: ${{ inputs.ignored_pr_jobs }}

It can then be used by calling repositories like this:

jobs:
  checks:
    secrets: inherit
    uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.06
    with:
      ignored_pr_jobs: >-
        job1
        job2
        conda-cpp-tests
        conda-python-tests

The `rapids-check-pr-job-dependencies` script is responsible for ensuring that the `pr-builder` job used by RAPIDS depends on all other jobs in the `pr.yaml` workflow. This is important because the `pr-builder` job is the only job that RAPIDS requires to pass before merging.

Previously, there was no way to ignore certain jobs from this check. This made it difficult to add optional jobs to the `pr.yaml` workflow.

This PR addresses that issue by allowing the `rapids-check-pr-job-dependencies` script to accept a positional argument of space-delimited job names that should be ignored.

The argument can be used like this:

```sh
check-pr-builder-depends.sh "job1 job2 job3"
```

It is intended to be used in our shared workflows like this:

```yaml
- name: Check workflow file dependencies
  if: ${{ inputs.enable_check_pr_job_dependencies }}
  run: rapids-check-pr-job-dependencies "${IGNORED_JOBS}"
  env:
    IGNORED_JOBS: ${{ inputs.ignored_jobs }}
```

It can then be used by calling repositories like this:

```yaml
jobs:
  checks:
    secrets: inherit
    uses: rapidsai/shared-workflows/.github/workflows/checks.yaml@branch-24.06
    with:
      ignored_jobs: >-
        job1
	job2
	conda-cpp-tests
	conda-python-tests
```
@ajschmidt8
Copy link
Member Author

These changes can be tested pretty easily by copying any pr.yaml workflow (like this one) onto your local file system in this repository and running the following commands:

./tools/rapids-check-pr-job-dependencies
./tools/rapids-check-pr-job-dependencies "conda-cpp-tests"
./tools/rapids-check-pr-job-dependencies "conda-cpp-tests conda-cpp-build"
./tools/rapids-check-pr-job-dependencies "conda-cpp-tests non-existent-job"

@jameslamb jameslamb self-requested a review May 3, 2024 18:45
Copy link
Member

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, super clear and easy to follow. Thank you!

I left 2 related comments about making this less sensitive to extraneous whitespace. Do what you want with them.

tools/rapids-check-pr-job-dependencies Outdated Show resolved Hide resolved
tools/rapids-check-pr-job-dependencies Outdated Show resolved Hide resolved
@ajschmidt8 ajschmidt8 merged commit b86b530 into rapidsai:main May 3, 2024
1 check passed
@ajschmidt8 ajschmidt8 deleted the allow-ignored-jobs branch May 3, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants