Skip to content

Publish Docker on the daily schedule, and move layer cache off the Actions quota - #10429

Merged
danielhanchen merged 1 commit into
mainfrom
docker-publish-daily-and-registry-cache
Sep 7, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
docker-publish-daily-and-registry-cache

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The repo is over its Actions cache budget: active_caches_size_in_bytes reports 55.5GB across 146 caches against a 50GB limit. Two changes to one workflow, both aimed at that.

1. Publish on the schedule, not on every merge

on.push.branches was [main] with no paths: filter, so every merge built both images for two architectures and pushed them:

day total runs breakdown
2026-09-06 24 push=23, schedule=1
2026-09-05 15 push=14, schedule=1
2026-09-07 10 push=10

The scheduled run was 1 in 24. The cron already fires at 17 18 * * *, which the existing comment notes is 11:17 in San Francisco under PDT, so that becomes the cadence for main.

Tag pushes still publish immediately. A release sitting without an image until the next morning would be worse than the spend, so tags: ['v*'] is untouched. Say the word if you want tags on the schedule too.

Dropping the main push trigger takes this workflow out of the scan in tests/studio/test_main_runs_survive_merge_bursts.py, which selects on push.branches containing main (_runs_on_main_push, line 134), so it needs no entry in QUOTA_BOUND. The per-sha concurrency key is kept, since a scheduled run can still overlap a workflow_dispatch, and its comment now describes that rather than merge bursts.

2. Move the layer cache off the Actions quota

cache-to on the base build was type=gha,scope=build-...,mode=max. mode=max exports every intermediate layer, and with several runs in flight at once it produced:

  • 127 buildkit-blob-1-sha256:* entries, 32.07GB, 61% of the entire repo cache
  • all created on one morning, 09:21 to 10:39, all on refs/heads/main
  • largest single blobs 6.74GB, 6.29GB, 5.50GB

That budget is shared with caches that are far more expensive to rebuild: 4.94GB for a gemma-4-E4B GGUF, 3.51GB for gemma-4-E2B on macOS, 12.98GB of model weights across 6 entries. Self-renewing buildkit churn permanently occupying 61% of a 50GB budget means LRU eventually evicts the multi-GB HF downloads to make room for layers that a rebuild would regenerate anyway.

Switching to type=registry puts the cache on a tag in the image's own Docker Hub repo, which has no such budget, so mode=max is kept and rebuild speed is unchanged. Both jobs already run docker/login-action before building, which covers reading and writing the cache ref.

There is a note worth preserving here: the Studio build at line 444 already used mode=min, with the comment mode=max here would blow the 10GB GHA quota and evict the base build's cache. That diagnosis was correct, it was just applied to the smaller of the two images while the base build kept mode=max. This PR resolves that asymmetry by removing the constraint rather than by degrading the base build.

The Studio build stays at mode=min. Its stated reason no longer applies, but the remaining cost is Hub storage rather than a hard budget, so raising it is a separate decision from moving the transport.

Safety

The buildcache-core-* and buildcache-studio-* tags are not touched by the cleanup job. It drops this run's core-build-<run_id> and build-<run_id> handles, and on schedule prunes nightly pins matched by an explicit nightly-YYYY.MM.DD / core-nightly-YYYY.MM.DD glob. Neither matches.

Checks

  • scripts/lint_workflow_triggers.py: OK: scanned 45 workflow file(s)
  • tests/python/test_docker_publish_tag_scheme.py, test_docker_hub_readme.py, test_docker_publish_ref_freeze.py: 49 passed
  • tests/studio/test_main_runs_survive_merge_bursts.py: 8 passed

Not included

This does not delete the 32GB already in the cache. That is an Actions write and needs a credential with actions: write; happy to follow up, though GitHub will also evict it by LRU once the inflow stops.

…tions quota

Two changes to one workflow, both aimed at the same symptom: the repo sat at
51.71GB of a 50GB Actions cache.

Publish on the schedule, not on every merge. on.push.branches was [main] with no
paths filter, so every merge built both images for two architectures and pushed
them. That was 23 runs on 2026-09-06 and 14 on 2026-09-05, against one scheduled
run each day. The cron already fires at 18:17 UTC, which is 11:17 in San
Francisco under PDT, so that becomes the cadence for main. Tag pushes still
publish immediately: a release with no image until the next morning would be
worse than the spend.

Dropping the main push trigger takes this workflow out of the scan in
tests/studio/test_main_runs_survive_merge_bursts.py, which selects on
push.branches containing main, so it needs no exemption there. The per-sha
concurrency key is kept, since a scheduled run can still overlap a dispatch, and
its comment now describes that rather than merge bursts.

Move the layer cache to the registry. cache-to on the base build was
type=gha,mode=max. mode=max exports every intermediate layer, and with several
concurrent runs it wrote 127 blob entries totalling 32GB in one morning, 61% of
the repo's cache, starving the GGUF model and pip caches that share the budget.
A cache tag on the image's own Docker Hub repo has no such budget, so mode=max
keeps its rebuild speed with no eviction pressure. Both jobs already log in to
Docker Hub before building, which covers reading and writing the cache ref.

The Studio build stays at mode=min. Its comment blamed the GHA quota, which no
longer applies, but the remaining cost is Hub storage rather than a hard budget,
so raising it is a separate decision from moving the transport.

The buildcache-* tags are not touched by the cleanup job: it drops this run's
core-build-/build-<run_id> handles and, on schedule, nightly pins matched by an
explicit nightly-YYYY.MM.DD glob.

lint_workflow_triggers.py clean; 49 docker-publish tests and the merge-burst
suite pass.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-07T10:59:56.813360Z b58d184 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen
danielhanchen merged commit 583191a into main Sep 7, 2026
7 of 8 checks passed
@danielhanchen
danielhanchen deleted the docker-publish-daily-and-registry-cache branch September 7, 2026 10:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b58d184dc0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# moment a newer one is queued), so the earlier one would publish no image at all.
# Merges no longer trigger this workflow, so the burst it now guards against is a
# scheduled run overlapping a workflow_dispatch, rather than a merge burst. Keeping
# the per-sha key costs nothing and still prevents a dispatch being discarded.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Give each main publication its own concurrency key

The retained group is keyed by github.sha, not by the run, so a scheduled run and a workflow_dispatch on main normally have the same group whenever no commit lands between them. GitHub cancels an existing pending run when a newer run enters that group; therefore an overlapping manual dispatch can discard the scheduled run. Now that main pushes no longer publish, this can skip the only stable-image publication for that day. Include an event- or run-specific component for these main runs rather than relying on the SHA.

Useful? React with 👍 / 👎.

on:
push:
branches: [main]
# Deliberately NOT branches: [main]. Publishing on every merge meant 23 runs on

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Update the documented stable-tag cadence

After removing the main-branch push trigger, docker/DOCKERHUB.md:16 still tells users that latest and core move with every push to main. This file is automatically copied to the public Docker Hub page by the workflow, so users may expect a just-merged fix to be available immediately even though the tags now move only during the daily run. Update the published description to state the new daily cadence.

Useful? React with 👍 / 👎.

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