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

install diff-filter-buildkite-plugin to only build when relevant files changed #400

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

fatteneder
Copy link
Member

@fatteneder fatteneder commented Nov 2, 2024

Fixes #243

This adds a filter that skips (most of the) build and test steps in the CI pipeline if a PR only changed files that are irrelevant for Julia's functionality.
In particular, changes to any of these files won't trigger a build (glob patterns as seen from the root of the Julia repo):

  • "*.md"
  • ".*"
  • "julia.spdx.json"
  • "CITATION.*"
  • "typos.toml"

Note that we always build for x86_64-linux-gnu in order to generate the docs.

The filter can be disabled on a PR basis by adding a label with the name ci-force-build to it.

The addition of more fine grained filters is left for future PRs.

@IanButterworth
Copy link
Member

I believe NEWS.md and HISTORY.md are in the docs, so I think it needs at least the docs to be built for those?

@fatteneder fatteneder force-pushed the fa/diff-filter-build branch 6 times, most recently from 9b18b56 to df7d25c Compare November 2, 2024 18:55
@fatteneder fatteneder force-pushed the fa/diff-filter-build branch 4 times, most recently from 617363c to 014c2cc Compare November 5, 2024 19:46
@fatteneder fatteneder closed this Nov 5, 2024
@fatteneder fatteneder reopened this Nov 5, 2024
@fatteneder fatteneder force-pushed the fa/diff-filter-build branch 4 times, most recently from e12afd6 to 9ccf4d5 Compare November 5, 2024 20:19
@fatteneder
Copy link
Member Author

I think I managed to implement a mechanism to override the filter using Github labels and the github-pr-labels-buildkite-plugin.
If someone could add a label with the name ci-force-build to this PR, then it should build everything again.


I think the basic functionality is now there.
Currently it contains lots of boilerplate code in various places, so I would like to refactor it.

  • Is there a simple way to share the filter definition between all relevant *.yml files?
  • Is it possible to run the diff-filter plugin once before all steps and just export the trigger to the remaining steps?

Copy link
Contributor

@giordano giordano left a comment

Choose a reason for hiding this comment

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

I don't know if this is what the ignore-list is for (it's quite short, so can't tell it's what I'm thinking of), but for changes which involve only any of

shouldn't run any CI here at all. After this, for docs-related changes I think we need probably to build for all platforms but not run any test suites apart from the doctests? Not sure if this is what #400 (comment) was suggesting.

@@ -12,6 +12,25 @@
# and only need to touch the webui configuration when we need to alter
# something about the privileged steps.

common:
- diff-filter-build_plugin: &diff-filter-build
https://github.com/fatteneder/diff-filter-buildkite-plugin#main:
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should be moved to this organisation before merge.

pipelines/main/launch_unsigned_jobs.yml Outdated Show resolved Hide resolved
@DilumAluthge
Copy link
Member

  • manually ignoring the filter for pre-releases and tags,
  • ignore the filter when merging into master.

This can likely be simplified to: apply the filter iff the repo is JuliaLang/julia and it is a PR.

@fatteneder
Copy link
Member Author

After this, for docs-related changes I think we need probably to build for all platforms but not run any test suites apart from the doctests? Not sure if this is what #400 (comment) was suggesting.

Following #400 (comment) we now always build x86_64-linux, and then use that to run deploy_docs.yml, build_pdf_docs.yml and doctest.yml.

@fatteneder
Copy link
Member Author

This can likely be simplified to: apply the filter iff the repo is JuliaLang/julia and it is a PR.

Ok, I did not yet test how the plugin behaves once a PR is merged.

About juliaup and the +pr feature: Not exactly sure how that works, does that just grab any artifact that is cached in buildkite? If so, then with this PR here one can no longer grab a build from a "filtered" CI run, unless one adds the ci-force-build label.

@fatteneder
Copy link
Member Author

I have not permissions on this repo/in this org. Can someone please add the ci-force-build label here for testing?

@fatteneder fatteneder added the ci-force-build Force to run all steps in the CI label Nov 6, 2024
@fatteneder fatteneder closed this Nov 6, 2024
@fatteneder fatteneder reopened this Nov 6, 2024
@DilumAluthge
Copy link
Member

Closing and reopening a PR doesn't retrigger build kite unfortunately. I asked Bill kite Support about that a while back, and they told me that was is the intended behavior.

you'll need to go to the build kite build and click the rebuild button.

@fatteneder fatteneder force-pushed the fa/diff-filter-build branch 3 times, most recently from 0a47f16 to d097c95 Compare November 10, 2024 15:41
@@ -12,6 +12,24 @@
# and only need to touch the webui configuration when we need to alter
# something about the privileged steps.

env:
Copy link
Member Author

@fatteneder fatteneder Nov 11, 2024

Choose a reason for hiding this comment

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

This is only needed as this repo's main branch is called "main" whereas the one of the Julia repo is called "master".

Using a default of DIFF_FILTER_TARGET_BRANCH="" tells the diff-filter-buildkite-plugin to use a PR's merge base as the reference against which changes should be compared (https://github.com/fatteneder/diff-filter-buildkite-plugin/blob/7155804f7ba73a9798b4c4225613ca6a5d7d8c12/hooks/diff-filter-impl#L13-L38).

So if the pipeline run's on forks of Julia's repo, it should do the right thing (although untested) even when PRing against a branch other than master. For PRs against julia-buildkite we always compare against Julia's master by manually setting it in .buildkite/hooks/post-checkout.

@fatteneder
Copy link
Member Author

Ok, now I am happy with the functionality, but I did not manage to reduce the level of code duplication. Happy to hear suggestions on that and other comments.

@DilumAluthge
Copy link
Member

Someone needs to re-sign the signed pipelines:

Pipeline '.buildkite/pipelines/main/launch_upload_jobs.yml' fails treehash signature check! You may need to re-run cryptic/bin/sign_treehashes!

Probably we can wait until all the PR review is done, and then re-sign the signed pipelines. No real need to do it earlier.

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.

Run only a subset of tests on PRs that only modify the manual
4 participants