Skip to content

feat: the build cache follows the instance profile - #40

Merged
charlielye merged 1 commit into
mainfrom
cl/cache-bucket-by-group
Nov 27, 2026
Merged

charlielye merged 1 commit into
mainfrom
cl/cache-bucket-by-group

Conversation

@charlielye

Copy link
Copy Markdown
Contributor

Each instance profile can write only its own trust level's cache (aztec-labs-eng/iac#87). Until now, each repository also had to pick the matching bucket, in code of its own: aztec-packages in bootstrap.sh and ci3_labels_to_env.sh, aztec-node in source_release_target and private-release.yml. ci3 now derives the bucket from the profile.

CI3_INSTANCE_PROFILE_NAME cache_bucket
unset (local runs, GitHub runners), ci3-build-instance-profile aztec-ci-artifacts
ci3-release-build-instance-profile aztec-ci-release-cache
ci3-private-build-instance-profile, ci3-private-release-build-instance-profile aztec-ci-private-cache

CI3_CACHE_BUCKET (source_cache_bucket <bucket>) still overrides the default. A job with no instance profile needs it, such as aztec-packages' publish job, which reads the release bundle from the release cache on a GitHub runner.

bootstrap_ec2 passes the runner's cache_bucket to the instance, because the instance doesn't get CI3_INSTANCE_PROFILE_NAME. With a private cache, the instance runs source_cache_bucket's reachability check straight after ci3/source, so a run with the wrong profile fails at once instead of after a build that cached nothing.

Testing

  • tests/instance_group_test checks cache_bucket for each profile, for no profile, and for an explicit override. It failed for the three non-shared profiles before the change.
  • tests/cache_bucket_test (LocalStack): with no profile, the bucket is still the shared cache.
  • ssm_send_command_test, refname_test, redact_test and cache_local_test pass.

The repositories' own bucket selection is removed in AztecProtocol/aztec-packages#25907 and a follow-up to aztec-labs-eng/aztec-node#790.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L

Each instance profile can write only its own trust level's cache, so
cache_bucket now derives the bucket from CI3_INSTANCE_PROFILE_NAME instead
of each repository picking it: the shared cache for build instances and
local runs, the release cache for release instances, the private cache
for private ones. CI3_CACHE_BUCKET (source_cache_bucket) still overrides
it, for a job with no instance profile such as a release's publish job.

bootstrap_ec2 passes the runner's bucket to the instance, which has no
CI3_INSTANCE_PROFILE_NAME, and fails at once there if a private cache is
not reachable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L
@charlielye
charlielye merged commit 1de230d into main Nov 27, 2026
1 check passed
charlielye added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 27, 2026
…#25907)

Pins ci3 to aztec-labs-eng/ci3#40, on top of aztec-labs-eng/ci3#39.
Together they give each trust level its own build cache and instance
group. The shared cache, `aztec-ci-artifacts`, can be written by any CI
build, including pull requests that nobody has reviewed, and its build
cache is public. Until now, releases built from it, and the private
fork's CI wrote to it.

ci3 now picks the cache from the instance profile, so this repository
doesn't choose a bucket anywhere except the publish job:

| Build | Instance profile | Cache |
|---|---|---|
| PRs, `next`, merge queues | `ci3-build-instance-profile` |
`aztec-ci-artifacts` |
| Releases (tags, master environment) |
`ci3-release-build-instance-profile` | `aztec-ci-release-cache`, which
only release instances can write |
| AztecProtocol/aztec-packages-private, CI and releases |
`ci3-private-build-instance-profile` | `aztec-ci-private-cache`, which
nothing public can read or write |

**Changes**
- **Publish:** `bootstrap.sh publish` reads the release bundle from the
release cache. It runs on a GitHub runner, in ci3.yml's publish job with
the master environment's release role, so it names the bucket itself:
there's no instance profile to take it from.
- **Private fork:** it no longer uploads benches, which would need a
bench box its instances can't launch. Its logs go to
`aztec-ci-artifacts/logs` with every other log, which only the dashboard
serves.
- **What reaches the build container:** ci3 now forwards only its own
settings, so `ci.sh` lists the rest:
- `CI3_PASS_ENV`: `GCP_PROJECT_ID`, `NETLIFY_*`,
`AZTEC_TOOLCHAIN_DEFAULT_MAJOR_VERSION`, `CHONK_INPUTS_STATE_DIR`;
  - `CI3_PASS_FILES`: `GOOGLE_APPLICATION_CREDENTIALS`.
- **Chonk inputs:** `download_pinned_chonk_inputs` checks the tarball
against the pin, its sha256 prefix, before extracting it. `protocol/`
was writable by anyone until recently and is still writable by every PR
build.

**Testing**
- The chonk check was tested red/green by hand (a tampered tarball
served under the pinned name was extracted before the change and refused
after it), and the real pinned inputs still download.
- **Not run in PR CI:** the release and publish paths, which need the
release role and a tag. The next nightly exercises them.

**Needs setting in AztecProtocol/aztec-packages-private:** the secret
`CI3_INSTANCE_PROFILE_NAME=ci3-private-build-instance-profile`. Without
it, the fork's runner role can't launch instances at all.

A `v…-private…` tag in this repo, which builds the private fork's source
on a public release instance, still runs with `NO_CACHE_UPLOAD=1`, so
its bundle never reaches the publish job. That was already true before
this PR and isn't changed here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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