gits

package
v1.2.68 Latest Latest
Warning

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

Go to latest
Published: May 19, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KindBitBucket       = "bitbucket"
	KindBitBucketServer = "bitbucketserver"
	KindGitea           = "gitea"
	KindGitlab          = "gitlab"
	KindGitHub          = "github"

	DateFormat = "January 2 2006"

	BitbucketCloudURL = "https://bitbucket.org"
)
View Source
const (
	GitHubHost = "github.com"
	GitHubURL  = "https://github.com"
)

Variables

View Source
var (

	// ConventionalCommitTitles textual descriptions for
	// Conventional Commit types: https://conventionalcommits.org/
	ConventionalCommitTitles = map[string]*CommitGroup{
		"feat":     createCommitGroup("New Features"),
		"fix":      createCommitGroup("Bug Fixes"),
		"perf":     createCommitGroup("Performance Improvements"),
		"refactor": createCommitGroup("Code Refactoring"),
		"docs":     createCommitGroup("Documentation"),
		"test":     createCommitGroup("Tests"),
		"revert":   createCommitGroup("Reverts"),
		"style":    createCommitGroup("Styles"),
		"chore":    createCommitGroup("Chores"),
		"":         createCommitGroup(""),
	}
)

Functions

func BitbucketAccessTokenURL added in v1.1.47

func BitbucketAccessTokenURL(url string, username string) string

func ConvertToValidBranchName

func ConvertToValidBranchName(name string) string

ConvertToValidBranchName converts the given branch name into a valid git branch string replacing any dodgy characters

func DiscoverRemoteGitURL added in v1.0.13

func DiscoverRemoteGitURL(gitConf string) (string, error)

func DiscoverUpstreamGitURL added in v1.0.97

func DiscoverUpstreamGitURL(gitConf string) (string, error)

func FindGitConfigDir

func FindGitConfigDir(dir string) (string, string, error)

FindGitConfigDir tries to find the `.git` directory either in the current directory or in parent directories

func FormatDate added in v1.1.67

func FormatDate(t time.Time) string

func GenerateMarkdown added in v1.0.100

func GenerateMarkdown(releaseSpec *v1.ReleaseSpec, gitInfo *GitRepositoryInfo) (string, error)

GenerateMarkdown generates the markdown document for the commits

func GetAuthorEmailForCommit added in v1.2.63

func GetAuthorEmailForCommit(dir string, sha string) (string, error)

func GetCurrentGitTagSHA added in v1.0.90

func GetCurrentGitTagSHA(dir string) (string, error)

func GetGitServer added in v1.0.74

func GetGitServer(dir string) (string, error)

func GetHost added in v1.1.70

func GetHost(gitProvider GitProvider) (string, error)

GetHost returns the Git Provider hostname, e.g github.com

func GetPreviousGitTagSHA added in v1.0.90

func GetPreviousGitTagSHA(dir string) (string, error)

func GetRemoteUrl added in v1.0.13

func GetRemoteUrl(config *gitcfg.Config, name string) string

func GetRevisionBeforeDate added in v1.1.67

func GetRevisionBeforeDate(dir string, t time.Time) (string, error)

GetRevisionBeforeDate returns the revision before the given date

func GetRevisionBeforeDateText added in v1.1.67

func GetRevisionBeforeDateText(dir string, dateText string) (string, error)

GetRevisionBeforeDateText returns the revision before the given date in format "MonthName dayNumber year"

func GitAdd

func GitAdd(dir string, args ...string) error

func GitClone

func GitClone(url string, directory string) error

GitClone clones the given git URL into the given directory

func GitCloneOrPull added in v1.1.3

func GitCloneOrPull(url string, directory string) error

GitCloneOrPull will clone the given git URL or pull if it alreasy exists

func GitCmd

func GitCmd(dir string, args ...string) error

func GitCommitDir added in v1.2.63

func GitCommitDir(dir string, message string) error

func GitCommitIfChanges

func GitCommitIfChanges(dir string, message string) error

func GitCreatePushURL

func GitCreatePushURL(cloneURL string, userAuth *auth.UserAuth) (string, error)

GitCreatePushURL creates the git repository URL with the username and password encoded for HTTPS based URLs

func GitGetBranch added in v1.0.83

func GitGetBranch(dir string) (string, error)

func GitGetRemoteBranchNames added in v1.0.14

func GitGetRemoteBranchNames(dir string, prefix string) ([]string, error)

func GitHubAccessTokenURL added in v1.0.16

func GitHubAccessTokenURL(url string) string

func GitHubEnterpriseApiEndpointURL added in v1.1.44

func GitHubEnterpriseApiEndpointURL(u string) string

func GitInit

func GitInit(dir string) error

func GitIsFork added in v1.0.112

func GitIsFork(gitProvider GitProvider, gitInfo *GitRepositoryInfo, dir string) (bool, error)

func GitPush

func GitPush(dir string) error

func GitRemove added in v1.2.67

func GitRemove(dir, fileName string) error

func GitRepoName

func GitRepoName(org, repoName string) string

func GitStatus

func GitStatus(dir string) error

func GiteaAccessTokenURL added in v1.0.16

func GiteaAccessTokenURL(url string) string

func GitlabAccessTokenURL added in v1.2.15

func GitlabAccessTokenURL(url string) string

GitlabAccessTokenURL returns the URL to click on to generate a personal access token for the git provider

func HasChanges

func HasChanges(dir string) (bool, error)

func IsGitHubServerURL added in v1.1.44

func IsGitHubServerURL(u string) bool

func IsGitRepoStatusFailed added in v1.0.80

func IsGitRepoStatusFailed(statuses ...*GitRepoStatus) bool

IsGitRepoStatusFailed returns true if any of the statuses have failed

func IsGitRepoStatusSuccess added in v1.0.80

func IsGitRepoStatusSuccess(statuses ...*GitRepoStatus) bool

IsGitRepoStatusSuccess returns true if all the statuses are successful

func ParseDate added in v1.1.67

func ParseDate(dateText string) (time.Time, error)

func PickOrganisation

func PickOrganisation(orgLister OrganisationLister, userName string) (string, error)

PickOrganisation picks an organisations login if there is one available

func PrintCreateRepositoryGenerateAccessToken added in v1.0.40

func PrintCreateRepositoryGenerateAccessToken(server *auth.AuthServer, username string, o io.Writer)

func ProviderAccessTokenURL added in v1.0.16

func ProviderAccessTokenURL(kind string, url string, username string) string

func ReleaseDownloadCount added in v1.1.67

func ReleaseDownloadCount(releases []*GitRelease) int

ReleaseDownloadCount returns the total number of downloads for the given set of releases

func SaasGitKind added in v1.1.72

func SaasGitKind(gitServiceUrl string) string

SaasGitKind returns the kind for SaaS git providers or "" if the URL could not be deduced

func SetRemoteURL

func SetRemoteURL(dir string, name string, gitURL string) error

Types

type BitbucketCloudProvider added in v1.1.54

type BitbucketCloudProvider struct {
	Client   *bitbucket.APIClient
	Username string
	Context  context.Context

	Server auth.AuthServer
	User   auth.UserAuth
}

BitbucketCloudProvider implements GitProvider interface for bitbucket.org

func (*BitbucketCloudProvider) AddPRComment added in v1.1.54

func (b *BitbucketCloudProvider) AddPRComment(pr *GitPullRequest, comment string) error

func (*BitbucketCloudProvider) CreateIssue added in v1.1.54

func (b *BitbucketCloudProvider) CreateIssue(owner string, repo string, issue *GitIssue) (*GitIssue, error)

func (*BitbucketCloudProvider) CreateIssueComment added in v1.1.54

func (b *BitbucketCloudProvider) CreateIssueComment(owner string, repo string, number int, comment string) error

func (*BitbucketCloudProvider) CreatePullRequest added in v1.1.54

func (b *BitbucketCloudProvider) CreatePullRequest(
	data *GitPullRequestArguments,
) (*GitPullRequest, error)

func (*BitbucketCloudProvider) CreateRepository added in v1.1.54

func (b *BitbucketCloudProvider) CreateRepository(
	org string,
	name string,
	private bool,
) (*GitRepository, error)

func (*BitbucketCloudProvider) CreateWebHook added in v1.1.54

func (b *BitbucketCloudProvider) CreateWebHook(data *GitWebHookArguments) error

func (*BitbucketCloudProvider) CurrentUsername added in v1.2.14

func (p *BitbucketCloudProvider) CurrentUsername() string

func (*BitbucketCloudProvider) DeleteRepository added in v1.1.54

func (b *BitbucketCloudProvider) DeleteRepository(org string, name string) error

func (*BitbucketCloudProvider) ForkRepository added in v1.1.54

func (b *BitbucketCloudProvider) ForkRepository(
	originalOrg string,
	name string,
	destinationOrg string,
) (*GitRepository, error)

func (*BitbucketCloudProvider) GetIssue added in v1.1.54

func (b *BitbucketCloudProvider) GetIssue(org string, name string, number int) (*GitIssue, error)

func (*BitbucketCloudProvider) GetPullRequest added in v1.2.14

func (p *BitbucketCloudProvider) GetPullRequest(owner, repo string, number int) (*GitPullRequest, error)

func (*BitbucketCloudProvider) GetPullRequestCommits added in v1.2.63

func (b *BitbucketCloudProvider) GetPullRequestCommits(owner, repo string, number int) ([]*GitCommit, error)

func (*BitbucketCloudProvider) GetRepository added in v1.1.54

func (b *BitbucketCloudProvider) GetRepository(
	org string,
	name string,
) (*GitRepository, error)

func (*BitbucketCloudProvider) GitIssueToBitbucketIssue added in v1.1.57

func (b *BitbucketCloudProvider) GitIssueToBitbucketIssue(gIssue GitIssue) bitbucket.Issue

func (*BitbucketCloudProvider) HasIssues added in v1.1.54

func (b *BitbucketCloudProvider) HasIssues() bool

func (*BitbucketCloudProvider) IsBitbucket added in v1.1.54

func (b *BitbucketCloudProvider) IsBitbucket() bool

func (*BitbucketCloudProvider) IsGitHub added in v1.1.54

func (b *BitbucketCloudProvider) IsGitHub() bool

func (*BitbucketCloudProvider) IsGitea added in v1.1.54

func (b *BitbucketCloudProvider) IsGitea() bool

func (*BitbucketCloudProvider) IssueURL added in v1.1.54

func (p *BitbucketCloudProvider) IssueURL(org string, name string, number int, isPull bool) string

func (*BitbucketCloudProvider) JenkinsWebHookPath added in v1.1.54

func (b *BitbucketCloudProvider) JenkinsWebHookPath(gitURL string, secret string) string

Exposed by Jenkins plugin; this one is for https://wiki.jenkins.io/display/JENKINS/BitBucket+Plugin

func (*BitbucketCloudProvider) Kind added in v1.1.54

func (b *BitbucketCloudProvider) Kind() string

func (*BitbucketCloudProvider) Label added in v1.1.54

func (b *BitbucketCloudProvider) Label() string

func (*BitbucketCloudProvider) ListCommitStatus added in v1.1.54

func (b *BitbucketCloudProvider) ListCommitStatus(org string, repo string, sha string) ([]*GitRepoStatus, error)

func (*BitbucketCloudProvider) ListOrganisations added in v1.1.54

func (b *BitbucketCloudProvider) ListOrganisations() ([]GitOrganisation, error)

func (*BitbucketCloudProvider) ListReleases added in v1.1.67

func (p *BitbucketCloudProvider) ListReleases(org string, name string) ([]*GitRelease, error)

func (*BitbucketCloudProvider) ListRepositories added in v1.1.54

func (b *BitbucketCloudProvider) ListRepositories(org string) ([]*GitRepository, error)

func (*BitbucketCloudProvider) MergePullRequest added in v1.1.54

func (b *BitbucketCloudProvider) MergePullRequest(pr *GitPullRequest, message string) error

func (*BitbucketCloudProvider) PullRequestLastCommitStatus added in v1.1.54

func (b *BitbucketCloudProvider) PullRequestLastCommitStatus(pr *GitPullRequest) (string, error)

func (*BitbucketCloudProvider) RenameRepository added in v1.1.54

func (b *BitbucketCloudProvider) RenameRepository(
	org string,
	name string,
	newName string,
) (*GitRepository, error)

func (*BitbucketCloudProvider) SearchIssues added in v1.1.54

func (b *BitbucketCloudProvider) SearchIssues(org string, name string, query string) ([]*GitIssue, error)

func (*BitbucketCloudProvider) SearchIssuesClosedSince added in v1.1.67

func (b *BitbucketCloudProvider) SearchIssuesClosedSince(org string, name string, t time.Time) ([]*GitIssue, error)

func (*BitbucketCloudProvider) ServerURL added in v1.1.54

func (b *BitbucketCloudProvider) ServerURL() string

func (*BitbucketCloudProvider) UpdatePullRequestStatus added in v1.1.54

func (b *BitbucketCloudProvider) UpdatePullRequestStatus(pr *GitPullRequest) error

func (*BitbucketCloudProvider) UpdateRelease added in v1.1.54

func (b *BitbucketCloudProvider) UpdateRelease(owner string, repo string, tag string, releaseInfo *GitRelease) error

func (*BitbucketCloudProvider) UserAuth added in v1.2.62

func (p *BitbucketCloudProvider) UserAuth() auth.UserAuth

func (*BitbucketCloudProvider) UserInfo added in v1.2.14

func (p *BitbucketCloudProvider) UserInfo(username string) *GitUser

func (*BitbucketCloudProvider) ValidateRepositoryName added in v1.1.54

func (b *BitbucketCloudProvider) ValidateRepositoryName(org string, name string) error

type CommitGroup added in v1.0.100

type CommitGroup struct {
	Title string
	Order int
}

func ConventionalCommitTypeToTitle added in v1.0.99

func ConventionalCommitTypeToTitle(kind string) *CommitGroup

ConventionalCommitTypeToTitle returns the title of the conventional commit type see: https://conventionalcommits.org/

type CommitInfo added in v1.0.99

type CommitInfo struct {
	Kind    string
	Feature string
	Message string
	// contains filtered or unexported fields
}

func ParseCommit added in v1.0.99

func ParseCommit(message string) *CommitInfo

ParseCommit parses a conventional commit see: https://conventionalcommits.org/

func (*CommitInfo) Group added in v1.0.100

func (c *CommitInfo) Group() *CommitGroup

func (*CommitInfo) Order added in v1.0.100

func (c *CommitInfo) Order() int

func (*CommitInfo) Title added in v1.0.99

func (c *CommitInfo) Title() string

type CreateRepoData

type CreateRepoData struct {
	Organisation string
	RepoName     string
	FullName     string
	PrivateRepo  bool
	User         *auth.UserAuth
	GitProvider  GitProvider
}

func PickNewGitRepository

func PickNewGitRepository(out io.Writer, batchMode bool, authConfigSvc auth.AuthConfigService, defaultRepoName string, repoOptions *GitRepositoryOptions, server *auth.AuthServer, userAuth *auth.UserAuth) (*CreateRepoData, error)

func (*CreateRepoData) CreateRepository

func (d *CreateRepoData) CreateRepository() (*GitRepository, error)

CreateRepository creates the repository - failing if it already exists

func (*CreateRepoData) GetRepository added in v1.0.82

func (d *CreateRepoData) GetRepository() (*GitRepository, error)

GetRepository returns the repository if it already exists

type GitCommit

type GitCommit struct {
	SHA       string
	Message   string
	Author    *GitUser
	URL       string
	Branch    string
	Committer *GitUser
}

type GitHubProvider

type GitHubProvider struct {
	Username string
	Client   *github.Client
	Context  context.Context

	Server auth.AuthServer
	User   auth.UserAuth
}

func (*GitHubProvider) AddPRComment added in v1.0.91

func (p *GitHubProvider) AddPRComment(pr *GitPullRequest, comment string) error

func (*GitHubProvider) CreateIssue added in v1.0.112

func (p *GitHubProvider) CreateIssue(owner string, repo string, issue *GitIssue) (*GitIssue, error)

func (*GitHubProvider) CreateIssueComment added in v1.0.101

func (p *GitHubProvider) CreateIssueComment(owner string, repo string, number int, comment string) error

func (*GitHubProvider) CreatePullRequest

func (p *GitHubProvider) CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error)

func (*GitHubProvider) CreateRepository

func (p *GitHubProvider) CreateRepository(org string, name string, private bool) (*GitRepository, error)

func (*GitHubProvider) CreateWebHook added in v1.0.6

func (p *GitHubProvider) CreateWebHook(data *GitWebHookArguments) error

func (*GitHubProvider) CurrentUsername added in v1.2.14

func (p *GitHubProvider) CurrentUsername() string

func (*GitHubProvider) DeleteRepository added in v1.0.6

func (p *GitHubProvider) DeleteRepository(org string, name string) error

func (*GitHubProvider) ForkRepository

func (p *GitHubProvider) ForkRepository(originalOrg string, name string, destinationOrg string) (*GitRepository, error)

func (*GitHubProvider) GetEnterpriseApiURL added in v1.1.44

func (p *GitHubProvider) GetEnterpriseApiURL() string

GetEnterpriseApiURL returns the github enterprise API URL or blank if this provider is for the https://github.com service

func (*GitHubProvider) GetIssue added in v1.0.97

func (p *GitHubProvider) GetIssue(org string, name string, number int) (*GitIssue, error)

func (*GitHubProvider) GetPullRequest added in v1.2.14

func (p *GitHubProvider) GetPullRequest(owner, repo string, number int) (*GitPullRequest, error)

func (*GitHubProvider) GetPullRequestCommits added in v1.2.63

func (p *GitHubProvider) GetPullRequestCommits(owner, repo string, number int) ([]*GitCommit, error)

func (*GitHubProvider) GetRepository added in v1.0.82

func (p *GitHubProvider) GetRepository(org string, name string) (*GitRepository, error)

func (*GitHubProvider) HasIssues added in v1.0.97

func (p *GitHubProvider) HasIssues() bool

func (*GitHubProvider) IsGitHub

func (p *GitHubProvider) IsGitHub() bool

func (*GitHubProvider) IsGitea added in v1.1.15

func (p *GitHubProvider) IsGitea() bool

func (*GitHubProvider) IssueURL added in v1.1.26

func (p *GitHubProvider) IssueURL(org string, name string, number int, isPull bool) string

func (*GitHubProvider) JenkinsWebHookPath added in v1.0.6

func (p *GitHubProvider) JenkinsWebHookPath(gitURL string, secret string) string

func (*GitHubProvider) Kind added in v1.1.15

func (p *GitHubProvider) Kind() string

func (*GitHubProvider) Label added in v1.0.16

func (p *GitHubProvider) Label() string

func (*GitHubProvider) ListCommitStatus added in v1.0.80

func (p *GitHubProvider) ListCommitStatus(org string, repo string, sha string) ([]*GitRepoStatus, error)

func (*GitHubProvider) ListOrganisations

func (p *GitHubProvider) ListOrganisations() ([]GitOrganisation, error)

func (*GitHubProvider) ListReleases added in v1.1.67

func (p *GitHubProvider) ListReleases(org string, name string) ([]*GitRelease, error)

func (*GitHubProvider) ListRepositories added in v1.0.6

func (p *GitHubProvider) ListRepositories(org string) ([]*GitRepository, error)

func (*GitHubProvider) MergePullRequest added in v1.0.80

func (p *GitHubProvider) MergePullRequest(pr *GitPullRequest, message string) error

func (*GitHubProvider) PullRequestLastCommitStatus added in v1.0.80

func (p *GitHubProvider) PullRequestLastCommitStatus(pr *GitPullRequest) (string, error)

func (*GitHubProvider) RenameRepository

func (p *GitHubProvider) RenameRepository(org string, name string, newName string) (*GitRepository, error)

func (*GitHubProvider) SearchIssues added in v1.1.23

func (p *GitHubProvider) SearchIssues(org string, name string, filter string) ([]*GitIssue, error)

func (*GitHubProvider) SearchIssuesClosedSince added in v1.1.67

func (p *GitHubProvider) SearchIssuesClosedSince(org string, name string, t time.Time) ([]*GitIssue, error)

func (*GitHubProvider) ServerURL added in v1.1.51

func (p *GitHubProvider) ServerURL() string

func (*GitHubProvider) UpdatePullRequestStatus added in v1.0.63

func (p *GitHubProvider) UpdatePullRequestStatus(pr *GitPullRequest) error

func (*GitHubProvider) UpdateRelease added in v1.0.100

func (p *GitHubProvider) UpdateRelease(owner string, repo string, tag string, releaseInfo *GitRelease) error

func (*GitHubProvider) UserAuth added in v1.2.62

func (p *GitHubProvider) UserAuth() auth.UserAuth

func (*GitHubProvider) UserInfo added in v1.2.14

func (p *GitHubProvider) UserInfo(username string) *GitUser

func (*GitHubProvider) ValidateRepositoryName

func (p *GitHubProvider) ValidateRepositoryName(org string, name string) error

type GitIssue added in v1.0.97

type GitIssue struct {
	URL           string
	Owner         string
	Repo          string
	Number        *int
	Key           string
	Title         string
	Body          string
	State         *string
	Labels        []GitLabel
	StatusesURL   *string
	IssueURL      *string
	ClosedAt      *time.Time
	IsPullRequest bool
	User          *GitUser
	ClosedBy      *GitUser
	Assignees     []GitUser
}

func BitbucketIssueToGitIssue added in v1.1.57

func BitbucketIssueToGitIssue(bIssue bitbucket.Issue) *GitIssue

func FilterIssuesClosedSince added in v1.1.67

func FilterIssuesClosedSince(issues []*GitIssue, t time.Time) []*GitIssue

FilterIssuesClosedSince returns a filtered slice of all the issues closed since the given date

func (*GitIssue) IsClosedSince added in v1.1.67

func (i *GitIssue) IsClosedSince(t time.Time) bool

IsClosedSince returns true if the issue has been closed since the given da

func (*GitIssue) Name added in v1.0.112

func (i *GitIssue) Name() string

Name returns the textual name of the issue

type GitLabel added in v1.0.97

type GitLabel struct {
	URL   string
	Name  string
	Color string
}

func ToGitLabels added in v1.1.23

func ToGitLabels(names []string) []GitLabel

ToGitLabels converts the list of label names into an array of GitLabels

type GitOrganisation

type GitOrganisation struct {
	Login string
}

type GitProvider

type GitProvider interface {
	OrganisationLister

	ListRepositories(org string) ([]*GitRepository, error)

	CreateRepository(org string, name string, private bool) (*GitRepository, error)

	GetRepository(org string, name string) (*GitRepository, error)

	DeleteRepository(org string, name string) error

	ForkRepository(originalOrg string, name string, destinationOrg string) (*GitRepository, error)

	RenameRepository(org string, name string, newName string) (*GitRepository, error)

	ValidateRepositoryName(org string, name string) error

	CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error)

	UpdatePullRequestStatus(pr *GitPullRequest) error

	GetPullRequest(owner, repo string, number int) (*GitPullRequest, error)

	GetPullRequestCommits(owner, repo string, number int) ([]*GitCommit, error)

	PullRequestLastCommitStatus(pr *GitPullRequest) (string, error)

	ListCommitStatus(org string, repo string, sha string) ([]*GitRepoStatus, error)

	MergePullRequest(pr *GitPullRequest, message string) error

	CreateWebHook(data *GitWebHookArguments) error

	IsGitHub() bool

	IsGitea() bool

	Kind() string

	GetIssue(org string, name string, number int) (*GitIssue, error)

	IssueURL(org string, name string, number int, isPull bool) string

	SearchIssues(org string, name string, query string) ([]*GitIssue, error)

	SearchIssuesClosedSince(org string, name string, t time.Time) ([]*GitIssue, error)

	CreateIssue(owner string, repo string, issue *GitIssue) (*GitIssue, error)

	HasIssues() bool

	AddPRComment(pr *GitPullRequest, comment string) error

	CreateIssueComment(owner string, repo string, number int, comment string) error

	UpdateRelease(owner string, repo string, tag string, releaseInfo *GitRelease) error

	ListReleases(org string, name string) ([]*GitRelease, error)

	JenkinsWebHookPath(gitURL string, secret string) string

	// Label returns the git service label or name
	Label() string

	// ServerURL returns the git server URL
	ServerURL() string

	// Returns the current username
	CurrentUsername() string

	// Returns the current user auth
	UserAuth() auth.UserAuth

	// Returns user info, if possible
	UserInfo(username string) *GitUser
}

func CreateProvider

func CreateProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)

func CreateProviderForURL added in v1.2.62

func CreateProviderForURL(authConfigSvc auth.AuthConfigService, gitKind string, hostUrl string) (GitProvider, error)

CreateProviderForURL creates the git provider for the given git kind and host URL

func NewBitbucketCloudProvider added in v1.1.54

func NewBitbucketCloudProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)

func NewGitHubProvider

func NewGitHubProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)

func NewGiteaProvider added in v1.0.16

func NewGiteaProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)

func NewGitlabProvider added in v1.1.36

func NewGitlabProvider(server *auth.AuthServer, user *auth.UserAuth) (GitProvider, error)

type GitPullRequest

type GitPullRequest struct {
	URL            string
	Author         *GitUser
	Owner          string
	Repo           string
	Number         *int
	Mergeable      *bool
	Merged         *bool
	State          *string
	StatusesURL    *string
	IssueURL       *string
	DiffURL        *string
	MergeCommitSHA *string
	ClosedAt       *time.Time
	MergedAt       *time.Time
	LastCommitSha  string
	Title          string
	Body           string
}

func (*GitPullRequest) IsClosed added in v1.0.63

func (pr *GitPullRequest) IsClosed() bool

IsClosed returns true if the PullRequest has been closed

type GitPullRequestArguments

type GitPullRequestArguments struct {
	Owner string
	Repo  string
	Title string
	Body  string
	Head  string
	Base  string
}

type GitRelease added in v1.0.100

type GitRelease struct {
	Name          string
	TagName       string
	Body          string
	URL           string
	HTMLURL       string
	DownloadCount int
}

type GitRepoStatus added in v1.0.80

type GitRepoStatus struct {
	ID      int64
	Context string
	URL     string

	// State is the current state of the repository. Possible values are:
	// pending, success, error, or failure.
	State string `json:"state,omitempty"`

	// TargetURL is the URL of the page representing this status
	TargetURL string `json:"target_url,omitempty"`

	// Description is a short high level summary of the status.
	Description string
}

func (*GitRepoStatus) IsFailed added in v1.0.80

func (s *GitRepoStatus) IsFailed() bool

func (*GitRepoStatus) IsSuccess added in v1.0.80

func (s *GitRepoStatus) IsSuccess() bool

type GitRepository

type GitRepository struct {
	Name             string
	AllowMergeCommit bool
	HTMLURL          string
	CloneURL         string
	SSHURL           string
	Language         string
	Fork             bool
	Stars            int
}

func BitbucketRepositoryToGitRepository added in v1.1.46

func BitbucketRepositoryToGitRepository(bRepo bitbucket.Repository) *GitRepository

func PickRepositories added in v1.0.6

func PickRepositories(provider GitProvider, owner string, message string, selectAll bool, filter string) ([]*GitRepository, error)

type GitRepositoryInfo

type GitRepositoryInfo struct {
	URL          string
	Scheme       string
	Host         string
	Organisation string
	Name         string
}

func GetGitInfo added in v1.0.91

func GetGitInfo(dir string) (*GitRepositoryInfo, error)

func ParseGitURL

func ParseGitURL(text string) (*GitRepositoryInfo, error)

ParseGitURL attempts to parse the given text as a URL or git URL-like string to determine the protocol, host, organisation and name

func (*GitRepositoryInfo) CreateProvider added in v1.0.91

func (i *GitRepositoryInfo) CreateProvider(authConfigSvc auth.AuthConfigService, gitKind string) (GitProvider, error)

func (*GitRepositoryInfo) CreateProviderForUser

func (i *GitRepositoryInfo) CreateProviderForUser(server *auth.AuthServer, user *auth.UserAuth, gitKind string) (GitProvider, error)

func (*GitRepositoryInfo) HostURL added in v1.0.100

func (i *GitRepositoryInfo) HostURL() string

HostURL returns the URL to the host

func (*GitRepositoryInfo) HostURLWithoutUser added in v1.0.114

func (i *GitRepositoryInfo) HostURLWithoutUser() string

func (*GitRepositoryInfo) HttpCloneURL added in v1.0.83

func (i *GitRepositoryInfo) HttpCloneURL() string

HttpCloneURL returns the HTTPS git URL this repository

func (*GitRepositoryInfo) HttpURL added in v1.0.95

func (i *GitRepositoryInfo) HttpURL() string

HttpURL returns the URL to browse this repository in a web browser

func (*GitRepositoryInfo) HttpsURL added in v1.1.15

func (i *GitRepositoryInfo) HttpsURL() string

HttpsURL returns the URL to browse this repository in a web browser

func (*GitRepositoryInfo) IsGitHub

func (i *GitRepositoryInfo) IsGitHub() bool

func (*GitRepositoryInfo) PickOrCreateProvider

func (i *GitRepositoryInfo) PickOrCreateProvider(authConfigSvc auth.AuthConfigService, message string, batchMode bool, gitKind string) (GitProvider, error)

func (*GitRepositoryInfo) PipelinePath added in v1.1.10

func (i *GitRepositoryInfo) PipelinePath() string

PipelinePath returns the pipeline path for the master branch which can be used to query pipeline logs in `jx get build logs myPipelinePath`

func (*GitRepositoryInfo) PullRequestURL added in v1.0.83

func (i *GitRepositoryInfo) PullRequestURL(prName string) string

PullRequestURL returns the URL of a pull request of the given name/number

type GitRepositoryOptions added in v1.0.37

type GitRepositoryOptions struct {
	ServerURL string
	Username  string
	ApiToken  string
	Owner     string
}

type GitUser added in v1.0.97

type GitUser struct {
	URL       string
	Login     string
	Name      string
	Email     string
	AvatarURL string
}

type GitWebHookArguments added in v1.0.6

type GitWebHookArguments struct {
	Owner  string
	Repo   string
	URL    string
	Secret string
}

type GiteaProvider added in v1.0.16

type GiteaProvider struct {
	Username string
	Client   *gitea.Client

	Server auth.AuthServer
	User   auth.UserAuth
}

func (*GiteaProvider) AddPRComment added in v1.0.91

func (p *GiteaProvider) AddPRComment(pr *GitPullRequest, comment string) error

func (*GiteaProvider) CreateIssue added in v1.0.112

func (p *GiteaProvider) CreateIssue(owner string, repo string, issue *GitIssue) (*GitIssue, error)

func (*GiteaProvider) CreateIssueComment added in v1.0.101

func (p *GiteaProvider) CreateIssueComment(owner string, repo string, number int, comment string) error

func (*GiteaProvider) CreatePullRequest added in v1.0.16

func (p *GiteaProvider) CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error)

func (*GiteaProvider) CreateRepository added in v1.0.16

func (p *GiteaProvider) CreateRepository(org string, name string, private bool) (*GitRepository, error)

func (*GiteaProvider) CreateWebHook added in v1.0.16

func (p *GiteaProvider) CreateWebHook(data *GitWebHookArguments) error

func (*GiteaProvider) CurrentUsername added in v1.2.14

func (p *GiteaProvider) CurrentUsername() string

func (*GiteaProvider) DeleteRepository added in v1.0.16

func (p *GiteaProvider) DeleteRepository(org string, name string) error

func (*GiteaProvider) ForkRepository added in v1.0.16

func (p *GiteaProvider) ForkRepository(originalOrg string, name string, destinationOrg string) (*GitRepository, error)

func (*GiteaProvider) GetIssue added in v1.0.97

func (p *GiteaProvider) GetIssue(org string, name string, number int) (*GitIssue, error)

func (*GiteaProvider) GetPullRequest added in v1.2.14

func (p *GiteaProvider) GetPullRequest(owner, repo string, number int) (*GitPullRequest, error)

func (*GiteaProvider) GetPullRequestCommits added in v1.2.63

func (p *GiteaProvider) GetPullRequestCommits(owner, repo string, number int) ([]*GitCommit, error)

func (*GiteaProvider) GetRepository added in v1.0.82

func (p *GiteaProvider) GetRepository(org string, name string) (*GitRepository, error)

func (*GiteaProvider) HasIssues added in v1.0.97

func (p *GiteaProvider) HasIssues() bool

func (*GiteaProvider) IsGitHub added in v1.0.16

func (p *GiteaProvider) IsGitHub() bool

func (*GiteaProvider) IsGitea added in v1.1.15

func (p *GiteaProvider) IsGitea() bool

func (*GiteaProvider) IssueURL added in v1.1.26

func (p *GiteaProvider) IssueURL(org string, name string, number int, isPull bool) string

func (*GiteaProvider) JenkinsWebHookPath added in v1.0.16

func (p *GiteaProvider) JenkinsWebHookPath(gitURL string, secret string) string

func (*GiteaProvider) Kind added in v1.1.15

func (p *GiteaProvider) Kind() string

func (*GiteaProvider) Label added in v1.0.16

func (p *GiteaProvider) Label() string

func (*GiteaProvider) ListCommitStatus added in v1.0.80

func (p *GiteaProvider) ListCommitStatus(org string, repo string, sha string) ([]*GitRepoStatus, error)

func (*GiteaProvider) ListOrganisations added in v1.0.16

func (p *GiteaProvider) ListOrganisations() ([]GitOrganisation, error)

func (*GiteaProvider) ListReleases added in v1.1.67

func (p *GiteaProvider) ListReleases(org string, name string) ([]*GitRelease, error)

func (*GiteaProvider) ListRepositories added in v1.0.16

func (p *GiteaProvider) ListRepositories(org string) ([]*GitRepository, error)

func (*GiteaProvider) MergePullRequest added in v1.0.80

func (p *GiteaProvider) MergePullRequest(pr *GitPullRequest, message string) error

func (*GiteaProvider) PullRequestLastCommitStatus added in v1.0.80

func (p *GiteaProvider) PullRequestLastCommitStatus(pr *GitPullRequest) (string, error)

func (*GiteaProvider) RenameRepository added in v1.0.16

func (p *GiteaProvider) RenameRepository(org string, name string, newName string) (*GitRepository, error)

func (*GiteaProvider) SearchIssues added in v1.1.23

func (p *GiteaProvider) SearchIssues(org string, name string, filter string) ([]*GitIssue, error)

func (*GiteaProvider) SearchIssuesClosedSince added in v1.1.67

func (p *GiteaProvider) SearchIssuesClosedSince(org string, name string, t time.Time) ([]*GitIssue, error)

func (*GiteaProvider) ServerURL added in v1.1.51

func (p *GiteaProvider) ServerURL() string

func (*GiteaProvider) UpdatePullRequestStatus added in v1.0.63

func (p *GiteaProvider) UpdatePullRequestStatus(pr *GitPullRequest) error

func (*GiteaProvider) UpdateRelease added in v1.0.100

func (p *GiteaProvider) UpdateRelease(owner string, repo string, tag string, releaseInfo *GitRelease) error

func (*GiteaProvider) UserAuth added in v1.2.62

func (p *GiteaProvider) UserAuth() auth.UserAuth

func (*GiteaProvider) UserInfo added in v1.2.14

func (p *GiteaProvider) UserInfo(username string) *GitUser

func (*GiteaProvider) ValidateRepositoryName added in v1.0.16

func (p *GiteaProvider) ValidateRepositoryName(org string, name string) error

type GitlabProvider added in v1.1.36

type GitlabProvider struct {
	Username string
	Client   *gitlab.Client
	Context  context.Context

	Server auth.AuthServer
	User   auth.UserAuth
}

func (*GitlabProvider) AddPRComment added in v1.1.36

func (g *GitlabProvider) AddPRComment(pr *GitPullRequest, comment string) error

func (*GitlabProvider) CreateIssue added in v1.1.36

func (g *GitlabProvider) CreateIssue(owner string, repo string, issue *GitIssue) (*GitIssue, error)

func (*GitlabProvider) CreateIssueComment added in v1.1.36

func (g *GitlabProvider) CreateIssueComment(owner string, repo string, number int, comment string) error

func (*GitlabProvider) CreatePullRequest added in v1.1.36

func (g *GitlabProvider) CreatePullRequest(data *GitPullRequestArguments) (*GitPullRequest, error)

func (*GitlabProvider) CreateRepository added in v1.1.36

func (g *GitlabProvider) CreateRepository(org string, name string, private bool) (*GitRepository, error)

func (*GitlabProvider) CreateWebHook added in v1.1.36

func (g *GitlabProvider) CreateWebHook(data *GitWebHookArguments) error

func (*GitlabProvider) CurrentUsername added in v1.2.14

func (p *GitlabProvider) CurrentUsername() string

func (*GitlabProvider) DeleteRepository added in v1.1.36

func (g *GitlabProvider) DeleteRepository(org, name string) error

func (*GitlabProvider) ForkRepository added in v1.1.36

func (g *GitlabProvider) ForkRepository(originalOrg, name, destinationOrg string) (*GitRepository, error)

func (*GitlabProvider) GetIssue added in v1.1.36

func (g *GitlabProvider) GetIssue(org, repo string, number int) (*GitIssue, error)

func (*GitlabProvider) GetPullRequest added in v1.2.14

func (p *GitlabProvider) GetPullRequest(owner, repo string, number int) (*GitPullRequest, error)

func (*GitlabProvider) GetPullRequestCommits added in v1.2.63

func (p *GitlabProvider) GetPullRequestCommits(owner, repo string, number int) ([]*GitCommit, error)

func (*GitlabProvider) GetRepository added in v1.1.36

func (g *GitlabProvider) GetRepository(org, name string) (*GitRepository, error)

func (*GitlabProvider) HasIssues added in v1.1.36

func (g *GitlabProvider) HasIssues() bool

func (*GitlabProvider) IsBitbucket added in v1.1.36

func (g *GitlabProvider) IsBitbucket() bool

func (*GitlabProvider) IsGitHub added in v1.1.36

func (g *GitlabProvider) IsGitHub() bool

func (*GitlabProvider) IsGitea added in v1.1.36

func (g *GitlabProvider) IsGitea() bool

func (*GitlabProvider) IssueURL added in v1.1.36

func (p *GitlabProvider) IssueURL(org string, name string, number int, isPull bool) string

func (*GitlabProvider) JenkinsWebHookPath added in v1.1.36

func (g *GitlabProvider) JenkinsWebHookPath(gitURL string, secret string) string

func (*GitlabProvider) Kind added in v1.1.36

func (g *GitlabProvider) Kind() string

func (*GitlabProvider) Label added in v1.1.36

func (g *GitlabProvider) Label() string

func (*GitlabProvider) ListCommitStatus added in v1.1.36

func (g *GitlabProvider) ListCommitStatus(org string, repo string, sha string) ([]*GitRepoStatus, error)

func (*GitlabProvider) ListOrganisations added in v1.1.36

func (g *GitlabProvider) ListOrganisations() ([]GitOrganisation, error)

func (*GitlabProvider) ListReleases added in v1.1.67

func (g *GitlabProvider) ListReleases(org string, name string) ([]*GitRelease, error)

func (*GitlabProvider) ListRepositories added in v1.1.36

func (g *GitlabProvider) ListRepositories(org string) ([]*GitRepository, error)

func (*GitlabProvider) MergePullRequest added in v1.1.36

func (g *GitlabProvider) MergePullRequest(pr *GitPullRequest, message string) error

func (*GitlabProvider) PullRequestLastCommitStatus added in v1.1.36

func (g *GitlabProvider) PullRequestLastCommitStatus(pr *GitPullRequest) (string, error)

func (*GitlabProvider) RenameRepository added in v1.1.36

func (g *GitlabProvider) RenameRepository(org, name, newName string) (*GitRepository, error)

func (*GitlabProvider) SearchIssues added in v1.1.36

func (g *GitlabProvider) SearchIssues(org, repo, query string) ([]*GitIssue, error)

func (*GitlabProvider) SearchIssuesClosedSince added in v1.1.67

func (g *GitlabProvider) SearchIssuesClosedSince(org string, repo string, t time.Time) ([]*GitIssue, error)

func (*GitlabProvider) ServerURL added in v1.1.51

func (p *GitlabProvider) ServerURL() string

func (*GitlabProvider) UpdatePullRequestStatus added in v1.1.36

func (g *GitlabProvider) UpdatePullRequestStatus(pr *GitPullRequest) error

func (*GitlabProvider) UpdateRelease added in v1.1.36

func (g *GitlabProvider) UpdateRelease(owner string, repo string, tag string, releaseInfo *GitRelease) error

func (*GitlabProvider) UserAuth added in v1.2.62

func (p *GitlabProvider) UserAuth() auth.UserAuth

func (*GitlabProvider) UserInfo added in v1.2.14

func (p *GitlabProvider) UserInfo(username string) *GitUser

func (*GitlabProvider) ValidateRepositoryName added in v1.1.36

func (g *GitlabProvider) ValidateRepositoryName(org, name string) error

type GroupAndCommitInfos added in v1.0.100

type GroupAndCommitInfos struct {
	// contains filtered or unexported fields
}

type OrganisationLister added in v1.1.25

type OrganisationLister interface {
	ListOrganisations() ([]GitOrganisation, error)
}

Jump to

Keyboard shortcuts

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