Skip to content

Commit 9ad9e4f

Browse files
authored
fix: pass through git store to git creds (#756)
Signed-off-by: Ben Fu <ben@benfu.me>
1 parent 38c82f3 commit 9ad9e4f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/argocd/gitcreds.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func getCredsFromSecret(wbc *WriteBackConfig, credentialsSecret string, kubeClie
130130
if sshPrivateKey, ok = credentials["sshPrivateKey"]; !ok {
131131
return nil, fmt.Errorf("invalid secret %s: does not contain field sshPrivateKey", credentialsSecret)
132132
}
133-
return git.NewSSHCreds(string(sshPrivateKey), "", true, git.NoopCredsStore{}, ""), nil
133+
return git.NewSSHCreds(string(sshPrivateKey), "", true, wbc.GitCreds, ""), nil
134134
} else if git.IsHTTPSURL(wbc.GitRepo) {
135135
var username, password, githubAppID, githubAppInstallationID, githubAppPrivateKey []byte
136136
if githubAppID, ok = credentials["githubAppID"]; ok {
@@ -149,12 +149,12 @@ func getCredsFromSecret(wbc *WriteBackConfig, credentialsSecret string, kubeClie
149149
if err != nil {
150150
return nil, fmt.Errorf("invalid value in field githubAppInstallationID: %w", err)
151151
}
152-
return git.NewGitHubAppCreds(intGithubAppID, intGithubAppInstallationID, string(githubAppPrivateKey), "", "", "", "", true, "", git.NoopCredsStore{}), nil
152+
return git.NewGitHubAppCreds(intGithubAppID, intGithubAppInstallationID, string(githubAppPrivateKey), "", "", "", "", true, "", wbc.GitCreds), nil
153153
} else if username, ok = credentials["username"]; ok {
154154
if password, ok = credentials["password"]; !ok {
155155
return nil, fmt.Errorf("invalid secret %s: does not contain field password", credentialsSecret)
156156
}
157-
return git.NewHTTPSCreds(string(username), string(password), "", "", true, "", git.NoopCredsStore{}, false), nil
157+
return git.NewHTTPSCreds(string(username), string(password), "", "", true, "", wbc.GitCreds, false), nil
158158
}
159159
return nil, fmt.Errorf("invalid repository credentials in secret %s: does not contain githubAppID or username", credentialsSecret)
160160
}

0 commit comments

Comments
 (0)