gitlab

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitlab implements the onair.Forge seam against the GitLab REST API. It is the first Forge, not the architecture - GitHub is a later drop-in behind the same interface.

Index

Constants

View Source
const DefaultBaseURL = "https://gitlab.com"

DefaultBaseURL is used when no self-hosted instance is configured.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an onair.Forge backed by one GitLab project. The zero value is not usable; construct with NewClient.

Its caches (resolved commits, compare counts, deployment answers) keep every answer for the client's lifetime, errors included, except a cancelled or timed-out request, which the next caller retries. A long-running host builds one Client per report, so an answer never goes stale.

func NewClient

func NewClient(baseURL, repo, token string) *Client

NewClient returns a Forge for repo ("group/project") on baseURL (empty means gitlab.com). An empty token works for public projects.

func (*Client) Behind

func (c *Client) Behind(ctx context.Context, from, to string) (int, error)

func (*Client) CommitURL

func (c *Client) CommitURL(sha string) string

func (*Client) Head

func (c *Client) Head(ctx context.Context, branch string) (onair.Ref, error)

func (*Client) Host

func (c *Client) Host() string

Host returns the instance host for display (e.g. "gitlab.com").

func (*Client) LatestGreen

func (c *Client) LatestGreen(ctx context.Context, branch string) (onair.Ref, error)

func (*Client) Recent

func (c *Client) Recent(ctx context.Context, branch string, limit int) ([]onair.Ref, error)

func (*Client) RequestURL

func (c *Client) RequestURL(id string) string

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, sha string) (onair.Ref, error)

type Deployments

type Deployments struct {
	Client      *Client
	Environment string // GitLab environment name, e.g. "production"
}

Deployments is an onair.LiveProvider that reads the deployments GitLab records for an environment: the newest successful one is Live, with Recorded confidence. It reports what CI recorded at deploy time, not what the host runs now.

func (Deployments) Live

func (d Deployments) Live(ctx context.Context) (onair.LiveInfo, error)

Jump to

Keyboard shortcuts

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