Documentation ¶
Index ¶
- Constants
- type GitLabProvider
- func (p *GitLabProvider) AddDeployKey(ctx context.Context, r *Repository, key, keyName string) (bool, error)
- func (p *GitLabProvider) AddTeam(ctx context.Context, r *Repository, name, permission string) (bool, error)
- func (p *GitLabProvider) CreateRepository(ctx context.Context, r *Repository) (bool, error)
- func (p *GitLabProvider) DeleteRepository(ctx context.Context, r *Repository) error
- type GithubProvider
- func (p *GithubProvider) AddDeployKey(ctx context.Context, r *Repository, key, keyName string) (bool, error)
- func (p *GithubProvider) AddTeam(ctx context.Context, r *Repository, name, permission string) (bool, error)
- func (p *GithubProvider) CreateRepository(ctx context.Context, r *Repository) (bool, error)
- func (p *GithubProvider) DeleteRepository(ctx context.Context, r *Repository) error
- type Provider
- type Repository
Constants ¶
const ( GitHubTokenName = "GITHUB_TOKEN" GitHubDefaultHostname = "github.com" )
const ( GitLabTokenName = "GITLAB_TOKEN" GitLabDefaultHostname = "gitlab.com" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitLabProvider ¶
GitLabProvider represents a GitLab API wrapper
func (*GitLabProvider) AddDeployKey ¶
func (p *GitLabProvider) AddDeployKey(ctx context.Context, r *Repository, key, keyName string) (bool, error)
AddDeployKey returns false if the key exists and the content is the same
func (*GitLabProvider) AddTeam ¶
func (p *GitLabProvider) AddTeam(ctx context.Context, r *Repository, name, permission string) (bool, error)
AddTeam returns false if the team is already assigned to the repository
func (*GitLabProvider) CreateRepository ¶
func (p *GitLabProvider) CreateRepository(ctx context.Context, r *Repository) (bool, error)
CreateRepository returns false if the repository already exists
func (*GitLabProvider) DeleteRepository ¶
func (p *GitLabProvider) DeleteRepository(ctx context.Context, r *Repository) error
DeleteRepository is not supported by GitLab
type GithubProvider ¶
GithubProvider represents a GitHub API wrapper
func (*GithubProvider) AddDeployKey ¶
func (p *GithubProvider) AddDeployKey(ctx context.Context, r *Repository, key, keyName string) (bool, error)
AddDeployKey returns false if the key exists and the content is the same
func (*GithubProvider) AddTeam ¶
func (p *GithubProvider) AddTeam(ctx context.Context, r *Repository, name, permission string) (bool, error)
AddTeam returns false if the team is already assigned to the repository
func (*GithubProvider) CreateRepository ¶
func (p *GithubProvider) CreateRepository(ctx context.Context, r *Repository) (bool, error)
CreateRepository returns false if the repository exists
func (*GithubProvider) DeleteRepository ¶
func (p *GithubProvider) DeleteRepository(ctx context.Context, r *Repository) error
DeleteRepository deletes the GitHub repository
type Provider ¶
type Provider interface { CreateRepository(ctx context.Context, r *Repository) (bool, error) DeleteRepository(ctx context.Context, r *Repository) error AddTeam(ctx context.Context, r *Repository, name, permission string) (bool, error) AddDeployKey(ctx context.Context, r *Repository, key, keyName string) (bool, error) }
Provider is the interface that a git provider should implement
type Repository ¶
type Repository struct { Name string Owner string Host string SSHHost string Token string AuthorName string AuthorEmail string // contains filtered or unexported fields }
Repository represents a git repository wrapper
func NewRepository ¶
func NewRepository(name, owner, host, token, authorName, authorEmail string) (*Repository, error)
NewRepository returns a git repository wrapper
func (*Repository) Checkout ¶
func (r *Repository) Checkout(ctx context.Context, branch, path string) error
Checkout repository branch at specified path
func (*Repository) Commit ¶
Commit changes for the specified path, returns false if no changes are detected
func (*Repository) GetSSH ¶
func (r *Repository) GetSSH() string
GetSSH returns the repository SSH address
func (*Repository) GetURL ¶
func (r *Repository) GetURL() string
GetURL returns the repository HTTPS address