podman auth: share one authfile via same-shell exports
The two preceding reverts remove fixes built on wrong assumptions:
-
aae7f2fd 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.
- The ceph-dev-pipeline fix (#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>