Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ~/.config podman path in default keychain #2052

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bduffany
Copy link

@bduffany bduffany commented Jan 31, 2025

According to podman's auth docs:

Default is ${XDG_RUNTIME_DIR}/containers/auth.json on Linux, and $HOME/.config/containers/auth.json on Windows/macOS.

The current default keychain supports the $XDG_RUNTIME_DIR path but not the $HOME/.config path. This PR fixes that.

Note: podman's behavior is actually a little more subtle than what these docs suggest:

  • The $HOME/.config/containers path is actually supported on all platforms, not just Windows/macOS. The $HOME/.config part of the path is actually computed as $XDG_CONFIG_HOME if it is defined, even on non-linux platforms - though, that env var is typically only set on Linux. If that env var is unset, it defaults to $HOME/.config. The logic for that is here.
  • The $XDG_RUNTIME_DIR path is indeed Linux-only, though, and takes precedence over the ~/.config path. The logic for this precedence is here, and the relevant code from getPathToAuth is here.

bduffany added a commit to buildbuddy-io/buildbuddy that referenced this pull request Feb 3, 2025
The ECR credential helper stopped working for one of our on-prem users
after they switched from podman to OCI. This is because `oci.Resolve()`
doesn't respect credential helpers.

This PR enables the default keychain in `oci.Resolve()` (behind a flag)
so that credential helpers will work. The default keychain respects
commonly used container auth config files, including
`.docker/config.json` and podman's
`$XDG_RUNTIME_DIR/containers/auth.json`.

The customer was specifically trying to use
`~/.config/containers/auth.json` which doesn't quite work after this PR,
but will work if we either patch
google/go-containerregistry#2052 or if the
customer switches to `~/.docker/config.json` instead (that file is
generally the least common denominator and is supported by docker,
podman, and now oci after this PR).

The plan is to either enable this new flag by default (but make sure
it's disabled for our cloud executors), or just enable it in the helm
charts.
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