Documentation ¶
Index ¶
- Constants
- func NewGitlab(scmCfg *v1alpha1.SCMSource) (scm.Provider, error)
- func ParseEvent(request *http.Request) *scm.EventData
- type MergeCommentEvent
- type MergeRequest
- type V3
- func (g *V3) CheckToken() error
- func (g *V3) CreateStatus(status c_v1alpha1.StatusPhase, targetURL, repoURL, commitSha string) error
- func (g *V3) CreateWebhook(repo string, webhook *scm.Webhook) error
- func (g *V3) DeleteWebhook(repo string, webhookURL string) error
- func (g *V3) GetPullRequestSHA(repoURL string, number int) (string, error)
- func (g *V3) GetToken() (string, error)
- func (g *V3) GetWebhook(repo string, webhookURL string) (*v3.ProjectHook, error)
- func (g *V3) ListBranches(repo string) ([]string, error)
- func (g *V3) ListDockerfiles(repo string) ([]string, error)
- func (g *V3) ListRepos() ([]scm.Repository, error)
- func (g *V3) ListTags(repo string) ([]string, error)
- type V4
- func (g *V4) CheckToken() error
- func (g *V4) CreateStatus(status c_v1alpha1.StatusPhase, targetURL, repoURL, commitSha string) error
- func (g *V4) CreateWebhook(repo string, webhook *scm.Webhook) error
- func (g *V4) DeleteWebhook(repo string, webhookURL string) error
- func (g *V4) GetPullRequestSHA(repoURL string, number int) (string, error)
- func (g *V4) GetToken() (string, error)
- func (g *V4) GetWebhook(repo string, webhookURL string) (*v4.ProjectHook, error)
- func (g *V4) ListBranches(repo string) ([]string, error)
- func (g *V4) ListDockerfiles(repo string) ([]string, error)
- func (g *V4) ListRepos() ([]scm.Repository, error)
- func (g *V4) ListTags(repo string) ([]string, error)
Constants ¶
const ( // EventTypeHeader represents the header key for event type of Gitlab. EventTypeHeader = "X-Gitlab-Event" // NoteHookEvent represents comments event. NoteHookEvent = "Note Hook" // MergeRequestHookEvent represents merge request event. MergeRequestHookEvent = "Merge Request Hook" // TagPushHookEvent represents tag push event. TagPushHookEvent = "Tag Push Hook" // PushHookEvent represents commit push event. PushHookEvent = "Push Hook" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MergeCommentEvent ¶
type MergeCommentEvent struct { ObjectKind string `json:"object_kind"` //User *User `json:"user"` ProjectID int `json:"project_id"` Project struct { Name string `json:"name"` Description string `json:"description"` AvatarURL string `json:"avatar_url"` GitSSHURL string `json:"git_ssh_url"` GitHTTPURL string `json:"git_http_url"` Namespace string `json:"namespace"` PathWithNamespace string `json:"path_with_namespace"` DefaultBranch string `json:"default_branch"` Homepage string `json:"homepage"` URL string `json:"url"` SSHURL string `json:"ssh_url"` HTTPURL string `json:"http_url"` WebURL string `json:"web_url"` } `json:"project"` //Repository *Repository `json:"repository"` ObjectAttributes struct { ID int `json:"id"` Note string `json:"note"` NoteableType string `json:"noteable_type"` AuthorID int `json:"author_id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` ProjectID int `json:"project_id"` Attachment string `json:"attachment"` LineCode string `json:"line_code"` CommitID string `json:"commit_id"` NoteableID int `json:"noteable_id"` System bool `json:"system"` //StDiff *Diff `json:"st_diff"` URL string `json:"url"` } `json:"object_attributes"` MergeRequest *MergeRequest `json:"merge_request"` }
MergeCommentEvent ...
type MergeRequest ¶
type MergeRequest struct { ID int `json:"id"` IID int `json:"iid"` ProjectID int `json:"project_id"` Title string `json:"title"` Description string `json:"description"` WorkInProgress bool `json:"work_in_progress"` State string `json:"state"` //CreatedAt *time.Time `json:"created_at"` //UpdatedAt *time.Time `json:"updated_at"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` TargetBranch string `json:"target_branch"` SourceBranch string `json:"source_branch"` Upvotes int `json:"upvotes"` Downvotes int `json:"downvotes"` Author struct { Name string `json:"name"` Username string `json:"username"` ID int `json:"id"` State string `json:"state"` AvatarURL string `json:"avatar_url"` } `json:"author"` Assignee struct { Name string `json:"name"` Username string `json:"username"` ID int `json:"id"` State string `json:"state"` AvatarURL string `json:"avatar_url"` } `json:"assignee"` SourceProjectID int `json:"source_project_id"` TargetProjectID int `json:"target_project_id"` Labels []string `json:"labels"` Milestone struct { ID int `json:"id"` Iid int `json:"iid"` ProjectID int `json:"project_id"` Title string `json:"title"` Description string `json:"description"` State string `json:"state"` //CreatedAt *time.Time `json:"created_at"` //UpdatedAt *time.Time `json:"updated_at"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` DueDate string `json:"due_date"` } `json:"milestone"` MergeWhenBuildSucceeds bool `json:"merge_when_build_succeeds"` MergeStatus string `json:"merge_status"` Subscribed bool `json:"subscribed"` UserNotesCount int `json:"user_notes_count"` SouldRemoveSourceBranch bool `json:"should_remove_source_branch"` ForceRemoveSourceBranch bool `json:"force_remove_source_branch"` Changes []struct { OldPath string `json:"old_path"` NewPath string `json:"new_path"` AMode string `json:"a_mode"` BMode string `json:"b_mode"` Diff string `json:"diff"` NewFile bool `json:"new_file"` RenamedFile bool `json:"renamed_file"` DeletedFile bool `json:"deleted_file"` } `json:"changes"` WebURL string `json:"web_url"` LastCommit struct { ID string `json:"id"` Message string `json:"message"` } `json:"last_commit"` }
MergeRequest ...
type V3 ¶
type V3 struct {
// contains filtered or unexported fields
}
V3 represents the SCM provider of API V3 GitLab.
func (*V3) CheckToken ¶
CheckToken checks whether the token has the authority of repo by trying ListRepos with the token.
func (*V3) CreateStatus ¶ added in v0.9.6
func (g *V3) CreateStatus(status c_v1alpha1.StatusPhase, targetURL, repoURL, commitSha string) error
CreateStatus generate a new status for repository.
func (*V3) CreateWebhook ¶
CreateWebhook creates webhook for specified repo.
func (*V3) DeleteWebhook ¶
DeleteWebhook deletes webhook from specified repo.
func (*V3) GetPullRequestSHA ¶ added in v0.9.6
GetPullRequestSHA gets latest commit SHA of pull request.
func (*V3) GetWebhook ¶ added in v0.9.6
GetWebhook gets webhook from specified repo.
func (*V3) ListBranches ¶
ListBranches lists the branches for specified repo. Only return first 20 branches, will not support listing all branches as v3 api has been deprecated.
func (*V3) ListDockerfiles ¶
ListDockerfiles lists the Dockerfiles for specified repo.
type V4 ¶
type V4 struct {
// contains filtered or unexported fields
}
V4 represents the SCM provider of API V4 GitLab.
func (*V4) CheckToken ¶
CheckToken checks whether the token has the authority of repo by trying ListRepos with the token.
func (*V4) CreateStatus ¶ added in v0.9.6
func (g *V4) CreateStatus(status c_v1alpha1.StatusPhase, targetURL, repoURL, commitSha string) error
CreateStatus generate a new status for repository.
func (*V4) CreateWebhook ¶
CreateWebhook creates webhook for specified repo.
func (*V4) DeleteWebhook ¶
DeleteWebhook deletes webhook from specified repo.
func (*V4) GetPullRequestSHA ¶ added in v0.9.6
GetPullRequestSHA gets latest commit SHA of pull request.
func (*V4) GetWebhook ¶ added in v0.9.6
GetWebhook gets webhook from specified repo.
func (*V4) ListBranches ¶
ListBranches lists the branches for specified repo.
func (*V4) ListDockerfiles ¶
ListDockerfiles lists the Dockerfiles for specified repo.