mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
chore: make getRepositorySecret more readable (#26827)
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
This commit is contained in:
parent
c86e32b9d6
commit
d875c6170e
1 changed files with 14 additions and 12 deletions
|
|
@ -546,23 +546,25 @@ func (s *secretsRepositoryBackend) getRepositorySecret(repoURL, project string,
|
|||
|
||||
var foundSecret *corev1.Secret
|
||||
for _, secret := range secrets {
|
||||
if git.SameURL(string(secret.Data["url"]), repoURL) {
|
||||
projectSecret := string(secret.Data["project"])
|
||||
if project == projectSecret {
|
||||
if foundSecret != nil {
|
||||
log.Warnf("Found multiple credentials for repoURL: %s", repoURL)
|
||||
}
|
||||
if !git.SameURL(string(secret.Data["url"]), repoURL) {
|
||||
continue
|
||||
}
|
||||
|
||||
return secret, nil
|
||||
projectSecret := string(secret.Data["project"])
|
||||
if project == projectSecret {
|
||||
if foundSecret != nil {
|
||||
log.Warnf("Found multiple credentials for repoURL: %s", repoURL)
|
||||
}
|
||||
|
||||
if projectSecret == "" && allowFallback {
|
||||
if foundSecret != nil {
|
||||
log.Warnf("Found multiple credentials for repoURL: %s", repoURL)
|
||||
}
|
||||
return secret, nil
|
||||
}
|
||||
|
||||
foundSecret = secret
|
||||
if projectSecret == "" && allowFallback {
|
||||
if foundSecret != nil {
|
||||
log.Warnf("Found multiple credentials for repoURL: %s", repoURL)
|
||||
}
|
||||
|
||||
foundSecret = secret
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue