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 <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2026-04-21 18:32:48 +02:00
parent 5504338c36
commit e74582fcd5
No known key found for this signature in database
GPG key ID: EB145DD938A3CAF2
4 changed files with 1 additions and 30 deletions

View file

@ -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

View file

@ -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
}
}

View file

@ -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)
}

View file

@ -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)
}