From 7bf22037ef1f27f46c70d19858d5235f3bb5b278 Mon Sep 17 00:00:00 2001 From: Roman Hros Date: Tue, 3 Sep 2024 11:01:40 +0200 Subject: [PATCH] Do not require credentials for the OCI client Signed-off-by: Roman Hros --- pkg/assetsclient/oci/credentials.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/pkg/assetsclient/oci/credentials.go b/pkg/assetsclient/oci/credentials.go index 74edecd95..9c7d84e8a 100644 --- a/pkg/assetsclient/oci/credentials.go +++ b/pkg/assetsclient/oci/credentials.go @@ -55,22 +55,14 @@ func newOCIConfig() (ociConfig, error) { config.repository = val val = os.Getenv(envOCIAccessToken) - if val != "" { - base64AccessToken := base64.StdEncoding.EncodeToString([]byte(val)) - config.accessToken = base64AccessToken - } else { - val = os.Getenv(envOCIUsername) - if val == "" { - return ociConfig{}, fmt.Errorf("environment variable %s is not set", envOCIUsername) - } - config.username = val + base64AccessToken := base64.StdEncoding.EncodeToString([]byte(val)) + config.accessToken = base64AccessToken - val = os.Getenv(envOCIPassword) - if val == "" { - return ociConfig{}, fmt.Errorf("environment variable %s is not set", envOCIPassword) - } - config.password = val - } + val = os.Getenv(envOCIUsername) + config.username = val + + val = os.Getenv(envOCIPassword) + config.password = val return config, nil }