Documentation ¶
Index ¶
- func ContainsLabel(labels []*scm.Label, label string) bool
- func DiscoverGitKind(jxClient versioned.Interface, namespace, gitServerURL string) (string, error)
- func FindPullRequestFromEnvironment() (int, error)
- func GetPasswordFromSourceURL(sourceURL string) (string, error)
- func IsScmNotFound(err error) bool
- func IsScmResponseNotFound(res *scm.Response) bool
- func NewScmClient(kind, gitServerURL, token string, ignoreMissingToken bool) (*scm.Client, string, error)
- func ParsePullRequestURL(url string) (*scm.PullRequest, error)
- type CreateRepository
- type Factory
- type Options
- type PullRequestOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsLabel ¶
ContainsLabel returns true if the given labels contains the given label name
func DiscoverGitKind ¶
DiscoverGitKind discovers the git kind for the given git server from the SourceRepository resources. If no jxClient is provided it is lazily created
func FindPullRequestFromEnvironment ¶
FindPullRequestFromEnvironment returns the PullRequest number by looking for common Jenkins X environment variables
func GetPasswordFromSourceURL ¶
GetPasswordFromSourceURL returns password from the git URL
func IsScmNotFound ¶
func IsScmResponseNotFound ¶ added in v3.0.50
func NewScmClient ¶
func NewScmClient(kind, gitServerURL, token string, ignoreMissingToken bool) (*scm.Client, string, error)
NewScmClient creates a new Scm client for the given git kind, server URL and token. If no token is supplied we default it
func ParsePullRequestURL ¶ added in v3.0.10
func ParsePullRequestURL(url string) (*scm.PullRequest, error)
ParsePullRequestURL parses the PullRequest from the string
Types ¶
type CreateRepository ¶
type CreateRepository struct { GitServer string GitKind string Owner string Repository string CurrentUsername string GitPublic bool }
func (*CreateRepository) ConfirmValues ¶
func (r *CreateRepository) ConfirmValues(i input.Interface, batch bool) error
ConfirmValues confirms to the user the values to be used to create the new git repository if using batch mode lets just validate the values are supplied or fail
func (*CreateRepository) CreateRepository ¶
func (r *CreateRepository) CreateRepository(scmClient *scm.Client) (*scm.Repository, error)
CreateRepository creates the git repository if it does not already exist
func (*CreateRepository) FullName ¶
func (r *CreateRepository) FullName() string
type Factory ¶
type Factory struct { GitKind string GitServerURL string GitUsername string GitToken string IgnoreMissingToken bool ScmClient *scm.Client // Input specifies the input to use if we are not using batch mode so that we can lazily populate // the git user and token if it cannot be discovered automatically Input input.Interface // GitCredentialFile allows faking for easier testing GitCredentialFile string }
Factory helper for discovering the git source URL and token
func (*Factory) CreateAuthenticatedURL ¶
CreateAuthenticatedURL creates the Git repository URL with the username and password encoded for HTTPS based URLs
func (*Factory) FindGitToken ¶
FindGitToken ensures the GitToken is populated
func (*Factory) GetUsername ¶
GetUsername gets the current user name from the ScmClient if its not explicitly configured
type Options ¶
type Options struct { Dir string FullRepositoryName string Owner string Repository string Branch string ScmClient *scm.Client GitServerURL string SourceURL string GitKind string GitToken string Namespace string DiscoverFromGit bool PreferUpstream bool IgnoreMissingToken bool JXClient versioned.Interface GitURL *giturl.GitRepository GitClient gitclient.Interface CommandRunner cmdrunner.CommandRunner }
Options helper for discovering the git source URL and token
type PullRequestOptions ¶
type PullRequestOptions struct { Options // Number the Pull Request number Number int // IgnoreMissingPullRequest does not return an error if no pull request could be found IgnoreMissingPullRequest bool }
func (*PullRequestOptions) AddFlags ¶
func (o *PullRequestOptions) AddFlags(cmd *cobra.Command)
AddFlags adds CLI flags
func (*PullRequestOptions) DiscoverPullRequest ¶
func (o *PullRequestOptions) DiscoverPullRequest() (*scm.PullRequest, error)
DiscoverPullRequest discovers the pull request for the current number
func (*PullRequestOptions) Validate ¶
func (o *PullRequestOptions) Validate() error
Validate validates the inputs are valid