From a2d97e6499bd9f75e72674b4674999a5e2908e3c Mon Sep 17 00:00:00 2001 From: Ben Fu <9794300+benfuu@users.noreply.github.com> Date: Sun, 23 Jun 2024 22:42:03 -0500 Subject: [PATCH] fix: pass through git store to git creds (#756) Signed-off-by: Ben Fu --- pkg/argocd/gitcreds.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/argocd/gitcreds.go b/pkg/argocd/gitcreds.go index 90dc0568..20be98e0 100644 --- a/pkg/argocd/gitcreds.go +++ b/pkg/argocd/gitcreds.go @@ -130,7 +130,7 @@ func getCredsFromSecret(wbc *WriteBackConfig, credentialsSecret string, kubeClie if sshPrivateKey, ok = credentials["sshPrivateKey"]; !ok { return nil, fmt.Errorf("invalid secret %s: does not contain field sshPrivateKey", credentialsSecret) } - return git.NewSSHCreds(string(sshPrivateKey), "", true, git.NoopCredsStore{}, ""), nil + return git.NewSSHCreds(string(sshPrivateKey), "", true, wbc.GitCreds, ""), nil } else if git.IsHTTPSURL(wbc.GitRepo) { var username, password, githubAppID, githubAppInstallationID, githubAppPrivateKey []byte if githubAppID, ok = credentials["githubAppID"]; ok { @@ -149,12 +149,12 @@ func getCredsFromSecret(wbc *WriteBackConfig, credentialsSecret string, kubeClie if err != nil { return nil, fmt.Errorf("invalid value in field githubAppInstallationID: %w", err) } - return git.NewGitHubAppCreds(intGithubAppID, intGithubAppInstallationID, string(githubAppPrivateKey), "", "", "", "", true, "", git.NoopCredsStore{}), nil + return git.NewGitHubAppCreds(intGithubAppID, intGithubAppInstallationID, string(githubAppPrivateKey), "", "", "", "", true, "", wbc.GitCreds), nil } else if username, ok = credentials["username"]; ok { if password, ok = credentials["password"]; !ok { return nil, fmt.Errorf("invalid secret %s: does not contain field password", credentialsSecret) } - return git.NewHTTPSCreds(string(username), string(password), "", "", true, "", git.NoopCredsStore{}, false), nil + return git.NewHTTPSCreds(string(username), string(password), "", "", true, "", wbc.GitCreds, false), nil } return nil, fmt.Errorf("invalid repository credentials in secret %s: does not contain githubAppID or username", credentialsSecret) }