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

Cherrypick ci improvements to 2.13.x #16065

Merged

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Jul 5, 2022

Cherrypicks the recent changes to the CI script generator, so that docs-only changes
that are cherry-picked to 2.13 don't force a full CI there.

benjyw added 3 commits July 5, 2022 09:42
- Refactor out the per-platform job generation.
- Ensure names are properly platform-qualified.
- Add a "Merge OK" job that depends on all the other jobs,
  so that branch protection only needs to know about that one,
  instead of an ever changing list of job names.
- Inject the dep on check_labels automatically, and only
  in PR jobs (cron-triggered jobs don't need this).
A new job detects whether the change is "docs only", and all the other jobs
run only if "docs only" is false.

The complication is that we have a branch protection rule on main that prevents
merges unless a CI job named "Merge OK" passes. Today that job depends on all
the other jobs (running tests etc.) and if we skip those jobs, the "Merge OK" job
will not run and so we won't be able to merge.

Therefore we generate two "Merge OK" jobs: one that depends on all the checks but
runs only if "docs only" is false, and another that runs with no other dependencies, but
only if "docs only" is true.

Note that we cannot implement this using GitHub Action's path filtering, because that
provides only "run a workflow if any path is under a dir" or "skip a workflow if all paths
are under a dir". It does not provide "run a workflow if all paths are under a dir",
which is what we'd need for the "Merge OK" logic above.
…build#16053)

The previous solution involved some complexity in extracting the filenames
from JSON, and was not robust to spaces in path names (we do have such
paths under docs/).

Instead we use a different GHA marketplace action. This one is more featureful, and
allows us to specify a subset of files to look at, so we don't need to do the filtering
ourselves. We can just check if the filtered set (everything except docs/**)
has any changes in it.
@benjyw benjyw added the category:internal CI, fixes for not-yet-released features, etc. label Jul 5, 2022
@benjyw benjyw requested a review from Eric-Arellano July 5, 2022 16:44
@benjyw
Copy link
Contributor Author

benjyw commented Jul 5, 2022

It would be harder to do the same for 2.12 as that is further behind. But we are unlikely to apply many docs changes to 2.12 at this point, whereas 2.13 is going to be the active docs version for a while.

@benjyw benjyw merged commit 9ecfb1b into pantsbuild:2.13.x Jul 5, 2022
@benjyw benjyw deleted the cherrypick_ci_improvements_to_2.13.x branch July 5, 2022 19:02
@stuhood stuhood mentioned this pull request Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants