diff --git a/go.mod b/go.mod index 55f41952b..621375857 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( //github.com/argoproj/gitops-engine v0.7.1-0.20231013183858-f15cf615b814 github.com/aws/aws-sdk-go v1.44.285 // indirect github.com/caarlos0/env v3.5.0+incompatible - github.com/devtron-labs/common-lib v0.0.18-0.20240521074504-7e820e02e560 + github.com/devtron-labs/common-lib v0.0.18-0.20240523053623-d628084f54ba github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/evanphx/json-patch v5.7.0+incompatible github.com/go-pg/pg v6.15.1+incompatible diff --git a/go.sum b/go.sum index 89b0c2140..a3dea3ccd 100644 --- a/go.sum +++ b/go.sum @@ -716,8 +716,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/devtron-labs/authenticator v0.4.31 h1:CEMLek3JnMuH9ULsC6BHNJr+NiyGzBd4lgdSxH2IGnc= github.com/devtron-labs/authenticator v0.4.31/go.mod h1:ozNfT8WcruiSgnUbyp48WVfc41++W6xYXhKFp67lNTU= -github.com/devtron-labs/common-lib v0.0.18-0.20240521074504-7e820e02e560 h1:/ZICR7ZuymTfDNjvURuFoqKlA+95YMZQx7+Ha67h5iM= -github.com/devtron-labs/common-lib v0.0.18-0.20240521074504-7e820e02e560/go.mod h1:UgYkD75M0rsC4UBPBnUE87H0JIZ7n3P+u5yXsWIkoi0= +github.com/devtron-labs/common-lib v0.0.18-0.20240523053623-d628084f54ba h1:ml8OxkqCnjkOSGGfpG3bEIGamaUDjoyvtLJfoEkP5+8= +github.com/devtron-labs/common-lib v0.0.18-0.20240523053623-d628084f54ba/go.mod h1:UgYkD75M0rsC4UBPBnUE87H0JIZ7n3P+u5yXsWIkoi0= github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aBfCb7iqHmDEIp6fBvC/hQUddQfg+3qdYjwzaiP9Hnc= github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2/go.mod h1:WHNsWjnIn2V1LYOrME7e8KxSeKunYHsxEm4am0BUtcI= github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY= diff --git a/vendor/github.com/devtron-labs/common-lib/helmLib/registry/common.go b/vendor/github.com/devtron-labs/common-lib/helmLib/registry/common.go index 51baffc0f..ba32bdc08 100644 --- a/vendor/github.com/devtron-labs/common-lib/helmLib/registry/common.go +++ b/vendor/github.com/devtron-labs/common-lib/helmLib/registry/common.go @@ -19,28 +19,28 @@ import ( "strings" ) -func OCIRegistryLogin(client *registry.Client, config *Configuration) error { +func GetLoggedInClient(client *registry.Client, config *Configuration) (*registry.Client, error) { username, pwd, err := extractCredentialsForRegistry(config) if err != nil { - return err + return nil, err } config.Username = username config.Password = pwd loginOptions, err := getLoginOptions(config) if err != nil { - return err + return nil, err } err = client.Login(config.RegistryUrl, loginOptions..., ) if err != nil { - return err + return nil, err } - return nil + return client, nil } func CreateCertificateFile(registryName, caString string) (certificatePath string, err error) { @@ -73,6 +73,15 @@ func CreateCertificateFile(registryName, caString string) (certificatePath strin return certificateFilePath, nil } +func DeleteCertificateFolder(filePath string) error { + folder := strings.TrimRight(filePath, "/ca.crt") + err := os.RemoveAll(folder) + if err != nil { + return err + } + return nil +} + func extractCredentialsForRegistry(config *Configuration) (string, string, error) { username := config.Username pwd := config.Password diff --git a/vendor/github.com/devtron-labs/common-lib/helmLib/registry/defaultSettings.go b/vendor/github.com/devtron-labs/common-lib/helmLib/registry/defaultSettings.go index e2de52713..0054c8c46 100644 --- a/vendor/github.com/devtron-labs/common-lib/helmLib/registry/defaultSettings.go +++ b/vendor/github.com/devtron-labs/common-lib/helmLib/registry/defaultSettings.go @@ -62,7 +62,7 @@ func (s *DefaultSettingsGetterImpl) getRegistryClient(config *Configuration) (*r } if config != nil && !config.IsPublicRegistry { - err = OCIRegistryLogin(registryClient, config) + registryClient, err = GetLoggedInClient(registryClient, config) if err != nil { return nil, err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 2653edd5a..44c276849 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -137,7 +137,7 @@ github.com/davecgh/go-spew/spew github.com/devtron-labs/authenticator/client github.com/devtron-labs/authenticator/jwt github.com/devtron-labs/authenticator/oidc -# github.com/devtron-labs/common-lib v0.0.18-0.20240521074504-7e820e02e560 +# github.com/devtron-labs/common-lib v0.0.18-0.20240523053623-d628084f54ba ## explicit; go 1.21 github.com/devtron-labs/common-lib/constants github.com/devtron-labs/common-lib/helmLib/registry