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

.github: Skip unnecessary workflow steps #16157

Merged
merged 5 commits into from May 20, 2021

Conversation

pchaigno
Copy link
Member

@pchaigno pchaigno commented May 14, 2021

We increasingly rely on GitHub actions to run tests on pull requests and branches, including long end-to-end tests and per-commit builds. We are however limited to 20 concurrent workflow jobs, with excess jobs being queued. This recently led to issues where long waiting queues can delay releases and pull requests.

This pull request proposes to use the dorny/paths-filter GitHub action to filter unnecessary workflow steps and jobs. This will in particular allow us to skip unnecessary tests when the documentation or the BPF code are not touched by a pull request. It also enables skipping GitHub-based end-to-end tests when only ginkgo-based tests are touched.

For most workflows changed by this pull request, the effect can be seen in the pull request's action. However, workflows triggered by issue comments run the workflow version from master. To allow you to see this in action for such workflows, I have merged this pull request in my fork and created three test cases:

I'm happy to create more test cases if needed.

@pchaigno pchaigno added area/CI-improvement Topic or proposal to improve the Continuous Integration workflow release-note/ci This PR makes changes to the CI. labels May 14, 2021
@pchaigno pchaigno force-pushed the skip-unecessary-workflow-steps branch 12 times, most recently from 905f108 to 80824e0 Compare May 17, 2021 21:48
@pchaigno pchaigno force-pushed the skip-unecessary-workflow-steps branch from 80824e0 to 3e56cc4 Compare May 18, 2021 09:45
@@ -19,11 +19,42 @@ env:
check_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

jobs:
check_changes:
name: Deduce required tests from code changes
Copy link
Member Author

Choose a reason for hiding this comment

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

For reviewers: This job could also be integrated into installation-and-connectivity to reduce the number of different jobs displayed for each pull request. The downside of that approach is that the job would not be clearly marked as skipped (since only a subset of steps would be skipped).

@pchaigno pchaigno marked this pull request as ready for review May 18, 2021 10:20
@pchaigno pchaigno requested review from a team as code owners May 18, 2021 10:20
@pchaigno pchaigno requested review from nbusseneau and aanm May 18, 2021 10:20
@maintainer-s-little-helper maintainer-s-little-helper bot assigned nbusseneau and aanm and unassigned aanm May 18, 2021
Copy link
Member

@aanm aanm left a comment

Choose a reason for hiding this comment

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

please pin a commit of dorny/paths-filter@v2

@pchaigno pchaigno force-pushed the skip-unecessary-workflow-steps branch from 3e56cc4 to bd52cdc Compare May 18, 2021 17:29
@pchaigno pchaigno requested a review from aanm May 18, 2021 21:27
@pchaigno pchaigno force-pushed the skip-unecessary-workflow-steps branch from 69499d6 to 9981ad9 Compare May 19, 2021 17:05
Copy link
Member

@nbusseneau nbusseneau left a comment

Choose a reason for hiding this comment

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

Nice job, I had this in my list as well but I only thought about doing it at the workflow-level (see my comment below), not at the job or steps-level.

I actually wonder if it might be worth to refactor/split some of the actions here in independent workflows so that we take advantage of the native workflow-level filtering, which is more efficient than the dorny/paths-filter one.

.github/workflows/docs.yaml Outdated Show resolved Hide resolved
If a pull request doesn't touch the bpf/ directory, we don't need to
check that the datapath compiles for every commit.

Signed-off-by: Paul Chaignon <paul@cilium.io>
The coccinelle and build checks are unnecessary when files under bpf/
and contrib/coccinelle/ are untouched. We still need to run checkpatch
because it actually verifies all commits and not only code touching
bpf/.

Signed-off-by: Paul Chaignon <paul@cilium.io>
We don't need to run documentation tests if the documentation is
untouched.

Signed-off-by: Paul Chaignon <paul@cilium.io>
We don't need to run the smoke tests if only Documentation/ or test/ are
touched. We therefore skip them in such case.

Obviously, we could extend this beyond these two directories, but the
goal here is to keep the list simple while catching the most common
cases.

Signed-off-by: Paul Chaignon <paul@cilium.io>
We don't need to run the ci-xxx end-to-end tests if only Documentation/
or test/ are touched. We therefore skip them in case of the trigger
phrase 'test-me-please'. If these tests are explicitly requested via the
'ci-xxx' trigger phrase, we run them.

Obviously, we could extend this beyond these two directories, but the
goal here is to keep the list simple while catching the most common
cases.

Signed-off-by: Paul Chaignon <paul@cilium.io>
@pchaigno pchaigno force-pushed the skip-unecessary-workflow-steps branch from 9981ad9 to 6b98ab5 Compare May 20, 2021 10:12
@pchaigno pchaigno requested a review from nbusseneau May 20, 2021 10:51
Copy link
Member

@nbusseneau nbusseneau left a comment

Choose a reason for hiding this comment

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

Thanks :)

@pchaigno pchaigno added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 20, 2021
@aanm aanm merged commit 50df544 into cilium:master May 20, 2021
@pchaigno pchaigno deleted the skip-unecessary-workflow-steps branch May 20, 2021 14:05
pchaigno added a commit to pchaigno/cilium that referenced this pull request Jun 9, 2021
In its initial version, commit 3ceb742 (".github: Skip unnecessary docs
test") skipped the job instead of the whole workflow, based on changed
code paths. After discussion on the pull request [1], we figured we
could save some seconds by skipping the whole workflow instead of the
job. Skipping the job requires adding a new job to check the code paths.

However, if we skip the whole workflow, the job status is never reported
on GitHub. Since the documentation job is required to merge, that means
maintainer's little helper will never mark the pull request as ready to
merge.

Thus, this commit reverts back to skipping the jobs instead of the whole
workflows. To that end, we use paths-filter GitHub Action instead of the
direct GitHub integration (since the GitHub path filters can only skip
the whole workflow).

1 - cilium#16157 (comment)
Signed-off-by: Paul Chaignon <paul@cilium.io>
aanm pushed a commit that referenced this pull request Jun 10, 2021
In its initial version, commit 3ceb742 (".github: Skip unnecessary docs
test") skipped the job instead of the whole workflow, based on changed
code paths. After discussion on the pull request [1], we figured we
could save some seconds by skipping the whole workflow instead of the
job. Skipping the job requires adding a new job to check the code paths.

However, if we skip the whole workflow, the job status is never reported
on GitHub. Since the documentation job is required to merge, that means
maintainer's little helper will never mark the pull request as ready to
merge.

Thus, this commit reverts back to skipping the jobs instead of the whole
workflows. To that end, we use paths-filter GitHub Action instead of the
direct GitHub integration (since the GitHub path filters can only skip
the whole workflow).

1 - #16157 (comment)
Signed-off-by: Paul Chaignon <paul@cilium.io>
nathanjsweet pushed a commit that referenced this pull request Jun 16, 2021
[ upstream commit b08f700 ]

In its initial version, commit 3ceb742 (".github: Skip unnecessary docs
test") skipped the job instead of the whole workflow, based on changed
code paths. After discussion on the pull request [1], we figured we
could save some seconds by skipping the whole workflow instead of the
job. Skipping the job requires adding a new job to check the code paths.

However, if we skip the whole workflow, the job status is never reported
on GitHub. Since the documentation job is required to merge, that means
maintainer's little helper will never mark the pull request as ready to
merge.

Thus, this commit reverts back to skipping the jobs instead of the whole
workflows. To that end, we use paths-filter GitHub Action instead of the
direct GitHub integration (since the GitHub path filters can only skip
the whole workflow).

1 - #16157 (comment)
Signed-off-by: Paul Chaignon <paul@cilium.io>
Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
christarazi pushed a commit that referenced this pull request Jun 22, 2021
[ upstream commit b08f700 ]

In its initial version, commit 3ceb742 (".github: Skip unnecessary docs
test") skipped the job instead of the whole workflow, based on changed
code paths. After discussion on the pull request [1], we figured we
could save some seconds by skipping the whole workflow instead of the
job. Skipping the job requires adding a new job to check the code paths.

However, if we skip the whole workflow, the job status is never reported
on GitHub. Since the documentation job is required to merge, that means
maintainer's little helper will never mark the pull request as ready to
merge.

Thus, this commit reverts back to skipping the jobs instead of the whole
workflows. To that end, we use paths-filter GitHub Action instead of the
direct GitHub integration (since the GitHub path filters can only skip
the whole workflow).

1 - #16157 (comment)
Signed-off-by: Paul Chaignon <paul@cilium.io>
Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI-improvement Topic or proposal to improve the Continuous Integration workflow ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/ci This PR makes changes to the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants