Skip to content

registry auth fallback bugfix (backport #672)#684

Merged
amartin120 merged 1 commit into
release/2.0from
mergify/bp/release/2.0/pr-672
Jul 21, 2026
Merged

registry auth fallback bugfix (backport #672)#684
amartin120 merged 1 commit into
release/2.0from
mergify/bp/release/2.0/pr-672

Conversation

@mergify

@mergify mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown

Please check below, if the PR fulfills these requirements:

  • Commit(s) and code follow the repositories guidelines.
  • Test(s) have been added or updated to support these change(s).
  • Doc(s) have been added or updated to support these change(s).

Associated Links:

Types of Changes:

  • Bugfix

Proposed Changes:

Fixes registry credential resolution during hauler store copy registry://, add, and sync when running in environments without a $HOME or $DOCKER_CONFIG set. hauler login has a fallback for this but go-containerregistry doesn't inherently look in the fallback location.

  • pkg/content/dockerconfig.go (new): Adds SetDefaultDockerConfig(), which defaults $DOCKER_CONFIG to the same directory hauler login writes to (<home>/.docker) so go-containerregistry's DefaultKeychain can find credentials even when $HOME is unset. Replicates docker/cli's config.Dir()/getHomeDir() resolution — including the /etc/passwd fallback via os/user.Current() — using only the standard library. An explicitly set DOCKER_CONFIG always wins.
  • cmd/hauler/cli/cli.go: Invokes SetDefaultDockerConfig() in the root PersistentPreRun, logging the defaulted path at debug level.
  • pkg/content/registry.go: Stops silently swallowing credential-resolution failures. Registry host parse errors, keychain resolve errors, and authorization read errors now return wrapped errors instead of falling back to anonymous auth; only a genuine Anonymous result yields empty credentials.

Verification/Testing of Changes:

  1. With credentials stored via hauler login <registry> and $HOME unset, run hauler store copy registry://<registry>/... and confirm the push authenticates instead of failing anonymously.
  2. Run with --log-level debug and confirm the defaulted $DOCKER_CONFIG to [...] line appears.
  3. Confirm an explicitly set $DOCKER_CONFIG is left unchanged.

Additional Context:

Small, targeted bugfix. The previous code returned anonymous credentials on any resolution error, masking real auth failures; this makes credential lookup match hauler login's write location and surfaces genuine errors.


This is an automatic backport of pull request #672 done by Mergify.

@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Author

Cherry-pick of 6f5d767 has failed:

On branch mergify/bp/release/2.0/pr-672
Your branch is up to date with 'origin/release/2.0'.

You are currently cherry-picking commit 6f5d767.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   pkg/content/dockerconfig.go
	modified:   pkg/content/registry.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   cmd/hauler/cli/cli.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@github-project-automation github-project-automation Bot moved this to To Triage in Hauler Jul 21, 2026
@mergify mergify Bot mentioned this pull request Jul 21, 2026
3 tasks
Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com>
(cherry picked from commit 6f5d767)
@amartin120
amartin120 force-pushed the mergify/bp/release/2.0/pr-672 branch from 124bd77 to 916b8e9 Compare July 21, 2026 17:00
@amartin120
amartin120 merged commit 13512a3 into release/2.0 Jul 21, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from To Triage to Resolved in Hauler Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Resolved

Development

Successfully merging this pull request may close these issues.

1 participant