mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: pbhatnagar-oss <pbhatifiwork@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
24 lines
624 B
Go
24 lines
624 B
Go
package commit
|
|
|
|
import "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
|
|
|
|
// getCredentialType returns the type of credential used by the repository.
|
|
func getCredentialType(repo *v1alpha1.Repository) string {
|
|
if repo == nil {
|
|
return ""
|
|
}
|
|
if repo.Password != "" {
|
|
return "https"
|
|
}
|
|
if repo.SSHPrivateKey != "" {
|
|
return "ssh"
|
|
}
|
|
if repo.GithubAppPrivateKey != "" && repo.GithubAppId != 0 { // Promoter MVP: remove github-app-installation-id check since it is no longer a required field
|
|
return "github-app"
|
|
}
|
|
if repo.GCPServiceAccountKey != "" {
|
|
return "cloud-source-repositories"
|
|
}
|
|
return ""
|
|
}
|