Compare commits

...

5 Commits

Author SHA1 Message Date
Ompragash Viswanathan 14819cdab1 Update kaniko-acr main.go 2025-03-06 19:55:50 +05:30
Ompragash Viswanathan 45d785e25a Update kaniko-acr main.go 2025-03-06 19:43:53 +05:30
Ompragash Viswanathan 1b4ce3ce68 Update kaniko-acr main.go 2025-03-06 12:58:16 +05:30
Ompragash Viswanathan f818bdd781 Update kaniko-acr main.go 2025-03-06 12:41:07 +05:30
Ompragash Viswanathan 2e40bf66ff Support pull with creds when no-push is enabled 2025-03-06 01:19:42 +05:30
+11 -4
View File
@@ -480,25 +480,32 @@ func setupAuth(tenantId, clientId, cert,
return "", fmt.Errorf("registry must be specified")
}
if noPush {
return "", nil
}
// case of client secret or cert based auth
if clientId != "" {
// only setup auth when pushing or credentials are defined
token, publicUrl, err := getACRToken(subscriptionId, tenantId, clientId, clientSecret, cert, registry)
if err != nil {
if noPush {
logrus.Warnf("NO_PUSH mode: failed to fetch ACR Token: %v", err)
return "", nil
}
return "", errors.Wrap(err, "failed to fetch ACR Token")
}
// setup docker config for azure registry and base image docker registry
if err := setDockerAuth(username, token, registry, dockerUsername, dockerPassword, dockerRegistry); err != nil {
if noPush {
logrus.Warnf("NO_PUSH mode: failed to create docker config: %v", err)
return "", nil
}
return "", errors.Wrap(err, "failed to create docker config")
}
return publicUrl, nil
} else {
if noPush {
return "", nil
}
return "", fmt.Errorf("managed authentication is not supported")
}
}