gitlab

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package gitlab adapts the GitLab REST client to the host-neutral provider.Provider interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitLab

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

GitLab is the provider.Provider implementation for GitLab instances.

func New

func New(cfg *config.Config) (*GitLab, error)

New returns a provider bound to cfg.GitLabURL/cfg.Token.

func (*GitLab) ApproveMergeRequest

func (g *GitLab) ApproveMergeRequest(ctx context.Context, project string, iid int) error

ApproveMergeRequest records an approval via the GitLab approvals API.

func (*GitLab) CancelPipeline added in v0.4.0

func (g *GitLab) CancelPipeline(ctx context.Context, project string, id int) error

CancelPipeline cancels a running pipeline.

func (*GitLab) CloseWorkItem added in v0.4.0

func (g *GitLab) CloseWorkItem(ctx context.Context, project string, id int) error

CloseWorkItem closes a work item via the GitLab REST endpoint.

func (*GitLab) CreateGroupEpic

func (g *GitLab) CreateGroupEpic(ctx context.Context, groupID int, opts provider.CreateEpicOptions) (provider.Epic, error)

CreateGroupEpic creates a new epic in the given group.

func (*GitLab) CreateGroupMilestone

func (g *GitLab) CreateGroupMilestone(ctx context.Context, groupID int, opts provider.CreateMilestoneOptions) (provider.Milestone, error)

CreateGroupMilestone creates a new milestone in the given group.

func (*GitLab) CreateIssue

func (g *GitLab) CreateIssue(ctx context.Context, project string, opts provider.CreateIssueOptions) (provider.Issue, error)

CreateIssue creates a new issue in the given project.

func (*GitLab) CreateIssueNote

func (g *GitLab) CreateIssueNote(ctx context.Context, project string, iid int, body string) (provider.Note, error)

CreateIssueNote adds a note (comment) to an issue.

func (*GitLab) CreateLabel

func (g *GitLab) CreateLabel(ctx context.Context, project string, opts provider.CreateLabelOptions) (provider.Label, error)

CreateLabel creates a new label in the given project.

func (*GitLab) CreateMergeRequest

func (g *GitLab) CreateMergeRequest(ctx context.Context, project string, opts provider.CreateMergeRequestOptions) (provider.MergeRequest, error)

CreateMergeRequest creates a new merge request in the given project.

func (*GitLab) CreateMilestone added in v0.4.0

func (g *GitLab) CreateMilestone(ctx context.Context, project string, opts provider.CreateMilestoneOptions) (provider.Milestone, error)

CreateMilestone creates a new project-scoped milestone.

func (*GitLab) CreateWorkItem added in v0.4.0

func (g *GitLab) CreateWorkItem(ctx context.Context, project string, opts provider.CreateWorkItemOptions) (provider.WorkItem, error)

CreateWorkItem creates a work item via the GitLab REST endpoint.

func (*GitLab) DownloadArtifact added in v0.4.0

func (g *GitLab) DownloadArtifact(ctx context.Context, project string, jobID int, destDir string) error

DownloadArtifact downloads a single artifact by job ID to destDir.

func (*GitLab) GetIssue

func (g *GitLab) GetIssue(ctx context.Context, project string, iid int) (provider.Issue, error)

GetIssue retrieves a single issue by IID.

func (*GitLab) GetJobLogs added in v0.4.0

func (g *GitLab) GetJobLogs(ctx context.Context, project string, jobID int) (string, error)

GetJobLogs returns the trace (log output) for a single CI/CD job.

func (*GitLab) GetMergeRequest

func (g *GitLab) GetMergeRequest(ctx context.Context, project string, iid int) (provider.MergeRequest, error)

GetMergeRequest retrieves a single merge request by IID.

func (*GitLab) GetMergeRequestDiff

func (g *GitLab) GetMergeRequestDiff(ctx context.Context, project string, iid int) ([]provider.FileDiff, error)

GetMergeRequestDiff returns the per-file changes of a merge request.

func (*GitLab) GetMilestone added in v0.4.0

func (g *GitLab) GetMilestone(ctx context.Context, project string, id int) (provider.Milestone, error)

GetMilestone returns a single project-scoped milestone by ID.

func (*GitLab) GetPipeline added in v0.4.0

func (g *GitLab) GetPipeline(ctx context.Context, project string, id int) (provider.Pipeline, error)

GetPipeline returns a single CI/CD pipeline.

func (*GitLab) GetProject added in v0.4.0

func (g *GitLab) GetProject(ctx context.Context, project string) (provider.Project, error)

GetProject fetches project metadata via the GitLab projects API.

func (*GitLab) Host

func (g *GitLab) Host() string

Host returns the bare host parsed from cfg.GitLabURL.

func (*GitLab) Kind

func (g *GitLab) Kind() provider.Kind

Kind returns provider.KindGitLab.

func (*GitLab) LinkIssueToEpic

func (g *GitLab) LinkIssueToEpic(ctx context.Context, groupID, epicIID, issueID int) error

LinkIssueToEpic assigns a project issue, addressed by global issue ID, to a group epic addressed by IID.

func (*GitLab) ListArtifacts added in v0.4.0

func (g *GitLab) ListArtifacts(ctx context.Context, project string, pipelineID int) ([]provider.Artifact, error)

ListArtifacts returns artifacts for a given pipeline.

func (*GitLab) ListEpicIssues added in v0.4.0

func (g *GitLab) ListEpicIssues(ctx context.Context, groupID int, epicIID int) ([]provider.Issue, error)

