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:
- Custom executor docs: https://docs.gitlab.com/runner/executors/custom.html
- Runner registration API: https://docs.gitlab.com/ee/api/runners.html
- Job hooks: https://docs.gitlab.com/ee/administration/system_hooks.html
Index ¶
- type Config
- type Provider
- func (p *Provider) ClaimJob(ctx context.Context, event *providers.JobEvent, runnerName string, ...) (*providers.Claim, error)
- func (p *Provider) DefaultImage() string
- func (p *Provider) DefaultImageFor(os string) string
- func (p *Provider) DefaultJobImage() string
- func (p *Provider) FetchJobImage(ctx context.Context, event *providers.JobEvent) string
- func (p *Provider) Name() string
- func (p *Provider) ReleaseJob(ctx context.Context, claim *providers.Claim) error
- func (p *Provider) Start(ctx context.Context, cfg providers.PollConfig) (<-chan providers.JobEvent, error)
- func (p *Provider) Stop(ctx context.Context) error
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 (*Provider) DefaultImage ¶
func (*Provider) DefaultImageFor ¶
DefaultImageFor returns the runner image for the given job OS.
func (*Provider) DefaultJobImage ¶
func (*Provider) FetchJobImage ¶
func (*Provider) ReleaseJob ¶
Click to show internal directories.
Click to hide internal directories.