mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-04-02 14:58:48 +02:00
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
24 lines
565 B
Go
24 lines
565 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 && repo.GithubAppInstallationId != 0 {
|
|
return "github-app"
|
|
}
|
|
if repo.GCPServiceAccountKey != "" {
|
|
return "cloud-source-repositories"
|
|
}
|
|
return ""
|
|
}
|