Skip to content

Conversation

Gautam3994
Copy link

Issue: Proposal: Speed up E2E tests by skipping suites when changes are irrelevant - #5004

Problem

Currently, all E2E tests run even if a PR only modifies documentation (*.md, *.markdown) or YAML (*.yml, *.yaml) files. This results in unnecessary CI resource usage and slower feedback cycles.

Goal

  • Skip all E2E tests if the PR contains only documentation or YAML changes (case-insensitive).
  • Run alpha E2E suites (like alphagenerate and alphaupdate) only if changes are within pkg/cli/alpha/.
  • Keep the decision logic atomic and per-suite, so each E2E suite can decide locally and consistently whether to run — both in CI and local development.

Proposed Solution

  • Introduce a Go helper utility in test/e2e/utils that:
    • Retrieves the changed files list either from CI environment variables or by running git diff.
    • Detects if changes are only docs or YAML files.
    • Checks if changes match any required path prefixes for a given suite.
  • Modify each E2E suite to call this helper in its BeforeSuite hook and Skip itself when appropriate.

This improves CI efficiency by avoiding needless E2E runs, speeding up feedback without sacrificing test coverage.

Copy link

linux-foundation-easycla bot commented Aug 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: Gautam3994 / name: Gautam Kumar (345cc41)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Aug 11, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Gautam3994
Once this PR has been reviewed and has the lgtm label, please assign varshaprasad96 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

Welcome @Gautam3994!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 11, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @Gautam3994. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Aug 11, 2025
@Gautam3994 Gautam3994 force-pushed the ci/skip-e2e-for-docs-and-yaml branch from 724f35d to 7338b6a Compare August 12, 2025 20:12
@camilamacedo86
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 13, 2025
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Thank you a lot for the nice work 🥇

We have an error here to solve see the job: https://prow.k8s.io/view/gs/kubernetes-ci-logs/pr-logs/pull/kubernetes-sigs_kubebuilder/5005/pull-kubebuilder-test/1955569142404747264

make[1]: Leaving directory '/home/prow/go/src/sigs.k8s.io/kubebuilder/docs/book/src/getting-started/testdata/project'
./test/check-license.sh
Checking for license header...
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found
./test/check-license.sh: line 29: file: command not found

@Gautam3994 Gautam3994 force-pushed the ci/skip-e2e-for-docs-and-yaml branch from 7338b6a to c1bb6af Compare August 13, 2025 23:44
@Gautam3994 Gautam3994 force-pushed the ci/skip-e2e-for-docs-and-yaml branch from c1bb6af to 345cc41 Compare August 14, 2025 20:01
@Gautam3994
Copy link
Author

Gautam3994 commented Aug 14, 2025

@camilamacedo86 I noticed the missing file command in the build environment. I realize the guidelines recommend one issue per PR — should I open a separate PR for this fix, or is it okay to include it here since it’s a small change?

@Gautam3994
Copy link
Author

Hi @camilamacedo86 just checking in — would you prefer I open a separate PR for the missing file command fix, or should I keep it in this one?

@Gautam3994
Copy link
Author

@camilamacedo86 just checking in please let me know if anything else is required from my end

@camilamacedo86
Copy link
Member

Hi @Gautam3994

I had no time to review this one properly yet
But you are right we should have another PR to fix the issue with the shell
If you want to do that will be amazing 🚀

we need ensure that this changes will work fine and we will not skip when we should test
Give me a little time to review this one as soon as possible. Thank you a lot !!!

Comment on lines +192 to +193
pattern := `(?i)(^docs/|\.md$|\.markdown$|^\.github/|` +
`(OWNERS|OWNERS_ALIASES|SECURITY_CONTACTS|LICENSE)(\.md)?$|\.ya?ml$)`
Copy link
Contributor

Choose a reason for hiding this comment

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

@Gautam3994 Sometimes we change workflows (which are .yaml files located in the .github dir) that have config that could possibly break the app and we would want to validate that in a full E2E test. Would this logic exclude those files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants