Skip to content

Commit 426bee8

Browse files
feat: add required cache-key input, native GC, and server-driven config for v2 (#108)
* feat: add required cache-key input for v2 Replace the hardcoded GITHUB_REPO_NAME sticky disk key with a required cache-key input. Users must explicitly declare which cache entity their build targets, preventing cache thrashing in multi-target repos. The cache-key is saved to action state and passed through to the commit phase so the same key is used for both expose and commit RPCs. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat: replace manual pruning with buildkit native gc Remove max-cache-size-mb input and manual buildctl prune from the post phase. Enable BuildKit's native garbage collection with a time-based policy (keepDuration=192h / 8 days). Layers unused for longer than the retention period are automatically cleaned up; active layers survive indefinitely regardless of total cache size. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * feat: add server-driven config infrastructure for GC and pre-commit hooks Add BuildkitdConfig and PreCommitHook interfaces (server-config.ts) that define the contract for server-driven cache lifecycle management. The action reads BuildkitdConfig from the GetStickyDisk RPC response (with hardcoded fallback for Phase 1) and runs pre-commit hooks from the PrepareCommit RPC response before committing. Refactor writeBuildkitdTomlFile to accept a BuildkitdConfig parameter instead of hardcoding GC policy values. This makes it trivial to switch from hardcoded defaults to server-provided config when the proto is updated (Phase 2). Add runPreCommitHooks dispatcher that executes an ordered list of opaque shell commands with timeout and failure mode handling. The commit flow now goes through prepareCommit -> runHooks -> conditionalCommit, with Phase 1 returning unconditional commit + empty hooks. Phase 1 (now): hardcoded gc=true, keepDuration=192h, no hooks Phase 2: server returns BuildkitdConfig in GetStickyDiskResponse Phase 3: server returns hooks via PrepareCommit RPC Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore: remove unused rollup build artifacts Remove rollup.config.js and rollup devDependencies (@rollup/plugin-node-resolve, @rollup/plugin-typescript, rollup). The repo switched to ncc for bundling in commit 2ffcb3d; rollup artifacts were never cleaned up. The dist/main.bundle.mjs file was already deleted in a prior commit. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent ab5c1da commit 426bee8

12 files changed

Lines changed: 175 additions & 1134 deletions

action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ branding:
55
icon: layers
66
color: black
77
inputs:
8+
cache-key:
9+
description: >-
10+
Unique identifier for this build's Docker layer cache. Builds with the
11+
same cache-key share cached layers across runs. Set this to the Dockerfile
12+
being built (e.g., services/api/Dockerfile). Jobs building different
13+
Dockerfiles should use different cache-keys to avoid cache thrashing.
14+
required: true
815
buildx-version:
916
description: Buildx version. (e.g., v0.23.0, latest)
1017
required: false
@@ -32,9 +39,6 @@ inputs:
3239
max-parallelism:
3340
description: "Maximum number of concurrent BuildKit RUN steps. Defaults to the number of vCPUs on the runner."
3441
required: false
35-
max-cache-size-mb:
36-
description: "Amount of build cache to retain after pruning, in MB (e.g., 409600 for 400GB). If not set, pruning is skipped."
37-
required: false
3842
runs:
3943
using: node24
4044
main: dist/index.js

dist/index.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)