From e74582fcd50a763f5084fddecefefdddf5fad6c6 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 21 Apr 2026 18:32:48 +0200 Subject: [PATCH] remove CONTAINERS_REGISTRIES_CONF parsing code The recent registries.conf rework made so the backend already reads the env var. As such clients should no longer set it directly to simplify the code here. Signed-off-by: Paul Holzinger --- cmd/podman/common/completion.go | 5 +---- cmd/podman/common/registries.go | 24 ------------------------ cmd/podman/login.go | 1 - cmd/podman/logout.go | 1 - 4 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 cmd/podman/common/registries.go diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go index e0173cd972..b9d3b26566 100644 --- a/cmd/podman/common/completion.go +++ b/cmd/podman/common/completion.go @@ -20,7 +20,6 @@ import ( "go.podman.io/common/pkg/config" "go.podman.io/common/pkg/ssh" "go.podman.io/image/v5/pkg/sysregistriesv2" - imageTypes "go.podman.io/image/v5/types" "go.podman.io/podman/v6/cmd/podman/registry" "go.podman.io/podman/v6/libpod/define" "go.podman.io/podman/v6/libpod/events" @@ -317,9 +316,7 @@ func getSecrets(cmd *cobra.Command, toComplete string, cType completeType) ([]st } func getRegistries() ([]string, cobra.ShellCompDirective) { - sysCtx := &imageTypes.SystemContext{} - SetRegistriesConfPath(sysCtx) - regs, err := sysregistriesv2.UnqualifiedSearchRegistries(sysCtx) + regs, err := sysregistriesv2.UnqualifiedSearchRegistries(nil) if err != nil { cobra.CompErrorln(err.Error()) return nil, cobra.ShellCompDirectiveNoFileComp diff --git a/cmd/podman/common/registries.go b/cmd/podman/common/registries.go deleted file mode 100644 index df70100c68..0000000000 --- a/cmd/podman/common/registries.go +++ /dev/null @@ -1,24 +0,0 @@ -package common - -import ( - "os" - - "go.podman.io/image/v5/types" -) - -// SetRegistriesConfPath sets the registries.conf path for the specified context. -// NOTE: this is a verbatim copy from c/common/libimage which we're not using -// to prevent leaking c/storage into this file. Maybe this should go into c/image? -func SetRegistriesConfPath(systemContext *types.SystemContext) { - if systemContext.SystemRegistriesConfPath != "" { - return - } - if envOverride, ok := os.LookupEnv("CONTAINERS_REGISTRIES_CONF"); ok { - systemContext.SystemRegistriesConfPath = envOverride - return - } - if envOverride, ok := os.LookupEnv("REGISTRIES_CONFIG_PATH"); ok { - systemContext.SystemRegistriesConfPath = envOverride - return - } -} diff --git a/cmd/podman/login.go b/cmd/podman/login.go index 670efdda9c..cd20c7ba57 100644 --- a/cmd/podman/login.go +++ b/cmd/podman/login.go @@ -104,7 +104,6 @@ func login(cmd *cobra.Command, args []string) error { DockerInsecureSkipTLSVerify: skipTLS, BaseTLSConfig: baseTLSConfig.TLSConfig(), } - common.SetRegistriesConfPath(sysCtx) loginOptions.GetLoginSet = cmd.Flag("get-login").Changed return auth.Login(context.Background(), sysCtx, &loginOptions.LoginOptions, args) } diff --git a/cmd/podman/logout.go b/cmd/podman/logout.go index f74a1437b9..9760f815a2 100644 --- a/cmd/podman/logout.go +++ b/cmd/podman/logout.go @@ -57,6 +57,5 @@ func logout(_ *cobra.Command, args []string) error { sysCtx := &types.SystemContext{ BaseTLSConfig: baseTLSConfig.TLSConfig(), } - common.SetRegistriesConfPath(sysCtx) return auth.Logout(sysCtx, &logoutOptions, args) }