Documentation ¶
Overview ¶
Package gitlab is an internal wrapper for the go-gitlab package
Most functions serve to expose debug logging if set and accept a project name string over an ID.
Index ¶
- Constants
- Variables
- func BranchPushed(pid interface{}, branch string) bool
- func CICancel(pid interface{}, jobID int) (*gitlab.Job, error)
- func CICreate(pid interface{}, opts *gitlab.CreatePipelineOptions) (*gitlab.Pipeline, error)
- func CIJobs(pid interface{}, branch string) ([]*gitlab.Job, error)
- func CIPlayOrRetry(pid interface{}, jobID int, status string) (*gitlab.Job, error)
- func CITrace(pid interface{}, branch, name string) (io.Reader, *gitlab.Job, error)
- func CITrigger(pid interface{}, opts gitlab.RunPipelineTriggerOptions) (*gitlab.Pipeline, error)
- func FindProject(project string) (*gitlab.Project, error)
- func Fork(project string) (string, error)
- func GetProject(projectID interface{}) (*gitlab.Project, error)
- func Host() string
- func Init(_host, _user, _token string)
- func IssueClose(pid interface{}, id int) error
- func IssueCreate(project string, opts *gitlab.CreateIssueOptions) (string, error)
- func IssueGet(project string, issueNum int) (*gitlab.Issue, error)
- func IssueList(project string, opts gitlab.ListProjectIssuesOptions, n int) ([]*gitlab.Issue, error)
- func Lint(content string) (bool, error)
- func LoadGitLabTmpl(tmplName string) string
- func MRApprove(pid interface{}, id int) error
- func MRClose(pid interface{}, id int) error
- func MRCreate(project string, opts *gitlab.CreateMergeRequestOptions) (string, error)
- func MRGet(project string, mrNum int) (*gitlab.MergeRequest, error)
- func MRList(project string, opts gitlab.ListProjectMergeRequestsOptions, n int) ([]*gitlab.MergeRequest, error)
- func MRMerge(pid interface{}, id int) error
- func MRThumbDown(pid interface{}, id int) error
- func MRThumbUp(pid interface{}, id int) error
- func ProjectCreate(opts *gitlab.CreateProjectOptions) (*gitlab.Project, error)
- func ProjectDelete(pid interface{}) error
- func ProjectList(opts gitlab.ListProjectsOptions, n int) ([]*gitlab.Project, error)
- func ProjectSnippetCreate(pid interface{}, opts *gitlab.CreateProjectSnippetOptions) (*gitlab.Snippet, error)
- func ProjectSnippetDelete(pid interface{}, id int) error
- func ProjectSnippetList(pid interface{}, opts gitlab.ListProjectSnippetsOptions, n int) ([]*gitlab.Snippet, error)
- func SnippetCreate(opts *gitlab.CreateSnippetOptions) (*gitlab.Snippet, error)
- func SnippetDelete(id int) error
- func SnippetList(opts gitlab.ListSnippetsOptions, n int) ([]*gitlab.Snippet, error)
- func User() string
- func UserIDFromUsername(username string) (int, error)
Constants ¶
const ( TmplMR = "merge_request_templates/default.md" TmplIssue = "issue_templates/default.md" )
Defines filepath for default GitLab templates
Variables ¶
var ( // ErrProjectNotFound is returned when a GitLab project cannot be found. ErrProjectNotFound = errors.New("gitlab project not found") )
Functions ¶
func BranchPushed ¶ added in v0.5.2
BranchPushed checks if a branch exists on a GitLab project
func CICreate ¶ added in v0.13.0
func CICreate(pid interface{}, opts *gitlab.CreatePipelineOptions) (*gitlab.Pipeline, error)
CICreate creates a pipeline for given ref
func CIJobs ¶ added in v0.11.0
CIJobs returns a list of jobs in a pipeline for a given sha. The jobs are returned sorted by their CreatedAt time
func CIPlayOrRetry ¶ added in v0.12.0
CIPlayOrRetry runs a job either by playing it for the first time or by retrying it based on the currently known job state
func CITrace ¶ added in v0.11.0
CITrace searches by name for a job and returns its trace file. The trace is static so may only be a portion of the logs if the job is till running. If no name is provided job is picked using the first available: 1. Last Running Job 2. First Pending Job 3. Last Job in Pipeline
func CITrigger ¶ added in v0.13.0
func CITrigger(pid interface{}, opts gitlab.RunPipelineTriggerOptions) (*gitlab.Pipeline, error)
CITrigger triggers a pipeline for given ref
func FindProject ¶
FindProject looks up the Gitlab project. If the namespace is not provided in the project string it will search for projects in the users namespace
func GetProject ¶ added in v0.10.0
GetProject looks up a Gitlab project by ID.
func Host ¶ added in v0.6.0
func Host() string
Host exposes the GitLab scheme://hostname used to interact with the API
func Init ¶ added in v0.6.0
func Init(_host, _user, _token string)
Init initializes a gitlab client for use throughout lab.
func IssueClose ¶ added in v0.8.0
IssueClose closes an issue on a GitLab project
func IssueCreate ¶
func IssueCreate(project string, opts *gitlab.CreateIssueOptions) (string, error)
IssueCreate opens a new issue on a GitLab project
func IssueList ¶
func IssueList(project string, opts gitlab.ListProjectIssuesOptions, n int) ([]*gitlab.Issue, error)
IssueList gets a list of issues on a GitLab Project
func LoadGitLabTmpl ¶ added in v0.5.1
LoadGitLabTmpl loads gitlab templates for use in creating Issues and MRs
func MRCreate ¶ added in v0.8.0
func MRCreate(project string, opts *gitlab.CreateMergeRequestOptions) (string, error)
MRCreate opens a merge request on GitLab
func MRGet ¶ added in v0.8.0
func MRGet(project string, mrNum int) (*gitlab.MergeRequest, error)
MRGet retrieves the merge request from GitLab project
func MRList ¶ added in v0.8.0
func MRList(project string, opts gitlab.ListProjectMergeRequestsOptions, n int) ([]*gitlab.MergeRequest, error)
MRList lists the MRs on a GitLab project
func MRThumbDown ¶ added in v0.13.0
MRThumbDown places a thumb up/down on a merge request
func ProjectCreate ¶ added in v0.10.0
func ProjectCreate(opts *gitlab.CreateProjectOptions) (*gitlab.Project, error)
ProjectCreate creates a new project on GitLab
func ProjectDelete ¶ added in v0.10.0
func ProjectDelete(pid interface{}) error
ProjectDelete creates a new project on GitLab
func ProjectList ¶ added in v0.12.0
ProjectList gets a list of projects on GitLab
func ProjectSnippetCreate ¶ added in v0.6.0
func ProjectSnippetCreate(pid interface{}, opts *gitlab.CreateProjectSnippetOptions) (*gitlab.Snippet, error)
ProjectSnippetCreate creates a snippet in a project
func ProjectSnippetDelete ¶ added in v0.6.0
ProjectSnippetDelete deletes a project snippet
func ProjectSnippetList ¶ added in v0.6.0
func ProjectSnippetList(pid interface{}, opts gitlab.ListProjectSnippetsOptions, n int) ([]*gitlab.Snippet, error)
ProjectSnippetList lists snippets on a project
func SnippetCreate ¶ added in v0.6.0
func SnippetCreate(opts *gitlab.CreateSnippetOptions) (*gitlab.Snippet, error)
SnippetCreate creates a personal snippet
func SnippetDelete ¶ added in v0.6.0
SnippetDelete deletes a personal snippet
func SnippetList ¶ added in v0.6.0
SnippetList lists snippets on a project
func UserIDFromUsername ¶ added in v0.12.0
UserIDFromUsername returns the associated Users ID in GitLab. This is useful for API calls that allow you to reference a user, but only by ID.
Types ¶
This section is empty.