Skip to content

ci: skip running builds and tests if no code changed #8768

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aThorp96
Copy link
Contributor

@aThorp96 aThorp96 commented May 14, 2025

Changes

Skip running builds and tests on pull requests if the pull request only changes documentation. From what I can tell, there are no e2e tests in use right now triggered by the Tekton Integration workflow which analyze the markdown docs files except the codegen test which checks to ensure the Pipeline api file was updated, however that should only be updated if the pipelines api is changed in the code. The tests themselves take some time. Also, while the Workflows may be free for compute since they're on GHA, they are still unnecessary and if the e2e tests use any ancillary services which have cost (maybe caching, coverage, image hosting, etc) unnecessary runs at least have the potential of incurring cost.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label May 14, 2025
@tekton-robot tekton-robot requested review from dibyom and vdemeester May 14, 2025 07:15
@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 14, 2025
@aThorp96
Copy link
Contributor Author

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label May 14, 2025
@aThorp96
Copy link
Contributor Author

Note that the tests will still run on this PR since Github Actions only applies the rules from workflows as defined in the target branch.

on: [pull_request] # yamllint disable-line rule:truthy
on:
pull_request:
paths-ignore:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Documentation for the paths-ignore configuration is here

Copy link
Member

Choose a reason for hiding this comment

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

this is a good start I think

on:
pull_request:
paths-ignore:
- 'docs/**' # If the PR only modifies the documentation, there is no need to run builds and code tests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another option here which which would reduce the runs even more would be to instead use '**.md, since that would include things like README.md or roadmap.md. However I am not sure if that is too liberal a policy. There are a number of other markdown files in the repo for which changes may warrant running tests for reasons I am not privy to.

$ find . -name '*md' | rg -v ./vendor | rg -v ./docs
./.github/ISSUE_TEMPLATE/feature-request.md
./.github/ISSUE_TEMPLATE/free-form.md
./.github/ISSUE_TEMPLATE/promotion-request.md
./.github/ISSUE_TEMPLATE/bug-report.md
./.github/pull_request_template.md
./cmd
./cmd/entrypoint/README.md
./cmd/nop/README.md
./code-of-conduct.md
./examples/README.md
./hack/README.md
./tekton/README.md
./tekton/release-cheat-sheet.md
./test/custom-task-ctrls/wait-task-beta/README.md
./test/custom-task-ctrls/wait-task-beta/cmd
./test/resolver-with-timeout/README.md
./test/README.md
./topical-ownership.md
./CONTRIBUTING.md
./api_compatibility_policy.md
./roadmap.md
./DEVELOPMENT.md
./README.md
./releases.md

Copy link
Member

Choose a reason for hiding this comment

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

I think **md should be ok but depends on if any of the tests are testing the md files as you mentioned. Once we know that for sure we can use **md. +1 for the current defensive approach.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

So I think we have some checks on the docs (like deadlink) or we used to.
Out of curiosity, can we skip some jobs instead ? Worst case, we could have a "docs" workflow with the opposite filter.

@aThorp96
Copy link
Contributor Author

Yeah if there are docs CI tests we can use a separate filter. Do you know where the docs tests are found or called? I didn't see any inside this file, and outside of verify-codegen it looked like all the tests were unit tests

on: [pull_request] # yamllint disable-line rule:truthy
on:
pull_request:
paths-ignore:
Copy link
Member

Choose a reason for hiding this comment

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

this is a good start I think

on:
pull_request:
paths-ignore:
- 'docs/**' # If the PR only modifies the documentation, there is no need to run builds and code tests
Copy link
Member

Choose a reason for hiding this comment

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

I think **md should be ok but depends on if any of the tests are testing the md files as you mentioned. Once we know that for sure we can use **md. +1 for the current defensive approach.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2025
@vdemeester
Copy link
Member

/approve
/cc @AlanGreene @afrittoli

@tekton-robot
Copy link
Collaborator

@vdemeester: GitHub didn't allow me to request PR reviews from the following users: AlanGreene.

Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/approve
/cc @AlanGreene @afrittoli

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/test-infra repository.

@tekton-robot tekton-robot requested a review from afrittoli May 21, 2025 15:46
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester, waveywaves

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [vdemeester,waveywaves]

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. release-note-none Denotes a PR that doesnt merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants