gitlab

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package gitlab implements providers.Provider for GitLab CI.

GitLab CI uses a fundamentally different runner model than GitHub:

  • Runners are persistent and poll for jobs (no JIT registration)
  • gitlab-runner supports a "custom executor" model where external scripts handle prepare/run/cleanup — this is the integration path
  • Job image is a first-class field in .gitlab-ci.yml (no YAML fetch needed)
  • Tags instead of labels for runner matching
  • Webhook verification uses a shared token header, not HMAC-SHA256

Integration strategy (custom executor):

  • ephemerd manages a gitlab-runner process in custom executor mode
  • gitlab-runner handles registration, polling, and job protocol
  • On job arrival, gitlab-runner calls ephemerd's prepare script: ephemerd creates a container and returns the exec environment
  • gitlab-runner calls run script: executes job steps in the container
  • gitlab-runner calls cleanup script: ephemerd destroys the container

This means ephemerd does NOT poll GitLab directly — gitlab-runner does. The custom executor scripts bridge gitlab-runner into ephemerd's container lifecycle.

Reference:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// InstanceURL is the base URL of the GitLab instance (e.g., "https://gitlab.com").
	InstanceURL string

	// Token is the runner registration token from GitLab.
	// Found at: Settings > CI/CD > Runners > New project runner.
	// For GitLab 16+, this is a runner authentication token (glrt-xxx).
	Token string

	// Tags are the runner tags used for job matching in .gitlab-ci.yml.
	// GitLab dispatches jobs to runners whose tags match the job's tags: field.
	Tags []string

	// LinuxImage / WindowsImage override the runner image per job OS.
	// Empty values fall through to the built-in default
	// ("ghcr.io/ephpm/runner-gitlab:latest" for Linux) and (Windows) the
	// runtime's host-matched servercore default.
	LinuxImage   string
	WindowsImage string

	Log *slog.Logger
}

Config for the GitLab provider.

type Provider

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

Provider implements providers.Provider for GitLab CI.

func New

func New(cfg Config) (*Provider, error)

New creates a GitLab provider.

func (*Provider) ClaimJob

func (p *Provider) ClaimJob(ctx context.Context, event *providers.JobEvent, runnerName string, labels []string) (*providers.Claim, error)

func (*Provider) DefaultImage

func (p *Provider) DefaultImage() string

func (*Provider) DefaultImageFor

func (p *Provider) DefaultImageFor(os string) string

DefaultImageFor returns the runner image for the given job OS.

func (*Provider) DefaultJobImage

func (p *Provider) DefaultJobImage() string

func (*Provider) FetchJobImage

func (p *Provider) FetchJobImage(ctx context.Context, event *providers.JobEvent) string

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) ReleaseJob

func (p *Provider) ReleaseJob(ctx context.Context, claim *providers.Claim) error

func (*Provider) Start

func (p *Provider) Start(ctx context.Context, cfg providers.PollConfig) (<-chan providers.JobEvent, error)

func (*Provider) Stop

func (p *Provider) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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