Skip to content

CLDSRV-955: Cache cloudserver builder yarn/tsc layer with a BuildKit mount#6229

Draft
tcarmet wants to merge 1 commit into
development/9.3from
improvement/CLDSRV-955/docker-yarn-cache-mount
Draft

CLDSRV-955: Cache cloudserver builder yarn/tsc layer with a BuildKit mount#6229
tcarmet wants to merge 1 commit into
development/9.3from
improvement/CLDSRV-955/docker-yarn-cache-mount

Conversation

@tcarmet

@tcarmet tcarmet commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Speeds up the cloudserver image build by making the expensive dependency-install work reusable across CI runs. Most of that image's build time is the builder stage installing the git dependencies and compiling their TypeScript; today the image layer cache is all-or-nothing and is thrown away whenever the lockfile changes. A BuildKit cache mount keeps the downloaded and already-compiled packages so a build reuses them even on a layer-cache miss, and the mount is persisted between runs. This is a follow-up experiment under CLDSRV-955 aimed at the build-time floor that the job-parallelization work (#6228) can't reach.

How it works

  • Dockerfile: the builder's yarn install gets a --mount=type=cache on yarn's cache folder (which also holds the compiled git deps), so a warm cache skips the re-clone and re-tsc.
  • Workflow: the mount lives in the BuildKit builder, not the image layers, so it is saved/restored across runs via buildkit-cache-dance backed by actions/cache (keyed on the lockfile hash).

Validation

Draft until CI shows the effect: compare the cloudserver image build time on a warm run against a development/9.3 build. Keeping it draft so we can confirm the mount is actually restored (look for the yarn install reusing cached git deps) before calling it a win.

…Kit mount

The cloudserver production image spends most of its build time in the
builder stage running `yarn install --production`, which clones the git
dependencies and compiles their TypeScript (arsenal's tsc, etc.). The
image layer cache is all-or-nothing and misses whenever yarn.lock changes.

Add a BuildKit cache mount on yarn's cache folder so those downloaded and
compiled packages are reused even on a layer-cache miss, and persist the
mount across CI runs with buildkit-cache-dance backed by actions/cache.
@bert-e

bert-e commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Hello tcarmet,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

The Fix Version/s in issue CLDSRV-955 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.3.14

  • 9.4.0

Please check the Fix Version/s of CLDSRV-955, or the target
branch of this pull request.

uses: actions/cache@v4
with:
path: docker-yarn-cache
key: ${{ runner.os }}-docker-yarn-cache-${{ hashFiles('yarn.lock') }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The cache key is hashFiles('yarn.lock') with no restore-keys, so when yarn.lock changes — the exact scenario the PR targets — the cache misses completely and yarn starts from scratch. Add a restore-keys prefix so a stale cache is reused on lockfile changes:

Suggested change
key: ${{ runner.os }}-docker-yarn-cache-${{ hashFiles('yarn.lock') }}
key: ${{ runner.os }}-docker-yarn-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-docker-yarn-cache-

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.

2 participants