feat: reintroduce docusaurus caching to CI #4436
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Resolves #4418, by adding a local GitHub action that basically does what we ripped out in #4417 due to the target action being removed from the internet.
For reference, the original caching was introduced in #4025.
This PR adds the caching step to these workflows:
It does not add it to publish-prod....yet. I'd like to see it merged and running against staging first, to make sure it doesn't mess up prod builds.
Some details about how the caching works
This PR also modifies
build-docs
workflow to trigger only onpull_request
.This is done to allow sharing of the cache between the
build-docs
andpreview-env-deploy
. A build triggered bypush
does not run in the samegithub_workspace
as a build triggered onpull_request
-- see this screenshot of caches:Those are the same PR. The top one is from
preview-env-deploy
running on apull_request
trigger; the bottom one is frombuild-docs
running on apush
trigger. (Yes, the issue/PR numbers are different in the two caches, but that's because the top one shows the PR number, and the bottom one shows the branch name, which includes the issue number.)Removing the
push
trigger frombuild-docs
, and forcing it to run onpull_request
in all cases, results in the workspace/cache being shared across the workflows. This has two positive effects: (1) a better chance that a build will benefit from a cache, and (2) fewer caches, thus longer duration of each cache before it gets evicted due to lack of space.Can we remove the
push
trigger?I tracked down two conversations in Slack where I've asked publicly if people are using the
push
trigger to watch CI before they open a PR: https://camunda.slack.com/archives/C01H4NG9XDY/p1654292859796899?thread_ts=1654292843.207019&cid=C01H4NG9XDY and https://camunda.slack.com/archives/C026U8GBNSW/p1675695601973339.In neither case did a single person say "I rely on the
push
trigger, by pushing up a branch before opening a PR."This trigger was skipping
main
, so direct-commits tomain
(which shouldn't be done) weren't relying on this workflow to tell us when the build broke in that occasion, either.Thus, I think we can remove this trigger, and if anyone complains, nudge them to open PRs if they want to run builds.
Experiments
You can see the workflow executions from my experimentation here and here. Note the build times decrease by 4-10 minutes on executions that are able to take advantage of the cache.
When should this change go live?
hold
label or convert to draft PR)PR Checklist
/versioned_docs
directory./docs
directory (aka/next/
).My changes require an Engineering review, and I've assigned the Engineering DRI or delegate.
My changes require a technical writer review, and I've assigned @camunda/tech-writers as a reviewer.
My changes require a docs infrastructure review.