podman auth: export REGISTRY_AUTH_FILE in every podman-invoking shell - #2668
Open
djgalloway wants to merge 1 commit into
Open
podman auth: export REGISTRY_AUTH_FILE in every podman-invoking shell#2668djgalloway wants to merge 1 commit into
djgalloway wants to merge 1 commit into
Conversation
djgalloway
force-pushed
the
podman-auth-same-shell
branch
from
July 28, 2026 21:24
a2a69ee to
d67f8bc
Compare
idryomov
reviewed
Jul 31, 2026
idryomov
left a comment
Contributor
There was a problem hiding this comment.
I'd suggest squashing the reverts as a good chunk of their diff is immediately re-added in the "podman auth: share one authfile via same-shell exports" commit.
| def ceph_builder_tag_short = "${env.BRANCH}.${env.DIST}.${env.ARCH}.${env.FLAVOR}" | ||
| def ceph_builder_tag = "${env.SHA1[0..6]}.${ceph_builder_tag_short}" | ||
| sh """#!/bin/bash -ex | ||
| export REGISTRY_AUTH_FILE="\${HOME}/.config/containers/auth.json" |
Contributor
There was a problem hiding this comment.
Is there a significance to not expanding $HOME here and other places below (except in bwc.sh)?
Contributor
Author
There was a problem hiding this comment.
If I'm understanding your question correctly, the \ is Groovy escaping, not a shell thing
Contributor
There was a problem hiding this comment.
Ah, I didn't notice that the sh block above is ''' while this one and the ones below are """ which necessitates escaping.
This reverts the two previous attempts at fixing the Docker Hub rate-limit failures -- commit aae7f2f ("bwc: pin podman auth to a persistent authfile") and PR #2656 (merge f199616, the ceph-dev-pipeline equivalent) -- and replaces both. They were built on wrong assumptions: - aae7f2f blamed logind tearing down the XDG runtime dir between steps. An auditd watch on /run/user/<uid>/containers/ disproved that: nothing external ever touches auth.json there; every write is podman login's own atomic tmp+rename. Linger is enabled and the agent runs as a systemd service with no login sessions, so the directory is stable across the whole job. - PR #2656 added --authfile to the logins plus a Groovy env.REGISTRY_AUTH_FILE assignment. Tracker 77920 recurred on 2026-07-22 with it deployed: login wrote docker.io credentials to $HOME/.config/containers/auth.json, and the FROM docker.io/ubuntu:22.04 pull inside podman build (spawned by build-with-container.py) still ran anonymous and hit toomanyrequests. A debug run on a builder pinned the real mechanism. With the variable present in podman build's environment, the base image pull uses it: $ REGISTRY_AUTH_FILE=$HOME/.config/containers/auth.json \ podman build --pull --log-level=debug ... 2>&1 | grep -i cred "Found credentials for docker.io/library/ubuntu ... in file /home/jenkins-build/.config/containers/auth.json" So the pull authenticates whenever REGISTRY_AUTH_FILE actually reaches the process, which means on 2026-07-22 it did not. That dictates the shape of this change: - No --authfile on logins: pointing only the login at a file steers credentials somewhere later pulls never look, which is worse than the podman default. - No Groovy env threading: it demonstrably failed to deliver the variable to the bwc subprocess, and it silently depends on stage ordering and when{} guards. - Instead, every sh block that invokes podman or build-with-container.py exports REGISTRY_AUTH_FILE itself. A same-shell export reaches podman through ordinary process inheritance and cannot be lost. podman login honors the variable for writes, so login and every later read use the same persistent file by construction. The export line is repeated verbatim in each block on purpose: each block is self-sufficient and the pattern is greppable. Fixes: https://tracker.ceph.com/issues/77920 Signed-off-by: David Galloway <david.galloway@ibm.com>
djgalloway
force-pushed
the
podman-auth-same-shell
branch
from
July 31, 2026 20:17
d67f8bc to
ebb51dd
Compare
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.
What
Three commits:
--authfilelogins + Groovyenv.REGISTRY_AUTH_FILE)--authfile)bwc_login— exportsREGISTRY_AUTH_FILE="$HOME/.config/containers/auth.json"itself. Plainpodman login, no flags.Why
https://tracker.ceph.com/issues/77920 recurred on 2026-07-22 with #2656 deployed: login wrote docker.io creds to
$HOME/.config/containers/auth.json, and theFROM docker.io/ubuntu:22.04pull insidepodman build(spawned by build-with-container.py) still pulled anonymously →toomanyrequests.Debug run on a builder pinned it:
podman build's base-image pull honorsREGISTRY_AUTH_FILEwhen it's actually in the process environment — so on 2026-07-22 it wasn't. Hence:--authfileon the login alone is worse than nothing: it steers credentials into a file later pulls never consult.exportreaches podman by plain process inheritance and can't be silently dropped.podman loginhonors it for writes, so login and all later reads use the same persistent file by construction. Repeated verbatim per block on purpose: self-sufficient and greppable.Also retracts aae7f2f's logind-teardown rationale: a week of auditd on
/run/user/<uid>/containers/showed every auth.json write was podman's own atomic tmp+rename, unbroken inode chain, no external deletions.Fixes: https://tracker.ceph.com/issues/77920