Documentation
¶
Index ¶
- Constants
- type API
- type Client
- type CommentService
- type CommitsService
- type Config
- type GitLab
- func (g *GitLab) AddMergeRequestLabels(labels *[]string, mergeRequest int) (gitlab.Labels, error)
- func (g *GitLab) CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, ...) (*gitlab.Note, *gitlab.Response, error)
- func (g *GitLab) GetCommit(sha string, options ...gitlab.RequestOptionFunc) (*gitlab.Commit, *gitlab.Response, error)
- func (g *GitLab) GetLabel(labelName string, options ...gitlab.RequestOptionFunc) (*gitlab.Label, *gitlab.Response, error)
- func (g *GitLab) GetMergeRequest(mergeRequest int, opt *gitlab.GetMergeRequestsOptions, ...) (*gitlab.MergeRequest, *gitlab.Response, error)
- func (g *GitLab) ListMergeRequestLabels(mergeRequest int, opt *gitlab.GetMergeRequestsOptions, ...) (gitlab.Labels, error)
- func (g *GitLab) ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, ...) ([]*gitlab.Note, *gitlab.Response, error)
- func (g *GitLab) ListMergeRequestsByCommit(sha string, options ...gitlab.RequestOptionFunc) ([]*gitlab.MergeRequest, *gitlab.Response, error)
- func (g *GitLab) PostCommitComment(sha string, opt *gitlab.PostCommitCommentOptions, ...) (*gitlab.CommitComment, *gitlab.Response, error)
- func (g *GitLab) RemoveMergeRequestLabels(labels *[]string, mergeRequest int) (gitlab.Labels, error)
- func (g *GitLab) UpdateLabel(opt *gitlab.UpdateLabelOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Label, *gitlab.Response, error)
- func (g *GitLab) UpdateMergeRequest(mergeRequest int, opt *gitlab.UpdateMergeRequestOptions, ...) (*gitlab.MergeRequest, *gitlab.Response, error)
- func (g *GitLab) UpdateMergeRequestNote(mergeRequest, note int, opt *gitlab.UpdateMergeRequestNoteOptions, ...) (*gitlab.Note, *gitlab.Response, error)
- type MergeRequest
- type NotifyService
- type PostOptions
- type ResultLabels
Constants ¶
const EnvBaseURL = "GITLAB_BASE_URL"
EnvBaseURL is GitLab base URL. This can be set to a domain endpoint to use with Private GitLab.
const EnvToken = "GITLAB_TOKEN"
EnvToken is GitLab API Token
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Note, *gitlab.Response, error)
UpdateMergeRequestNote(mergeRequest, note int, opt *gitlab.UpdateMergeRequestNoteOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Note, *gitlab.Response, error)
ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Note, *gitlab.Response, error)
GetMergeRequest(mergeRequest int, opt *gitlab.GetMergeRequestsOptions, options ...gitlab.RequestOptionFunc) (*gitlab.MergeRequest, *gitlab.Response, error)
UpdateMergeRequest(mergeRequest int, opt *gitlab.UpdateMergeRequestOptions, options ...gitlab.RequestOptionFunc) (*gitlab.MergeRequest, *gitlab.Response, error)
PostCommitComment(sha string, opt *gitlab.PostCommitCommentOptions, options ...gitlab.RequestOptionFunc) (*gitlab.CommitComment, *gitlab.Response, error)
AddMergeRequestLabels(labels *[]string, mergeRequest int) (gitlab.Labels, error)
RemoveMergeRequestLabels(labels *[]string, mergeRequest int) (gitlab.Labels, error)
ListMergeRequestLabels(mergeRequest int, opt *gitlab.GetMergeRequestsOptions, options ...gitlab.RequestOptionFunc) (gitlab.Labels, error)
GetLabel(labelName string, options ...gitlab.RequestOptionFunc) (*gitlab.Label, *gitlab.Response, error)
UpdateLabel(opt *gitlab.UpdateLabelOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Label, *gitlab.Response, error)
GetCommit(sha string, options ...gitlab.RequestOptionFunc) (*gitlab.Commit, *gitlab.Response, error)
ListMergeRequestsByCommit(sha string, options ...gitlab.RequestOptionFunc) ([]*gitlab.MergeRequest, *gitlab.Response, error)
}
API is GitLab API interface
type Client ¶
type Client struct {
*gitlab.Client
Debug bool
Config Config
Comment *CommentService
Commits *CommitsService
Notify *NotifyService
API API
// contains filtered or unexported fields
}
Client ...
type CommentService ¶
type CommentService service
CommentService handles communication with the comment related methods of GitLab API
func (*CommentService) List ¶
func (g *CommentService) List(number int) ([]*gitlab.Note, error)
List lists comments on GitLab merge requests
func (*CommentService) Patch ¶
func (g *CommentService) Patch(note int, body string, opt PostOptions) error
Patch patches on the specific comment
func (*CommentService) Post ¶
func (g *CommentService) Post(body string, opt PostOptions) error
Post posts comment
type CommitsService ¶
type CommitsService service
CommitsService handles communication with the commits related methods of GitLab API
func (*CommitsService) ListMergeRequestIIDsByRevision ¶ added in v0.2.0
func (g *CommitsService) ListMergeRequestIIDsByRevision(revision string) ([]int, error)
type Config ¶
type Config struct {
Token string
BaseURL string
NameSpace string
Project string
MR MergeRequest
CI string
Parser terraform.Parser
// Template is used for all Terraform command output
Template *terraform.Template
ParseErrorTemplate *terraform.Template
// ResultLabels is a set of labels to apply depending on the plan result
ResultLabels ResultLabels
Vars map[string]string
EmbeddedVarNames []string
Templates map[string]string
UseRawOutput bool
Patch bool
SkipNoChanges bool
}
Config is a configuration for GitLab client
type GitLab ¶
GitLab represents the attribute information necessary for requesting GitLab API
func (*GitLab) AddMergeRequestLabels ¶
AddMergeRequestLabels adds labels on the merge request.
func (*GitLab) CreateMergeRequestNote ¶
func (g *GitLab) CreateMergeRequestNote(mergeRequest int, opt *gitlab.CreateMergeRequestNoteOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Note, *gitlab.Response, error)
CreateMergeRequestNote is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.CreateMergeRequestNote
func (*GitLab) GetCommit ¶
func (g *GitLab) GetCommit(sha string, options ...gitlab.RequestOptionFunc) (*gitlab.Commit, *gitlab.Response, error)
GetCommit is a wrapper of https://pkg.go.dev/github.com/xanzy/go-gitlab#CommitsService.GetCommit
func (*GitLab) GetLabel ¶
func (g *GitLab) GetLabel(labelName string, options ...gitlab.RequestOptionFunc) (*gitlab.Label, *gitlab.Response, error)
GetLabel is a wrapper of https://pkg.go.dev/github.com/xanzy/go-gitlab#LabelsService.GetLabel
func (*GitLab) GetMergeRequest ¶
func (g *GitLab) GetMergeRequest(mergeRequest int, opt *gitlab.GetMergeRequestsOptions, options ...gitlab.RequestOptionFunc) (*gitlab.MergeRequest, *gitlab.Response, error)
GetMergerRequest is a wrapper of https://pkg.go.dev/github.com/xanzy/go-gitlab#MergeRequestsService.GetMergeRequest
func (*GitLab) ListMergeRequestLabels ¶
func (g *GitLab) ListMergeRequestLabels(mergeRequest int, opt *gitlab.GetMergeRequestsOptions, options ...gitlab.RequestOptionFunc) (gitlab.Labels, error)
ListMergeRequestLabels lists labels on the merger request
func (*GitLab) ListMergeRequestNotes ¶
func (g *GitLab) ListMergeRequestNotes(mergeRequest int, opt *gitlab.ListMergeRequestNotesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.Note, *gitlab.Response, error)
ListMergeRequestNotes is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#NotesService.ListMergeRequestNotes
func (*GitLab) ListMergeRequestsByCommit ¶ added in v0.2.0
func (g *GitLab) ListMergeRequestsByCommit(sha string, options ...gitlab.RequestOptionFunc) ([]*gitlab.MergeRequest, *gitlab.Response, error)
func (*GitLab) PostCommitComment ¶
func (g *GitLab) PostCommitComment(sha string, opt *gitlab.PostCommitCommentOptions, options ...gitlab.RequestOptionFunc) (*gitlab.CommitComment, *gitlab.Response, error)
PostCommitComment is a wrapper of https://godoc.org/github.com/xanzy/go-gitlab#CommitsService.PostCommitComment
func (*GitLab) RemoveMergeRequestLabels ¶
func (g *GitLab) RemoveMergeRequestLabels(labels *[]string, mergeRequest int) (gitlab.Labels, error)
RemoveMergeRequestLabels removes labels on the merge request.
func (*GitLab) UpdateLabel ¶
func (g *GitLab) UpdateLabel(opt *gitlab.UpdateLabelOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Label, *gitlab.Response, error)
UpdateLabel is a wrapper of https://pkg.go.dev/github.com/xanzy/go-gitlab#LabelsService.UpdateLabel
func (*GitLab) UpdateMergeRequest ¶
func (g *GitLab) UpdateMergeRequest(mergeRequest int, opt *gitlab.UpdateMergeRequestOptions, options ...gitlab.RequestOptionFunc) (*gitlab.MergeRequest, *gitlab.Response, error)
UpdateMergerRequest is a wrapper of https://pkg.go.dev/github.com/xanzy/go-gitlab#MergeRequestsService.UpdateMergeRequest
func (*GitLab) UpdateMergeRequestNote ¶
func (g *GitLab) UpdateMergeRequestNote(mergeRequest, note int, opt *gitlab.UpdateMergeRequestNoteOptions, options ...gitlab.RequestOptionFunc) (*gitlab.Note, *gitlab.Response, error)
UpdateMergeRequestNote is a wrapper of https://pkg.go.dev/github.com/xanzy/go-gitlab#NotesService.UpdateMergeRequestNote
type MergeRequest ¶
MergeRequest represents GitLab Merge Request metadata
func (*MergeRequest) IsNumber ¶
func (mr *MergeRequest) IsNumber() bool
IsNumber returns true if MergeRequest is Merge Request build
type NotifyService ¶
type NotifyService service
NotifyService handles communication with the notification related methods of GitLab API
type PostOptions ¶
PostOptions specifies the optional parameters to post comments to a pull request
type ResultLabels ¶
type ResultLabels struct {
AddOrUpdateLabel string
DestroyLabel string
NoChangesLabel string
PlanErrorLabel string
AddOrUpdateLabelColor string
DestroyLabelColor string
NoChangesLabelColor string
PlanErrorLabelColor string
}
ResultLabels represents the labels to add to the PR depending on the plan result
func (*ResultLabels) HasAnyLabelDefined ¶
func (r *ResultLabels) HasAnyLabelDefined() bool
HasAnyLabelDefined returns true if any of the internal labels are set
func (*ResultLabels) IsResultLabel ¶
func (r *ResultLabels) IsResultLabel(label string) bool
IsResultLabel returns true if a label matches any of the internal labels