Help us shape the future of Go! Take the 2026 Go Developer Survey

gitlab

package
v0.0.0-...-e5aad21 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package gitlab is the GitLab provider: Provider implements scm.Provider on top of the GitLab REST API (gitlab.com/gitlab-org/api/client-go).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectivityCheck

func ConnectivityCheck() error

ConnectivityCheck confirms the token works by resolving its user (GET /user).

Types

type Provider

type Provider struct{}

Provider implements argo-diff's provider primitives on top of the GitLab API. It holds no state: the client is a package var built in init(), which tests swap for an httptest-backed one.

func (Provider) ConnectivityCheck

func (Provider) ConnectivityCheck() error

func (Provider) CreateComment

func (Provider) CreateComment(ctx context.Context, repo scm.RepoRef, num int, body string) (scm.Comment, error)

func (Provider) CredentialsHint

func (Provider) CredentialsHint() string

CredentialsHint names the variable that enables this provider.

func (Provider) CurrentUser

func (Provider) CurrentUser(ctx context.Context) (string, error)

CurrentUser returns the username notes are posted as. With the gitlab connectivity check bypassed it returns "", so notes are matched by marker alone, as the GitHub provider does with its bypass.

func (Provider) DetectCI

func (Provider) DetectCI() bool

DetectCI is false until GitLab CI support lands (issue #160, Phase 3).

func (Provider) Dialect

func (Provider) Dialect() comment.Dialect

func (Provider) Enabled

func (Provider) Enabled() bool

Enabled reports whether GITLAB_TOKEN is set.

func (Provider) EventFromCIEnv

func (Provider) EventFromCIEnv() (webhook.EventInfo, error)

EventFromCIEnv is not supported yet; DetectCI() never selects it.

func (Provider) GetChangeRequest

func (Provider) GetChangeRequest(ctx context.Context, repo scm.RepoRef, num int) (scm.ChangeRequest, error)

GetChangeRequest fetches merge request num (its IID) of repo. A field the API did not return is left empty; see scm.ChangeRequest.

func (Provider) ListChangedFiles

func (Provider) ListChangedFiles(ctx context.Context, repo scm.RepoRef, num int) ([]string, error)

ListChangedFiles returns every path merge request num touches, across all pages of its diffs. A renamed file contributes both its old and its new path, so a manifest-generate-paths filter sees either.

func (Provider) ListComments

func (Provider) ListComments(ctx context.Context, repo scm.RepoRef, num int) ([]scm.Comment, error)

ListComments returns every user note on merge request num, oldest first, across all pages. System notes ("added 1 commit", ...) are left out.

func (Provider) Name

func (Provider) Name() string

func (Provider) RepoHosts

func (Provider) RepoHosts() []string

RepoHosts is the configured instance's host, plus its relative URL root if it has one (eg: "example.com/gitlab"), for matching ArgoCD application sources.

func (Provider) SetStatus

func (Provider) SetStatus(ctx context.Context, repo scm.RepoRef, sha string, state scm.Status, description string, dryRun bool) error

SetStatus sets the argo-diff commit status on sha. dryRun (dev mode) logs instead of calling the API.

func (Provider) UpdateComment

func (Provider) UpdateComment(ctx context.Context, repo scm.RepoRef, num int, id int64, body string) (scm.Comment, error)

UpdateComment replaces the body of note id on merge request num. GitLab addresses notes through their MR.

func (Provider) ValidateConfig

func (Provider) ValidateConfig() error

ValidateConfig builds the API client, reporting why it cannot be built (eg: a malformed GITLAB_BASE_URL or an unreadable CA file). cmd/main.go calls it once at startup, only when gitlab is enabled.

func (Provider) WebhookHandler

func (Provider) WebhookHandler() scm.WebhookHandler

type WebhookHandler

type WebhookHandler struct{}

WebhookHandler is a placeholder until GitLab webhook support lands (issue #160, Phase 4). No route serves GitLab webhooks yet; should one reach it, Verify() rejects the request.

func (WebhookHandler) CheckConfig

func (WebhookHandler) CheckConfig() error

CheckConfig warns that GitLab merge requests can only be processed from event files (-f) or /dev for now. It does not fail, so a server with GITLAB_TOKEN set still starts for GitHub.

func (WebhookHandler) EventName

func (WebhookHandler) EventName(h http.Header) string

func (WebhookHandler) Parse

func (WebhookHandler) Parse(h http.Header, _ []byte) (scm.WebhookEvent, error)

func (WebhookHandler) Verify

func (WebhookHandler) Verify(http.Header, []byte) error

Jump to

Keyboard shortcuts

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