gitlab

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxRetries = 3
View Source
const GITLAB_CLONE_DEPTH_ENV = "TFBUDDY_GITLAB_CLONE_DEPTH"
View Source
const MR_COMMENT_FORMAT = `
### Terraform Cloud
%s
`

Variables

This section is empty.

Functions

This section is empty.

Types

type GitlabClient

type GitlabClient struct {
	// contains filtered or unexported fields
}

func NewGitlabClient

func NewGitlabClient() *GitlabClient

func (*GitlabClient) AddMergeRequestDiscussionReply

func (c *GitlabClient) AddMergeRequestDiscussionReply(ctx context.Context, mrIID int, project, discussionID, comment string) (vcs.MRNote, error)

AddMergeRequestDiscussionReply creates a comment on the merge request.

func (*GitlabClient) CloneMergeRequest

func (c *GitlabClient) CloneMergeRequest(ctx context.Context, project string, mr vcs.MR, dest string) (vcs.GitRepo, error)

CloneMergeRequest performs a git clone of the target Gitlab project & merge request branch to the `dest` path.

func (*GitlabClient) CreateMergeRequestComment

func (c *GitlabClient) CreateMergeRequestComment(ctx context.Context, mrIID int, projectID, comment string) error

CreateMergeRequestComment creates a comment on the merge request.

func (*GitlabClient) CreateMergeRequestDiscussion

func (c *GitlabClient) CreateMergeRequestDiscussion(ctx context.Context, mrIID int, project, comment string) (vcs.MRDiscussionNotes, error)

func (*GitlabClient) GetCommitStatuses

func (c *GitlabClient) GetCommitStatuses(ctx context.Context, projectID, commitSHA string) []*gogitlab.CommitStatus

func (*GitlabClient) GetMergeRequest

func (g *GitlabClient) GetMergeRequest(ctx context.Context, mrIID int, project string) (vcs.DetailedMR, error)

func (*GitlabClient) GetMergeRequestApprovals

func (g *GitlabClient) GetMergeRequestApprovals(ctx context.Context, mrIID int, project string) (vcs.MRApproved, error)

func (*GitlabClient) GetMergeRequestModifiedFiles

func (g *GitlabClient) GetMergeRequestModifiedFiles(ctx context.Context, mrIID int, projectID string) ([]string, error)

GetMergeRequestModifiedFiles returns the names of files that were modified in the merge request relative to the repo root, e.g. parent/child/file.txt.

func (*GitlabClient) GetOldRunUrls added in v0.2.0

func (c *GitlabClient) GetOldRunUrls(ctx context.Context, mrIID int, project string, rootNoteID int) (string, error)

Crawl the comments on this MR for tfbuddy comments, grab any TFC urls out of them, and delete them.

func (*GitlabClient) GetPipelinesForCommit

func (g *GitlabClient) GetPipelinesForCommit(ctx context.Context, project, commitSHA string) ([]vcs.ProjectPipeline, error)

func (*GitlabClient) GetRepoFile

func (g *GitlabClient) GetRepoFile(ctx context.Context, project, file, ref string) ([]byte, error)

GetRepoFile retrieves a single file from a Gitlab repository using the RepositoryFiles API

func (*GitlabClient) MergeMR added in v0.3.0

func (c *GitlabClient) MergeMR(ctx context.Context, mrIID int, project string) error

func (*GitlabClient) ResolveMergeRequestDiscussion

func (c *GitlabClient) ResolveMergeRequestDiscussion(ctx context.Context, projectWithNamespace string, mrIID int, discussionID string) error

func (*GitlabClient) ResolveMergeRequestDiscussionReply

func (c *GitlabClient) ResolveMergeRequestDiscussionReply(ctx context.Context, mrIID int, project, discussionID string, resolved bool) error

ResolveMergeRequestDiscussionReply marks a discussion thread as resolved / unresolved.

func (*GitlabClient) SetCommitStatus

func (c *GitlabClient) SetCommitStatus(ctx context.Context, projectWithNS string, commitSHA string, status vcs.CommitStatusOptions) (vcs.CommitStatus, error)

func (*GitlabClient) UpdateMergeRequestDiscussionNote

func (c *GitlabClient) UpdateMergeRequestDiscussionNote(ctx context.Context, mrIID, noteID int, project, discussionID, comment string) (vcs.MRNote, error)

type GitlabCommitStatus

type GitlabCommitStatus struct {
	*gogitlab.CommitStatus
}

func (*GitlabCommitStatus) Info

func (gS *GitlabCommitStatus) Info() string

type GitlabCommitStatusOptions

type GitlabCommitStatusOptions struct {
	*gogitlab.SetCommitStatusOptions
}

func (*GitlabCommitStatusOptions) GetContext

func (gO *GitlabCommitStatusOptions) GetContext() string

func (*GitlabCommitStatusOptions) GetDescription

func (gO *GitlabCommitStatusOptions) GetDescription() string

func (*GitlabCommitStatusOptions) GetName

