gitlab

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package gitlab provides a source implementation to integrate with GitLab via the REST API (sync) and webhooks (real-time pipeline events).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSourceConfigNotValid is returned when the source configuration is invalid.
	ErrSourceConfigNotValid = errors.New("gitlab source configuration not valid")
	// ErrWebhookConfigNotValid is returned when the webhook configuration is invalid.
	ErrWebhookConfigNotValid = errors.New("gitlab webhook configuration not valid")
)
View Source
var (
	// ErrSourceCreation is returned when the source cannot be initialised.
	ErrSourceCreation = errors.New("source creation error")
	// ErrWebhookTokenMissing is returned when no webhook token is configured.
	ErrWebhookTokenMissing = errors.New("webhook token not configured")
	// ErrSignatureMismatch is returned when the incoming webhook token does not match.
	ErrSignatureMismatch = errors.New("webhook token mismatch")
	// ErrRetrievingAssets is returned when an API listing call fails.
	ErrRetrievingAssets = errors.New("error retrieving assets")
)
View Source
var (
	// ErrIteratorDone is returned by iterator next() methods when all pages have been consumed.
	ErrIteratorDone = errors.New("iterator done")
)
View Source
var (
	// ErrNotAccessible is returned when a resource cannot be retrieved from the GitLab API.
	// This can be due to insufficient permissions or because the resource does not exist.
	ErrNotAccessible = errors.New("resource not accessible")
)

Functions

This section is empty.

Types

type Source

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

Source implements source.WebhookSource and source.SyncableSource for GitLab. It can both poll resources via the GitLab REST API and receive real-time pipeline events through a token-authenticated webhook.

func NewSource

func NewSource() (*Source, error)

NewSource constructs a Source by reading its configuration from environment variables. It returns ErrSourceCreation if either the API config or the webhook config cannot be loaded.

func (*Source) GetWebhook

func (s *Source) GetWebhook(ctx context.Context, typesToStream map[string]source.Extra, results chan<- source.Data) (source.Webhook, error)

GetWebhook returns a source.Webhook that validates incoming GitLab pipeline webhook requests using a plain-text token comparison and dispatches matching events to results asynchronously. It returns ErrWebhookTokenMissing when no token is configured.

func (*Source) StartSyncProcess

func (s *Source) StartSyncProcess(ctx context.Context, typesToSync map[string]source.Extra, results chan<- source.Data) error

StartSyncProcess performs a full synchronisation of the requested resource types by listing assets from the GitLab API and sending them to results. Supported types are "project" and "pipeline". Concurrent calls are a no-op.

Jump to

Keyboard shortcuts

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