ListEpicIssues lists issues linked to a group epic.

func (*GitLab) ListGroupEpics

func (g *GitLab) ListGroupEpics(ctx context.Context, groupID int, opts provider.ListGroupEpicsOptions) ([]provider.Epic, error)

ListGroupEpics returns epics for the given group.

func (*GitLab) ListGroupMilestones

func (g *GitLab) ListGroupMilestones(ctx context.Context, groupID int, opts provider.ListGroupMilestonesOptions) ([]provider.Milestone, error)

ListGroupMilestones returns milestones for the given group.

func (*GitLab) ListIssues

func (g *GitLab) ListIssues(ctx context.Context, project string, opts provider.ListIssuesOptions) ([]provider.Issue, error)

ListIssues calls the GitLab list project issues API.

func (*GitLab) ListLabels

func (g *GitLab) ListLabels(ctx context.Context, project string) ([]provider.Label, error)

ListLabels retrieves all labels for the given project.

func (*GitLab) ListMergeRequests

func (g *GitLab) ListMergeRequests(ctx context.Context, project string, opts provider.ListMergeRequestsOptions) ([]provider.MergeRequest, error)

ListMergeRequests calls the GitLab list project merge requests API.

func (*GitLab) ListMilestones added in v0.3.0

func (g *GitLab) ListMilestones(ctx context.Context, project string, opts provider.ListMilestonesOptions) ([]provider.Milestone, error)

ListMilestones returns project-scoped milestones for the given project.

func (*GitLab) ListMyIssues

func (g *GitLab) ListMyIssues(ctx context.Context, opts provider.ListMyIssuesOptions) ([]provider.Issue, error)

ListMyIssues lists issues assigned to the authenticated user across all projects, using the GitLab cross-project "assigned_to_me" scope. Each issue's project path is recovered from its full reference.

func (*GitLab) ListMyMergeRequests

func (g *GitLab) ListMyMergeRequests(ctx context.Context, opts provider.ListMyMergeRequestsOptions) ([]provider.MergeRequest, error)

ListMyMergeRequests lists MRs assigned to the authenticated user across all projects via the cross-project "assigned_to_me" scope.

func (*GitLab) ListPipelineJobs added in v0.4.0

func (g *GitLab) ListPipelineJobs(ctx context.Context, project string, pipelineID int) ([]provider.Job, error)

ListPipelineJobs returns jobs for a given pipeline.

func (*GitLab) ListPipelines added in v0.4.0

func (g *GitLab) ListPipelines(ctx context.Context, project string, opts provider.ListPipelinesOptions) ([]provider.Pipeline, error)

ListPipelines returns CI/CD pipelines for the given project.

func (*GitLab) ListUsers

func (g *GitLab) ListUsers(ctx context.Context, opts provider.ListUsersOptions) ([]provider.User, error)

ListUsers searches users via the GitLab list users API.

func (*GitLab) ListWorkItems added in v0.4.0

func (g *GitLab) ListWorkItems(ctx context.Context, project string, opts provider.ListWorkItemsOptions) ([]provider.WorkItem, error)

ListWorkItems calls the GitLab work items REST endpoint. Requires GitLab 15.1+ with work_items feature flag enabled.

func (*GitLab) MergeMergeRequest

func (g *GitLab) MergeMergeRequest(ctx context.Context, project string, iid int, opts provider.MergeOptions) (provider.MergeRequest, error)

MergeMergeRequest accepts (merges) a merge request.

func (*GitLab) ResolveGroup added in v0.3.0

func (g *GitLab) ResolveGroup(ctx context.Context, groupPath string) (int, error)

ResolveGroup resolves a group path (e.g. "my-org/sub-group") to its numeric ID.

func (*GitLab) RetryPipeline added in v0.4.0

func (g *GitLab) RetryPipeline(ctx context.Context, project string, id int) (provider.Pipeline, error)

RetryPipeline retries a failed pipeline.

func (*GitLab) RunPipeline added in v0.4.0

func (g *GitLab) RunPipeline(ctx context.Context, project string, opts provider.RunPipelineOptions) (provider.Pipeline, error)

RunPipeline triggers a new CI/CD pipeline.

func (*GitLab) UpdateGroupEpic added in v0.4.0

func (g *GitLab) UpdateGroupEpic(ctx context.Context, groupID int, epicIID int, opts provider.UpdateEpicOptions) (provider.Epic, error)

UpdateGroupEpic updates an existing epic in the given group.

func (*GitLab) UpdateIssue

func (g *GitLab) UpdateIssue(ctx context.Context, project string, iid int, opts provider.UpdateIssueOptions) (provider.Issue, error)

UpdateIssue applies a partial update to an existing issue. The neutral State is translated to GitLab's state_event verb (close/reopen).

func (*GitLab) UpdateMergeRequest

func (g *GitLab) UpdateMergeRequest(ctx context.Context, project string, iid int, opts provider.UpdateMergeRequestOptions) (provider.MergeRequest, error)

UpdateMergeRequest applies a partial update to an existing merge request. The neutral State is translated to GitLab's state_event verb (close/reopen).

func (*GitLab) UpdateMilestone added in v0.4.0

func (g *GitLab) UpdateMilestone(ctx context.Context, project string, id int, opts provider.UpdateMilestoneOptions) (provider.Milestone, error)

UpdateMilestone updates an existing project-scoped milestone.

Jump to

Keyboard shortcuts

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