func (gO *GitlabCommitStatusOptions) GetName() string

func (*GitlabCommitStatusOptions) GetPipelineID

func (gO *GitlabCommitStatusOptions) GetPipelineID() int

func (*GitlabCommitStatusOptions) GetState

func (gO *GitlabCommitStatusOptions) GetState() string

func (*GitlabCommitStatusOptions) GetTargetURL

func (gO *GitlabCommitStatusOptions) GetTargetURL() string

type GitlabMR

type GitlabMR struct {
	*gogitlab.MergeRequest
}

func (*GitlabMR) GetAuthor

func (gm *GitlabMR) GetAuthor() vcs.MRAuthor

func (*GitlabMR) GetInternalID

func (gm *GitlabMR) GetInternalID() int

func (*GitlabMR) GetSourceBranch

func (gm *GitlabMR) GetSourceBranch() string

func (*GitlabMR) GetTargetBranch

func (gm *GitlabMR) GetTargetBranch() string

func (*GitlabMR) GetTitle

func (gm *GitlabMR) GetTitle() string

func (*GitlabMR) GetWebURL

func (gm *GitlabMR) GetWebURL() string

func (*GitlabMR) HasConflicts

func (gm *GitlabMR) HasConflicts() bool

type GitlabMRApproval

type GitlabMRApproval struct {
	*gogitlab.MergeRequestApprovals
}

func (*GitlabMRApproval) IsApproved

func (gm *GitlabMRApproval) IsApproved() bool

type GitlabMRAuthor

type GitlabMRAuthor struct {
	*gogitlab.BasicUser
}

func (*GitlabMRAuthor) GetUsername

func (ga *GitlabMRAuthor) GetUsername() string

type GitlabMRDiscussion

type GitlabMRDiscussion struct {
	*gogitlab.Discussion
}

func (*GitlabMRDiscussion) GetDiscussionID

func (gd *GitlabMRDiscussion) GetDiscussionID() string

func (*GitlabMRDiscussion) GetMRNotes

func (gd *GitlabMRDiscussion) GetMRNotes() []vcs.MRNote

type GitlabMRNote

type GitlabMRNote struct {
	*gogitlab.Note
}

func (*GitlabMRNote) GetNoteID

func (gn *GitlabMRNote) GetNoteID() int64

type GitlabMergeCommentEvent

type GitlabMergeCommentEvent struct {
	*gogitlab.MergeCommentEvent
}

func (*GitlabMergeCommentEvent) GetAttributes

func (gE *GitlabMergeCommentEvent) GetAttributes() vcs.MRAttributes

func (*GitlabMergeCommentEvent) GetAuthor

func (gE *GitlabMergeCommentEvent) GetAuthor() vcs.MRAuthor

func (*GitlabMergeCommentEvent) GetDiscussionID

func (gE *GitlabMergeCommentEvent) GetDiscussionID() string

func (*GitlabMergeCommentEvent) GetInternalID

func (gE *GitlabMergeCommentEvent) GetInternalID() int

func (*GitlabMergeCommentEvent) GetLastCommit

func (gE *GitlabMergeCommentEvent) GetLastCommit() vcs.Commit

func (*GitlabMergeCommentEvent) GetMR

func (gE *GitlabMergeCommentEvent) GetMR() vcs.MR

func (*GitlabMergeCommentEvent) GetNote

func (gE *GitlabMergeCommentEvent) GetNote() string

func (*GitlabMergeCommentEvent) GetPathWithNamespace

func (gE *GitlabMergeCommentEvent) GetPathWithNamespace() string

func (*GitlabMergeCommentEvent) GetProject

func (gE *GitlabMergeCommentEvent) GetProject() vcs.Project

func (*GitlabMergeCommentEvent) GetSHA

func (gE *GitlabMergeCommentEvent) GetSHA() string

func (*GitlabMergeCommentEvent) GetSourceBranch

func (gE *GitlabMergeCommentEvent) GetSourceBranch() string

func (*GitlabMergeCommentEvent) GetTargetBranch

func (gE *GitlabMergeCommentEvent) GetTargetBranch() string

func (*GitlabMergeCommentEvent) GetType

func (gE *GitlabMergeCommentEvent) GetType() string

func (*GitlabMergeCommentEvent) GetUsername

func (gE *GitlabMergeCommentEvent) GetUsername() string

type GitlabPipeline

type GitlabPipeline struct {
	*gogitlab.PipelineInfo
}

func (*GitlabPipeline) GetID

func (gP *GitlabPipeline) GetID() int

func (*GitlabPipeline) GetSource

func (gP *GitlabPipeline) GetSource() string

type RunStatusUpdater

type RunStatusUpdater struct {
	// contains filtered or unexported fields
}

func NewRunStatusProcessor

func NewRunStatusProcessor(client *GitlabClient, rs runstream.StreamClient, tfc tfc_api.ApiClient) *RunStatusUpdater

func (*RunStatusUpdater) Close

func (p *RunStatusUpdater) Close()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL