Documentation
¶
Index ¶
- Constants
- type AzdoGITProvider
- func (g *AzdoGITProvider) CreatePR(ctx context.Context, branchName string, auto bool, state *PRState) error
- func (g *AzdoGITProvider) GetPRThatCausedCommit(ctx context.Context, sha string) (PullRequest, error)
- func (g *AzdoGITProvider) GetPRWithBranch(ctx context.Context, source, target string) (PullRequest, error)
- func (g *AzdoGITProvider) GetStatus(ctx context.Context, sha string, group string, env string) (Status, error)
- func (g *AzdoGITProvider) MergePR(ctx context.Context, id int, sha string) error
- type GitProvider
- type PRState
- type ProviderType
- type PullRequest
- type Repository
- func (g *Repository) CreateBranch(branchName string, force bool) error
- func (g *Repository) CreateCommit(branchName, message string) (*git2go.Oid, error)
- func (g *Repository) CreatePR(ctx context.Context, branchName string, auto bool, state *PRState) error
- func (g *Repository) GetBranchName() (string, error)
- func (g *Repository) GetCurrentCommit() (*git2go.Oid, error)
- func (g *Repository) GetLastCommitForBranch(branchName string) (*git2go.Oid, error)
- func (g *Repository) GetPRForCurrentBranch(ctx context.Context) (PullRequest, error)
- func (g *Repository) GetPRThatCausedCurrentCommit(ctx context.Context) (PullRequest, error)
- func (g *Repository) GetRootDir() string
- func (g *Repository) GetStatus(ctx context.Context, sha, group, env string) (Status, error)
- func (g *Repository) MergePR(ctx context.Context, id int, sha string) error
- func (g *Repository) Push(branchName string) error
- type Status
Constants ¶
View Source
const DefaultBranch = "main"
View Source
const DefaultRemote = "origin"
View Source
const DefaultUsername = "git"
View Source
const PromoteBranchPrefix = "promote/"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzdoGITProvider ¶
type AzdoGITProvider struct {
// contains filtered or unexported fields
}
AdoGITProvider ...
func NewAzdoGITProvider ¶
func NewAzdoGITProvider(ctx context.Context, remoteURL, token string) (*AzdoGITProvider, error)
NewAdoGITProvider ...
func (*AzdoGITProvider) CreatePR ¶
func (g *AzdoGITProvider) CreatePR(ctx context.Context, branchName string, auto bool, state *PRState) error
CreatePR ...
func (*AzdoGITProvider) GetPRThatCausedCommit ¶
func (g *AzdoGITProvider) GetPRThatCausedCommit(ctx context.Context, sha string) (PullRequest, error)
func (*AzdoGITProvider) GetPRWithBranch ¶
func (g *AzdoGITProvider) GetPRWithBranch(ctx context.Context, source, target string) (PullRequest, error)
type GitProvider ¶
type GitProvider interface {
GetStatus(ctx context.Context, sha, group, env string) (Status, error)
CreatePR(ctx context.Context, branchName string, auto bool, state *PRState) error
GetPRWithBranch(ctx context.Context, source, target string) (PullRequest, error)
GetPRThatCausedCommit(ctx context.Context, sha string) (PullRequest, error)
MergePR(ctx context.Context, ID int, sha string) error
}
func NewGitProvider ¶
func NewGitProvider(ctx context.Context, providerType ProviderType, remoteURL, token string) (GitProvider, error)
type PRState ¶
type PRState struct {
Env string `json:"env"`
Group string `json:"group"`
App string `json:"app"`
Tag string `json:"tag"`
Sha string `json:"sha"`
}
func (*PRState) BranchName ¶
func (*PRState) Description ¶
type ProviderType ¶
type ProviderType string
const (
ProviderTypeAzdo ProviderType = "azdo"
)
func StringToProviderType ¶ added in v0.0.6
func StringToProviderType(p string) (ProviderType, error)
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents a local git repository.
func LoadRepository ¶
func LoadRepository(ctx context.Context, path string, providerType ProviderType, token string) (*Repository, error)
LoadRepository loads a local git repository.
func (*Repository) CreateBranch ¶
func (g *Repository) CreateBranch(branchName string, force bool) error
CreateBranch creates a branch.
func (*Repository) CreateCommit ¶
func (g *Repository) CreateCommit(branchName, message string) (*git2go.Oid, error)
CreateCommit creates a commit in the specfied branch.
func (*Repository) GetBranchName ¶ added in v0.0.6
func (g *Repository) GetBranchName() (string, error)
func (*Repository) GetCurrentCommit ¶
func (g *Repository) GetCurrentCommit() (*git2go.Oid, error)
func (*Repository) GetLastCommitForBranch ¶
func (g *Repository) GetLastCommitForBranch(branchName string) (*git2go.Oid, error)
func (*Repository) GetPRForCurrentBranch ¶
func (g *Repository) GetPRForCurrentBranch(ctx context.Context) (PullRequest, error)
func (*Repository) GetPRThatCausedCurrentCommit ¶
func (g *Repository) GetPRThatCausedCurrentCommit(ctx context.Context) (PullRequest, error)
func (*Repository) GetRootDir ¶
func (g *Repository) GetRootDir() string
func (*Repository) Push ¶
func (g *Repository) Push(branchName string) error
Push pushes the defined ref to remote.
Click to show internal directories.
Click to hide internal directories.