images: support configured registry credentials for pulls - #346
Draft
chruffins wants to merge 1 commit into
Draft
Conversation
Image pulls authenticated only through the Docker config keychain (~/.docker/config.json). Add a registries config section with per-host credential providers -- static username/password, AWS ECR short-lived tokens, or explicit docker-config fallback -- composed into a keychain ahead of the Docker config default. The keychain is threaded through the image manager, the public OCI client, and base-image mirroring in builds.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tldr
Image pulls can now authenticate against configured remote registries (static credentials, AWS ECR short-lived tokens, or docker-config fallback) instead of only
~/.docker/config.json— pull-side generalization for ECR/Docker Hub/anything else, no push-path changes.Summary
Today every remote pull (image create, manifest inspection, base-image mirroring for builds) authenticates through
authn.DefaultKeychain, i.e. whatever lives in the Docker config of the user running hypeman. This adds aregistriesconfig section with per-host credential providers, composed into a keychain that is tried before the Docker config default.What changed
lib/registryauth(new): config type + validation, host-glob matching (withdocker.io/index.docker.iocanonicalization),staticprovider,ecrprovider (GetAuthorizationTokenvia aws-sdk-go-v2, tokens cached per region and refreshed 5m before expiry, region parsed from the registry host), andNewKeychainfalling back toauthn.DefaultKeychainfor unmatched hosts — so unconfigured deployments behave exactly as before.lib/images:NewManager/newOCIClient/NewOCIClienttake an optional keychain (nil = Docker config keychain); all remote calls (inspectManifest*,inspectDigestPlatform,pullToOCILayout*,MirrorBaseImagesource pull) use it.lib/builds:Config.PullKeychainfeeds base-image mirroring.cmd/api/config:registriessection + validation at startup; documented inconfig.example.yamlandDEVELOPMENT.md.Test status
lib/registryauth,lib/builds,lib/providers,lib/imageretention,cmd/api/config: pass.lib/imagesandlib/system: passed fully on a fresh run (including real pulls + erofs conversion after installingmkfs.erofslocally); later re-runs of the pull-dependent tests fail with Docker HubTOOMANYREQUESTSbecause this machine pulls anonymously and exhausted the per-IP quota. Cleanmainfails identically in the same state, and CI authenticates to Docker Hub, so this is environmental.Not in this PR