Repository navigation
feat: support any OCI registry - #87
Conversation
The intermediate registry of builds comes from endpoints.builds.intermediate_registery_format, if set, otherwise from INTERMEDIATE_REGISTRY_HOST (Docker Hub by default) and INTERMEDIATE_REGISTRY_NAMESPACE. Images whose name has a registry host or no namespace are built under their last name part; before, a host broke the build. Credentials for Docker Hub are stored under Docker's key for it. Publishing prebuilt images of any registry is tested. Co-Authored-By: Claude Opus 5.5 <[email protected]>
builds.registry sets the host and namespace of the intermediate registry, and optionally a Secret and key with its credentials. The docs describe registries, and that signing still publishes to Docker Hub. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings: unless the intermediate path has a tag, a build pushes to and the signing pulls from the tag build-<build ID>, so that builds of images with the same name no longer replace each other's image. The chart keeps the registry defaults if builds.registry is null and quotes Secret names and keys. The configuration and docs name the environment variables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bump Pubgrade-Sidecar to the merge of its PR 42, whose docs describe registries, and link to them. Clarify the intermediate image example. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideImplementationDefine the intermediate image path and registry credential lookup, then use them consistently when creating builds, writing Docker credentials, and triggering signing.
ConfigurationExpose the intermediate registry host, namespace, and credentials through Helm values and pass them to Pubgrade when builds are enabled.
Document the environment variables and precedence used to choose the intermediate registry path.
DocumentationExplain registry support, intermediate registry configuration, Docker Hub signing limits, and the upgrade considerations for running builds.
TestsVerify Helm renders the default and custom intermediate registry settings, including the null-values fallback.
Cover prebuilt images with registry-qualified names and the intermediate-image path, authentication, and build-to-signing consistency.
Lock files and vendored codeUpdate the Pubgrade-Sidecar submodule to include its registry availability-check and documentation changes.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="pubgrade/modules/endpoints/builds.py" line_range="131-132" />
<code_context>
+ The image in the intermediate registry, with its tag.
+ """
+ path = intermediate_registry_format().format(image_basename(image))
+ if ":" not in path.rsplit("/", 1)[-1]:
+ path = f"{path}:build-{build_id}"
+ return path
+
</code_context>
<issue_to_address>
**Victim builds can sign attacker images**
When the configured intermediate format includes a fixed tag and callers for different repositories can choose the same image basename, an authorized caller can build an image with the same basename as another repository and overwrite that shared intermediate reference; `build_completed` recomputes the same reference and the signing workflow can sign the caller’s image as the other repository’s output.
Scope every intermediate reference to its build (or repository) even when the configured format includes a tag, and retain any required expiry semantics separately.
</issue_to_address>
### Comment 2
<location path="pubgrade/modules/endpoints/builds.py" line_range="853" />
<code_context>
- data["images"][0]["name"].split("/")[1].split(":")[0]
- ),
+ pull_tag=intermediate_image(data["images"][0]["name"], build_id),
push_tag=data["images"][0]["name"],
)
except Exception:
</code_context>
<issue_to_address>
**Non-Docker-Hub builds fail publication**
When builds are enabled and the requested final image name uses a non-Docker-Hub registry host, `build_completed` passes the requested image name as `push_tag`, while `trigger_signing_image` supplies only Docker Hub credentials; for a name such as `harbor.example.org/project/app:1`, the signing workflow cannot authenticate to that destination, so publication fails and the build does not complete successfully.
Either make the signing workflow authenticate to the requested destination registry, or ensure build-mode requests publish to a Docker Hub image name and document that constraint.
</issue_to_address>
### Comment 3
<location path="pubgrade/modules/endpoints/builds.py" line_range="745" />
<code_context>
- )
with open(config_file_location, "w") as config_file:
- config_file.write(template_config_file)
+ json.dump({"auths": {registry: {"auth": token}}}, config_file)
</code_context>
<issue_to_address>
**Registry writer docs name Docker Hub**
`create_dockerhub_config_file` now writes credentials for whichever intermediate registry is configured, but its docstring still describes a Docker Hub config file and Docker Hub token; callers reading the API documentation are misled about the file’s purpose.
Update the docstring to describe the intermediate registry credentials and clarify that the `dockerhub_token` parameter is unused here.
</issue_to_address>Linked issues
#27 Make Pubgrade Harbor Compatible · 1 of 1 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Make Pubgrade Harbor compatible | ✅ Met | Prebuilt image names are forwarded unchanged, and builds can use a configurable intermediate registry; sidecar rollout support is included through the submodule update. |
#41 feat: roll out images from any OCI registry · 0 of 5 met · 5 to check by hand
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Check image availability through the OCI distribution API, including Docker Hub and anonymous bearer-token challenges | 👀 Check by hand (manual process) | Inspect the updated sidecar submodule revision to confirm it implements the OCI API and bearer-token handling. |
| 2 | Allow optional private-registry credentials from a Kubernetes Secret configured through chart values | 👀 Check by hand (manual process) | Inspect the updated sidecar submodule revision to confirm its Secret and chart-values support. |
| 3 | Keep Docker Hub as the default for images without a registry host | 👀 Check by hand (manual process) | Inspect the updated sidecar submodule revision to confirm its fallback for unqualified image names. |
| 4 | Add API unit tests and a CI test against a generic OCI registry | 👀 Check by hand (manual process) | Check the updated sidecar submodule revision and its CI configuration for the requested tests. |
| 5 | Document the API, deployment values, and upgrade considerations | 👀 Check by hand (manual process) | Inspect the updated sidecar submodule documentation to confirm it covers the API, values, and upgrade note. |
Sourcery assessment
Needs a human reviewer. 2 findings to address first, and if the registry path or credentials resolve incorrectly, a build can push to an unintended location or the signing workflow can pull the wrong intermediate image and publish it under the requested Docker Hub name. Reverting stops future builds, but cannot retract images already pushed to either registry.
Blocking findings: pubgrade/modules/endpoints/builds.py:132, pubgrade/modules/endpoints/builds.py:853
Address review findings: with a tag in the intermediate path (e.g., a lifetime on ttl.sh), the image name gets a suffix derived from the build ID, so that builds of other repositories can't replace an image before it is signed. Docs: build mode needs Docker Hub image names, as the signing workflow publishes to Docker Hub only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Linked issues
#27 Make Pubgrade Harbor Compatible · 0 of 1 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Make Pubgrade compatible with Harbor and other OCI registries. | 🟡 Partly met | Prebuilt images retain their registry host, and builds can push to a configurable intermediate OCI registry, but the signing workflow still publishes built images to Docker Hub only. |
#41 feat: roll out images from any OCI registry · 5 of 5 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Check image availability through the OCI distribution API, including anonymous bearer-token challenges. | ✅ Met | The sidecar submodule is updated to the merge of PR 42, which closed this issue. |
| 2 | Support optional private-registry credentials from a Kubernetes Secret. | ✅ Met | Implemented in the sidecar update to PR 42. |
| 3 | Keep Docker Hub as the default for images without a registry host. | ✅ Met | Implemented in the sidecar update to PR 42. |
| 4 | Add API tests and a CI test against a generic OCI registry. | ✅ Met | The sidecar submodule is updated to PR 42, which closed this issue. |
| 5 | Document the API, deployment values, and upgrade considerations. | ✅ Met | The deployment guide links to the sidecar's Registries documentation; the sidecar submodule is updated to PR 42. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #87 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 1497 1518 +21
=========================================
+ Hits 1497 1518 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Makes Pubgrade work with any OCI registry, such as Harbor. This is part A of #27; part B, the sidecar's availability check, was elixir-cloud-aai/Pubgrade-Sidecar#42, which closed elixir-cloud-aai/Pubgrade-Sidecar#41.
harbor.example.org/project/app, orregistry:8443/group/sub/app) are passed on to subscribers unchanged. New integration tests cover this.builds.registry.host(defaultdocker.io) andbuilds.registry.namespace, viaINTERMEDIATE_REGISTRY_HOSTandINTERMEDIATE_REGISTRY_NAMESPACE.builds.registry.existingSecret/key; by default this is the keyintermediate_registry_tokenofbuilds.existingSecret, as before.endpoints.builds.intermediate_registery_formatstill works and takes precedence.name.split("/")[1]). They now build under their last name part.build-<build ID>; if the configured path has its own tag (e.g. ttl.sh's lifetime), the name gets a suffix derived from the build ID instead. Builds of images with the same name, including builds of other repositories, therefore no longer overwrite each other before signing.https://index.docker.io/v1/. Before, they were stored underdocker.io, which Kaniko doesn't look up.json.dump.docs/deployment.mdhas a new section "Registries" and an upgrade note.pubgrade/config.yamlcomment,helm/values.yaml.Closes #27
Verification
pytest --cov(unit + integration, mongomock): 625 passed, 100% coverage.tests/chart.sh(Helm 3.22.1): passed. New checks cover the registry defaults, custom values, andbuilds.registry=null.ruff check,ruff format --check,mypy: clean.mkdocs build --strict: clean.CI on 31092a6 (after merging dev): all checks passed, including Chart, Upgrade test, Docs and the image scans. There are no open code scanning alerts. Two CI fix iterations were needed: mypy narrowing in a new test, and a gitleaks allow marker on the base64 test token, following the repo's existing convention.
Not run locally: build mode end to end (Kaniko, the signing workflow on GitHub). It needs a cluster with
ReadWriteManystorage and the signing secrets. The unit tests check that the build and the signing use the same intermediate image.Review: round 1 with the adversarial and quality reviewer subagents. Fixed:
builds.registry: null(medium).In round 2 neither reviewer found medium or high issues. Added afterwards: a note to let running builds finish before an upgrade or a registry change, because the signing works out the intermediate image again when a build completes.
Sourcery: 3 findings, addressed in 0699880. Intermediate images with a fixed tag are now scoped to their build; the Docker Hub-only publication in build mode is documented (the signing workflow is outside this repository); the docstring is fixed. All threads are answered and resolved.
Declined review findings
Fail the chart if the Docker Hub default is used without a namespace: deployments that set
intermediate_registery_formatin their configuration keep the chart defaults and would break on upgrade. The docs say that Docker Hub needs a namespace.Store the intermediate path on the build record, so that an upgrade or registry change during a build doesn't affect it: this is rare (a
helm upgradewhile builds run), it was the same before with the config setting, and the upgrade note now says to let builds finish first.Rename
create_dockerhub_config_fileand drop its unuseddockerhub_tokenparameter, and fail early ifINTERMEDIATE_REGISTRY_TOKENis unset: both are older than this change and outside its scope.grep-based checks intests/chart.sh: they follow the existing style of the script.Add a correctly spelled alias for
intermediate_registery_format: a separate change.Validate
INTERMEDIATE_REGISTRY_HOST, and limitid_lengthso that build tags stay within 128 characters: these are operator settings, and the defaults are fine.Open questions
None.
🤖 Generated with Claude Code