buildkite

package
v0.2.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package buildkite implements buildrunner.BuildRunner backed by the Buildkite CI platform.

Trigger calls the Buildkite API to create the build and returns the Buildkite build number as the build ID. Status and Cancel parse the number directly from the build ID — no local state is required.

The Buildkite build receives base and head change URIs as JSON-encoded environment variables (SQ_BASE_URIS, SQ_HEAD_URIS, SQ_QUEUE). The pipeline script fetches each PR's diff with the GitHub API, applies them with `git apply -3`, produces one commit per layer (base, head), then runs CI.

Caller-supplied BuildMetadata is forwarded to the build as SQ_METADATA (JSON-encoded). Buildkite echoes env vars back on the build object, so Status recovers and returns the original metadata without any local state.

Index

Constants

View Source
const (
	// EnvKeyBaseURIs carries the JSON-encoded ordered list of change URIs from
	// the dependency batches. The pipeline script applies these first and
	// commits the result as the "base" layer.
	EnvKeyBaseURIs = "SQ_BASE_URIS"

	// EnvKeyHeadURIs carries the JSON-encoded ordered list of change URIs from
	// the batch under test. Applied on top of the base layer, committed
	// separately.
	EnvKeyHeadURIs = "SQ_HEAD_URIS"

	// EnvKeyQueue carries the SQ queue name so the pipeline script can select
	// queue-specific test targets.
	EnvKeyQueue = "SQ_QUEUE"

	// EnvKeyMetadata carries the JSON-encoded BuildMetadata provided by the
	// caller to Trigger. Buildkite echoes env vars on the build object, so
	// Status can recover and return the original metadata without local state.
	EnvKeyMetadata = "SQ_METADATA"
)

Env var keys set on every triggered Buildkite build.

Variables

This section is empty.

Functions

func NewBuildRunner

func NewBuildRunner(params Params) (buildrunner.BuildRunner, error)

NewBuildRunner constructs a Buildkite-backed BuildRunner bound to a single pipeline.

The HTTPClient must have BaseURLTransport configured to the pipeline's API root (e.g. "https://api.buildkite.com/v2/organizations/{org}/pipelines/{slug}"), and an auth transport that injects the Authorization header.

Types

type Params

type Params struct {
	// Config holds the per-queue identity for this BuildRunner.
	Config buildrunner.Config
	// HTTPClient is a pre-configured HTTP client. The caller is responsible
	// for the base URL (via platform/http.BaseURLTransport) and auth (via a
	// transport layer). If nil, http.DefaultClient is used.
	HTTPClient *http.Client
	// Resolver resolves a batch's changes (base and head batches).
	Resolver changeset.Resolver
	// Logger is the structured logger.
	Logger *zap.SugaredLogger
}

Params holds the dependencies for a Buildkite BuildRunner. The caller is responsible for configuring HTTPClient with the base URL (via platform/http.BaseURLTransport) and auth (via an Authorization-header transport).

Jump to

Keyboard shortcuts

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