scmhelpers

package
v1.0.82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsLabel added in v1.0.64

func ContainsLabel(labels []*scm.Label, label string) bool

ContainsLabel returns true if the given labels contains the given label name

func DiscoverGitKind added in v1.0.80

func DiscoverGitKind(jxClient versioned.Interface, namespace, gitServerURL string) (string, error)

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 added in v1.0.59

func FindPullRequestFromEnvironment() (int, error)

FindPullRequestFromEnvironment returns the PullRequest number by looking for common Jenkins X environment variables

func GetPasswordFromSourceURL

func GetPasswordFromSourceURL(sourceURL string) (string, error)

GetPasswordFromSourceURL returns password from the git URL

func IsScmNotFound added in v1.0.59

func IsScmNotFound(err error) bool

func NewScmClient

func NewScmClient(kind, gitServerURL, token string) (*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

Types

type CreateRepository added in v1.0.59

type CreateRepository struct {
	GitServer       string
	GitKind         string
	Owner           string
	Repository      string
	CurrentUsername string
	GitPublic       bool
}

func (*CreateRepository) ConfirmValues added in v1.0.59

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 added in v1.0.59

func (r *CreateRepository) CreateRepository(scmClient *scm.Client) (*scm.Repository, error)

CreateRepository creates the git repository if it does not already exist

func (*CreateRepository) FullName added in v1.0.59

func (r *CreateRepository) FullName() string

type Factory added in v1.0.59

type Factory struct {
	GitKind      string
	GitServerURL string
	Owner        string
	GitUsername  string
	GitToken     string
	ScmClient    *scm.Client
}

Factory helper for discovering the git source URL and token

func (*Factory) AddFlags added in v1.0.59

func (o *Factory) AddFlags(cmd *cobra.Command)

AddFlags adds CLI arguments to configure the parameters

func (*Factory) Create added in v1.0.59

func (o *Factory) Create() (*scm.Client, error)

Create creates an ScmClient

func (*Factory) CreateAuthenticatedURL added in v1.0.59

func (o *Factory) CreateAuthenticatedURL(cloneURL string) (string, error)

CreateAuthenticatedURL creates the Git repository URL with the username and password encoded for HTTPS based URLs

func (*Factory) FindGitToken added in v1.0.59

func (o *Factory) FindGitToken() error

FindGitToken ensures the GitToken is populated

func (*Factory) GetUsername added in v1.0.59

func (o *Factory) GetUsername() (string, error)

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
	JXClient           versioned.Interface
	GitURL             *giturl.GitRepository
	GitClient          gitclient.Interface
	CommandRunner      cmdrunner.CommandRunner
}

Options helper for discovering the git source URL and token

func (*Options) AddFlags

func (o *Options) AddFlags(cmd *cobra.Command)

AddFlags adds CLI arguments to configure the parameters

func (*Options) Validate

func (o *Options) Validate() error

Validate validates the inputs are valid and a ScmClient can be created

type PullRequestOptions added in v1.0.58

type PullRequestOptions struct {
	Options

	// Number the Pull Request number
	Number int
}

func (*PullRequestOptions) AddFlags added in v1.0.58

func (o *PullRequestOptions) AddFlags(cmd *cobra.Command)

AddFlags adds CLI flags

func (*PullRequestOptions) DiscoverPullRequest added in v1.0.58

func (o *PullRequestOptions) DiscoverPullRequest() (*scm.PullRequest, error)

DiscoverPullRequest discovers the pull request for the current number

func (*PullRequestOptions) Validate added in v1.0.58

func (o *PullRequestOptions) Validate() error

Validate validates the inputs are valid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL