Skip to content

fix: declare repo rules reproducible so they can use the repo contents cache - #901

Open
alexander-scott wants to merge 2 commits into
bazel-contrib:mainfrom
alexander-scott:set_reproducible_metadata
Open

fix: declare repo rules reproducible so they can use the repo contents cache#901
alexander-scott wants to merge 2 commits into
bazel-contrib:mainfrom
alexander-scott:set_reproducible_metadata

Conversation

@alexander-scott

@alexander-scott alexander-scott commented Jul 30, 2026

Copy link
Copy Markdown

Repo rules whose outputs are fully determined by their attributes must return repository_ctx.repo_metadata(reproducible = True), otherwise Bazel refuses to store them in the repo contents cache - local (--repo_contents_cache) or remote (--experimental_remote_repo_contents_cache).

None of the repo rules in rules_oci did this, so every one of them was re-fetched from scratch in each fresh output base, and none could be shared remotely.

All the toolchain rules (crane, regctl, cosign, toolchains_repo) are unconditionally reproducible: they either download an artifact pinned by an integrity hash, or template files purely from their attributes.

oci_pull and oci_alias are reproducible only when pulling by digest. With a tag the registry may move it to different content between fetches, so they stay uncached in that case.

Repo rules whose outputs are fully determined by their attributes must
return `repository_ctx.repo_metadata(reproducible = True)`, otherwise
Bazel refuses to store them in the repo contents cache - local
(`--repo_contents_cache`) or remote
(`--experimental_remote_repo_contents_cache`).

None of the repo rules in rules_oci did this, so every one of them was
re-fetched from scratch in each fresh output base, and none could be
shared remotely.

All the toolchain rules (crane, regctl, cosign, toolchains_repo) are
unconditionally reproducible: they either download an artifact pinned by
an integrity hash, or template files purely from their attributes.

`oci_pull` and `oci_alias` are reproducible only when pulling by digest.
With a tag the registry may move it to different content between
fetches, so they stay uncached in that case.
@alexander-scott alexander-scott changed the title Declare repo rules reproducible so they can use the repo contents cache fix: declare repo rules reproducible so they can use the repo contents cache Jul 30, 2026
@alexander-scott
alexander-scott marked this pull request as ready for review July 30, 2026 06:54

@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: a215a05996

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread oci/private/pull.bzl Outdated
Only mark sha256 digests as reproducible
@alexander-scott

Copy link
Copy Markdown
Author

@thesayyn Hey if you have a minute, could you give some feedback to this change?

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