Skip to content

feat(build): retain bounded Docker build caches safely - #1209

Merged
Hydralerne merged 3 commits into
mainfrom
feat/bounded-build-cache
Oct 14, 2026
Merged

Hydralerne merged 3 commits into
mainfrom
feat/bounded-build-cache

Conversation

@Hydralerne

@Hydralerne Hydralerne commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Cloud Docker builds discard their BuildKit state after every deployment, so intermediate layers and tool caches cannot be reused. This change retains project-owned cache state while continuing to remove temporary workers after success, failure, and cancellation. Generated builds use package and known compiler cache mounts on supported stock images; custom Dockerfiles and build images retain their existing command and user behavior.

Cache ownership is checked after creation and immediately before deletion. Bootstrap and collection share the physical-host provisioning lock. Attached volumes and durable pending command records protect active or unresolved workers, including lost bootstrap replies. Recovery checks legacy and current worker identities, and build completion requires confirmed command/worker exit before continuing toward cutover. Cache volumes use separate ownership labels from application data and are removed on project deletion without requiring a data-volume wipe.

Managed state has a 5 GiB host retention target, seven-day idle expiry, and LRU collection before/after builds and in the daily sweep, including hosts without projects. BuildKit receives size/free-space GC policies; Docker Engine cache is bounded separately. With a host executor, storage pressure cleans unused cache and refuses a build if insufficient space remains. Active/pinned/rollback images and application volumes are preserved. Generated session filenames no longer invalidate application COPY layers; temporary ignore-file updates are atomic and do not follow repository symlinks.

Yarn's global package archives stay in image layers because Classic and modern Plug'n'Play can require them at runtime. Yarn builds retain layer and supported build-only cache reuse. Collection sizes only idle, unprotected state to avoid walking files an active worker can remove, and project cleanup sizes only its own cache.

Validation: all 16 CI checks passed on 1578155497b22d803411fe995132bf14dd3e7235, including API, database, SDK/CLI, Actions execution, and deployment cutover/rollback suites. The real Docker suite passed cache reuse, CPU/RAM enforcement, active-cache protection, cancellation, prior-image usability after failed builds, and offline runtime tests for Yarn 1.22.22 and Yarn 4.9.2 PnP after the worker stops. Locally, 74 targeted adapter tests, adapter/API typechecks, and the error-boundary audit passed. The PR is ready, clean, and mergeable.

GC limits are retention targets rather than filesystem quotas; active builds and application writes can consume space after a measurement. Tool cache mounts remain mutable during failed builds. Automatic mounts can be disabled per project or installation with OPENSHIP_BUILD_CACHE_MOUNTS=false. Details: docs/build-cache.md.

Refs #1200. This addresses general Docker cache persistence; it does not add Turbo remote-cache configuration or change monorepo installation policy.

@Hydralerne
Hydralerne merged commit 64fd98a into main Oct 14, 2026
16 checks passed
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.

1 participant