github.com/argoproj/argo-cd/v3@v3.2.1/cmd/util/repo.go (about)

     1  package util
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/argoproj/argo-cd/v3/common"
     7  	appsv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
     8  )
     9  
    10  type RepoOptions struct {
    11  	Repo                           appsv1.Repository
    12  	Upsert                         bool
    13  	SshPrivateKeyPath              string //nolint:revive //FIXME(var-naming)
    14  	InsecureOCIForceHTTP           bool
    15  	InsecureIgnoreHostKey          bool
    16  	InsecureSkipServerVerification bool
    17  	TlsClientCertPath              string //nolint:revive //FIXME(var-naming)
    18  	TlsClientCertKeyPath           string //nolint:revive //FIXME(var-naming)
    19  	EnableLfs                      bool
    20  	EnableOci                      bool
    21  	GithubAppId                    int64
    22  	GithubAppInstallationId        int64
    23  	GithubAppPrivateKeyPath        string
    24  	GitHubAppEnterpriseBaseURL     string
    25  	Proxy                          string
    26  	NoProxy                        string
    27  	GCPServiceAccountKeyPath       string
    28  	ForceHttpBasicAuth             bool //nolint:revive //FIXME(var-naming)
    29  	UseAzureWorkloadIdentity       bool
    30  }
    31  
    32  func AddRepoFlags(command *cobra.Command, opts *RepoOptions) {
    33  	command.Flags().StringVar(&opts.Repo.Type, "type", common.DefaultRepoType, "type of the repository, \"git\", \"oci\" or \"helm\"")
    34  	command.Flags().StringVar(&opts.Repo.Name, "name", "", "name of the repository, mandatory for repositories of type helm")
    35  	command.Flags().StringVar(&opts.Repo.Project, "project", "", "project of the repository")
    36  	command.Flags().StringVar(&opts.Repo.Username, "username", "", "username to the repository")
    37  	command.Flags().StringVar(&opts.Repo.Password, "password", "", "password to the repository")
    38  	command.Flags().StringVar(&opts.Repo.BearerToken, "bearer-token", "", "bearer token to the Git BitBucket Data Center repository")
    39  	command.Flags().StringVar(&opts.SshPrivateKeyPath, "ssh-private-key-path", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
    40  	command.Flags().StringVar(&opts.TlsClientCertPath, "tls-client-cert-path", "", "path to the TLS client cert (must be PEM format)")
    41  	command.Flags().StringVar(&opts.TlsClientCertKeyPath, "tls-client-cert-key-path", "", "path to the TLS client cert's key (must be PEM format)")
    42  	command.Flags().BoolVar(&opts.InsecureIgnoreHostKey, "insecure-ignore-host-key", false, "disables SSH strict host key checking (deprecated, use --insecure-skip-server-verification instead)")
    43  	command.Flags().BoolVar(&opts.InsecureSkipServerVerification, "insecure-skip-server-verification", false, "disables server certificate and host key checks")
    44  	command.Flags().BoolVar(&opts.EnableLfs, "enable-lfs", false, "enable git-lfs (Large File Support) on this repository")
    45  	command.Flags().BoolVar(&opts.EnableOci, "enable-oci", false, "enable helm-oci (Helm OCI-Based Repository) (only valid for helm type repositories)")
    46  	command.Flags().Int64Var(&opts.GithubAppId, "github-app-id", 0, "id of the GitHub Application")
    47  	command.Flags().Int64Var(&opts.GithubAppInstallationId, "github-app-installation-id", 0, "installation id of the GitHub Application")
    48  	command.Flags().StringVar(&opts.GithubAppPrivateKeyPath, "github-app-private-key-path", "", "private key of the GitHub Application")
    49  	command.Flags().StringVar(&opts.GitHubAppEnterpriseBaseURL, "github-app-enterprise-base-url", "", "base url to use when using GitHub Enterprise (e.g. https://ghe.example.com/api/v3")
    50  	command.Flags().StringVar(&opts.Proxy, "proxy", "", "use proxy to access repository")
    51  	command.Flags().StringVar(&opts.NoProxy, "no-proxy", "", "don't access these targets via proxy")
    52  	command.Flags().StringVar(&opts.GCPServiceAccountKeyPath, "gcp-service-account-key-path", "", "service account key for the Google Cloud Platform")
    53  	command.Flags().BoolVar(&opts.ForceHttpBasicAuth, "force-http-basic-auth", false, "whether to force use of basic auth when connecting repository via HTTP")
    54  	command.Flags().BoolVar(&opts.UseAzureWorkloadIdentity, "use-azure-workload-identity", false, "whether to use azure workload identity for authentication")
    55  	command.Flags().BoolVar(&opts.InsecureOCIForceHTTP, "insecure-oci-force-http", false, "Use http when accessing an OCI repository")
    56  }