pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

ci: skip running builds and tests if no code changed

Open aThorp96 opened this issue 7 months ago • 6 comments

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

aThorp96 avatar May 14 '25 07:05 aThorp96

/kind misc

aThorp96 avatar May 14 '25 07:05 aThorp96

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.

aThorp96 avatar May 14 '25 07:05 aThorp96

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

aThorp96 avatar May 14 '25 08:05 aThorp96

/approve /cc @AlanGreene @afrittoli

vdemeester avatar May 21 '25 15:05 vdemeester

@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 avatar May 21 '25 15:05 tekton-robot

Hi @aThorp96, let me know if you have any updates on this one. This is a simple one so was hoping to get it merged soon.

waveywaves avatar Aug 19 '25 18:08 waveywaves

@aThorp96 needs a rebase 👼🏼

vdemeester avatar Oct 03 '25 08:10 vdemeester

We can carry this if need be.

vdemeester avatar Oct 03 '25 08:10 vdemeester

I think this will block PRs since the jobs are still required. There's an open GitHub enhancement request related to this: https://github.com/orgs/community/discussions/44490

The common approach is to skip the jobs using if instead, although it requires additional configuration to get the changed files.

Update: GitHub recommended approach: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks

[!WARNING]

If a workflow is skipped due to path filtering, branch filtering or a commit message, then checks associated with that workflow will remain in a "Pending" state. A pull request that requires those checks to be successful will be blocked from merging.

If, however, a job within a workflow is skipped due to a conditional, it will report its status as "Success". For more information, see Using conditions to control job execution.

When a job fails, any jobs that depend on the failed job are skipped and do not report a failure. A pull request that requires the check may not be blocked. To use a required check on a job that depends on other jobs, use the always() conditional expression in addition to needs, see Using jobs in a workflow.

AlanGreene avatar Oct 03 '25 08:10 AlanGreene

The following Tekton test failed:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-go-coverage-df f646f2b5274b60d227c1044882a38877876abc6f link true /test pull-tekton-pipeline-go-coverage-df

tekton-robot avatar Oct 04 '25 19:10 tekton-robot

@aThorp96 can you take @AlanGreene's comment into account ?

vdemeester avatar Oct 06 '25 10:10 vdemeester

@AlanGreene Thanks for catching that. This should be trivial to do with an external action like dorny/paths-filter. I could write a step to do this with shell as well if we don't want to add an external action dependency. Any preference?

aThorp96 avatar Oct 06 '25 11:10 aThorp96

@AlanGreene Thanks for catching that. This should be trivial to do with an external action like dorny/paths-filter. I could write a step to do this with shell as well if we don't want to add an external action dependency. Any preference?

I don't mind the external dependency, however the last commit on https://github.com/dorny/paths-filter was last year, which could be a red flag. Even if the action is in "problem solved" state, it should feature Dependabot updates or so. New PRs seem to have been ignored. Is there any other alternative?

afrittoli avatar Oct 06 '25 14:10 afrittoli

[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

tekton-robot avatar Oct 08 '25 20:10 tekton-robot

Not ready to merge yet. Since I modified non-docs files (esp since I modified the build CI) it should have triggered a build.

aThorp96 avatar Oct 08 '25 23:10 aThorp96

Ah it should have run a yamllint, but nothing more I guess, isn't it ? you changed the CI but to skip the CI.. Ah right, we should not skip a build if only the workflow are modified though, indeed.

/hold

vdemeester avatar Oct 09 '25 07:10 vdemeester

@vdemeester @afrittoli This appears to be working as expected now.

aThorp96 avatar Oct 09 '25 13:10 aThorp96

/retest

afrittoli avatar Oct 14 '25 08:10 afrittoli

/retest

aThorp96 avatar Nov 03 '25 21:11 aThorp96

/retest

waveywaves avatar Nov 04 '25 08:11 waveywaves

/retest

afrittoli avatar Nov 04 '25 09:11 afrittoli

/hold cancel

vdemeester avatar Nov 04 '25 10:11 vdemeester