github.com/argoproj/argo-cd/v3@v3.2.1/commitserver/commit/credentialtypehelper.go (about)

     1  package commit
     2  
     3  import "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
     4  
     5  // getCredentialType returns the type of credential used by the repository.
     6  func getCredentialType(repo *v1alpha1.Repository) string {
     7  	if repo == nil {
     8  		return ""
     9  	}
    10  	if repo.Password != "" {
    11  		return "https"
    12  	}
    13  	if repo.SSHPrivateKey != "" {
    14  		return "ssh"
    15  	}
    16  	if repo.GithubAppPrivateKey != "" && repo.GithubAppId != 0 && repo.GithubAppInstallationId != 0 {
    17  		return "github-app"
    18  	}
    19  	if repo.GCPServiceAccountKey != "" {
    20  		return "cloud-source-repositories"
    21  	}
    22  	return ""
    23  }