buildkite

package module
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: BSD-2-Clause Imports: 22 Imported by: 6

README

buildkite-go Go Reference Build status

A Go library and client for the Buildkite API. This project draws a lot of its structure and testing methods from go-github.

Usage

To get the package, execute:

go get github.com/buildkite/go-buildkite/v4

Simple shortened example for listing all pipelines:

import (
    "github.com/buildkite/go-buildkite/v4"
    "gopkg.in/alecthomas/kingpin.v2"
)

var (
    apiToken = kingpin.Flag("token", "API token").Required().String()
    org = kingpin.Flag("org", "Organization slug").Required().String()
)

client, err := buildkite.NewOpts(buildkite.WithTokenAuth(*apiToken))

if err != nil {
	log.Fatalf("client config failed: %s", err)
}

pipelines, _, err := client.Pipelines.List(*org, nil)

See the examples directory for additional examples.

Note: not all API features are supported by go-buildkite just yet. If you need a feature, please make an issue or submit a pull request.

Releasing

  1. Update the version number in version.go
  2. Generate a changelog using ghch: ghch --format=markdown --next-version=v<next-version-number>, and update it in CHANGELOG.md
  3. Commit and tag the new version
  4. Create a matching GitHub release

License

This library is distributed under the BSD-style license found in the LICENSE file.

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL   = "https://api.buildkite.com/"
	DefaultUserAgent = "go-buildkite/" + Version
)
View Source
const (
	// EventTypeHeader is the Buildkite header key used to pass the event type
	EventTypeHeader = "X-Buildkite-Event"
	// SignatureHeader is the Buildkite header key used to pass the HMAC hexdigest.
	SignatureHeader = "X-Buildkite-Signature"
)
View Source
const BuildKiteDateFormat = time.RFC3339Nano

BuildKiteDateFormat is the format of the dates used throughout the api, note this odd string is used to parse/format dates in go

View Source
const BuildKiteEventDateFormat = "2006-01-02 15:04:05 MST"

BuildKiteEventDateFormat is the format of the dates used in webhook events.

View Source
const Version = "4.0.0"

Version the library version number

Variables

This section is empty.

Functions

func ParseWebHook

func ParseWebHook(messageType string, payload []byte) (interface{}, error)

ParseWebHook parses the event payload. For recognized event types, a value of the corresponding struct type will be returned (as returned by Event.ParsePayload()). An error will be returned for unrecognized event types.

func ValidatePayload

func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err error)

ValidatePayload validates an incoming Buildkite Webhook event request and returns the (JSON) payload. secretKey is the Buildkite Webhook token.

Example usage:

func WebHookType

func WebHookType(r *http.Request) string

WebHookType returns the event type of webhook request r.

Buildkite API docs: https://buildkite.com/docs/apis/webhooks

func WithBaseURL

func WithBaseURL(baseURL string) clientOpt

WithBaseURL configures the buildkite.Client to use the provided base URL, instead of the default of https://api.buildkite.com/

func WithHTTPClient

func WithHTTPClient(client *http.Client) clientOpt

WithHTTPClient configures the buildkite.Client to use the provided http.Client. This can be used to customise the client's transport (e.g. to use a custom TLS configuration) or to provide a mock client

func WithHTTPDebug

func WithHTTPDebug(debug bool) clientOpt

WithHTTPDebug configures the buildkite.Client to print debug information about HTTP requests and responses as it makes them

func WithTokenAuth

func WithTokenAuth(token string) clientOpt

WithTokenAuth configures the buildkite.Client to use the provided token for authentication. This is the recommended way to authenticate with the buildkite API Note that at least one of WithTokenAuth or [WithBasicAuth] must be provided to NewOpts

func WithUserAgent

func WithUserAgent(userAgent string) clientOpt

WithUserAgent configures the buildkite.Client to use the provided user agent string, instead of the default of "go-buildkite/<version>"

Types

type AccessToken

type AccessToken struct {
	UUID   string   `json:"uuid,omitempty"`
	Scopes []string `json:"scopes,omitempty"`
}

type AccessTokensService

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

func (*AccessTokensService) Get

Get gets the current token which was used to authenticate the request

buildkite API docs: https://buildkite.com/docs/rest-api/access-token

func (*AccessTokensService) Revoke

func (ats *AccessTokensService) Revoke(ctx context.Context) (*Response, error)

Revokes the current token which was used to authenticate the request

buildkite API docs: https://buildkite.com/docs/rest-api/access-token

type Agent

type Agent struct {
	ID                string     `json:"id,omitempty"`
	GraphQLID         string     `json:"graphql_id,omitempty"`
	URL               string     `json:"url,omitempty"`
	WebURL            string     `json:"web_url,omitempty"`
	Name              string     `json:"name,omitempty"`
	ConnectedState    string     `json:"connection_state,omitempty"`
	AgentToken        string     `json:"access_token,omitempty"`
	Hostname          string     `json:"hostname,omitempty"`
	IPAddress         string     `json:"ip_address,omitempty"`
	UserAgent         string     `json:"user_agent,omitempty"`
	Version           string     `json:"version,omitempty"`
	CreatedAt         *Timestamp `json:"created_at,omitempty"`
	LastJobFinishedAt *Timestamp `json:"last_job_finished_at,omitempty"`
	Priority          *int       `json:"priority,omitempty"`
	Metadata          []string   `json:"meta_data,omitempty"`

	// the user that created the agent
	Creator *User `json:"creator,omitempty"`

	Job *Job `json:"job,omitempty"`
}

Agent represents a buildkite build agent.

type AgentConnectedEvent

type AgentConnectedEvent struct {
	AgentEvent
}

AgentConnectedEvent is triggered when an agent has connected to the API

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events

type AgentDisconnectedEvent

type AgentDisconnectedEvent struct {
	AgentEvent
}

AgentDisconnectedEvent is triggered when an agent has disconnected.

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events

type AgentEvent

type AgentEvent struct {
	Event  string `json:"event"`
	Agent  Agent  `json:"agent"`
	Sender User   `json:"sender"`
}

agentEvent is a wrapper for an agent event notification

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events

type AgentListOptions

type AgentListOptions struct {
	// Filters the results by the given agent name
	Name string `url:"name,omitempty"`

	// Filters the results by the given hostname
	Hostname string `url:"hostname,omitempty"`

	// Filters the results by the given exact version number
	Version string `url:"version,omitempty"`

	ListOptions
}

AgentListOptions specifies the optional parameters to the AgentService.List method.

type AgentLostEvent

type AgentLostEvent struct {
	AgentEvent
}

AgentLostEvent is triggered when an agent has been marked as lost.

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events

type AgentStoppedEvent

type AgentStoppedEvent struct {
	AgentEvent
}

AgentStoppedEvent is triggered when an agent has stopped.

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events

type AgentStoppingEvent

type AgentStoppingEvent struct {
	AgentEvent
}

AgentStoppingEvent is triggered when an agent is stopping.

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events

type AgentsService

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

AgentsService handles communication with the agent related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/agents

func (*AgentsService) Create

func (as *AgentsService) Create(ctx context.Context, org string, agent Agent) (Agent, *Response, error)

Create a new buildkite agent.

buildkite API docs: https://buildkite.com/docs/api/agents#create-an-agent

func (*AgentsService) Delete

func (as *AgentsService) Delete(ctx context.Context, org string, id string) (*Response, error)

Delete an agent.

buildkite API docs: https://buildkite.com/docs/api/agents#delete-an-agent

func (*AgentsService) Get

func (as *AgentsService) Get(ctx context.Context, org string, id string) (Agent, *Response, error)

Get fetches an agent.

buildkite API docs: https://buildkite.com/docs/api/agents#get-an-agent

func (*AgentsService) List

func (as *AgentsService) List(ctx context.Context, org string, opt *AgentListOptions) ([]Agent, *Response, error)

List the agents for a given orginisation.

buildkite API docs: https://buildkite.com/docs/api/agents#list-agents

func (*AgentsService) Stop

func (as *AgentsService) Stop(ctx context.Context, org string, id string, force bool) (*Response, error)

Stop an agent.

buildkite API docs: https://buildkite.com/docs/apis/rest-api/agents#stop-an-agent

type Annotation

type Annotation struct {
	ID        string     `json:"id,omitempty"`
	Context   string     `json:"context,omitempty"`
	Style     string     `json:"style,omitempty"`
	BodyHTML  string     `json:"body_html,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
	UpdatedAt *Timestamp `json:"updated_at,omitempty"`
}

Annotation represents an annotation which has been stored from a build

type AnnotationCreate

type AnnotationCreate struct {
	Body    string `json:"body,omitempty"`
	Context string `json:"context,omitempty"`
	Style   string `json:"style,omitempty"`
	Append  bool   `json:"append,omitempty"`
}

type AnnotationListOptions

type AnnotationListOptions struct {
	ListOptions
}

AnnotationListOptions specifies the optional parameters to the AnnoationsService.List method.

type AnnotationsService

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

AnnotationsService handles communication with the annotation related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/annotations

func (*AnnotationsService) Create

func (as *AnnotationsService) Create(ctx context.Context, org, pipeline, build string, ac AnnotationCreate) (Annotation, *Response, error)

func (*AnnotationsService) ListByBuild

func (as *AnnotationsService) ListByBuild(ctx context.Context, org string, pipeline string, build string, opt *AnnotationListOptions) ([]Annotation, *Response, error)

ListByBuild gets annotations for a specific build

buildkite API docs: https://buildkite.com/docs/apis/rest-api/annotations#list-annotations-for-a-build

type Artifact

type Artifact struct {
	ID           string `json:"id,omitempty"`
	JobID        string `json:"job_id,omitempty"`
	URL          string `json:"url,omitempty"`
	DownloadURL  string `json:"download_url,omitempty"`
	State        string `json:"state,omitempty"`
	Path         string `json:"path,omitempty"`
	Dirname      string `json:"dirname,omitempty"`
	Filename     string `json:"filename,omitempty"`
	MimeType     string `json:"mime_type,omitempty"`
	FileSize     int64  `json:"file_size,omitempty"`
	GlobPath     string `json:"glob_path,omitempty"`
	OriginalPath string `json:"original_path,omitempty"`
	SHA1         string `json:"sha1sum,omitempty"`
}

Artifact represents an artifact which has been stored from a build

type ArtifactListOptions

type ArtifactListOptions struct {
	ListOptions
}

ArtifactListOptions specifies the optional parameters to the ArtifactsService.List method.

type ArtifactsService

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

ArtifactsService handles communication with the artifact related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/artifacts

func (*ArtifactsService) DownloadArtifactByURL

func (as *ArtifactsService) DownloadArtifactByURL(ctx context.Context, url string, w io.Writer) (*Response, error)

DownloadArtifactByURL gets artifacts for a specific build

buildkite API docs: https://buildkite.com/docs/api/artifacts#list-artifacts-for-a-build

func (*ArtifactsService) ListByBuild

func (as *ArtifactsService) ListByBuild(ctx context.Context, org string, pipeline string, build string, opt *ArtifactListOptions) ([]Artifact, *Response, error)

ListByBuild gets artifacts for a specific build

buildkite API docs: https://buildkite.com/docs/api/artifacts#list-artifacts-for-a-build

func (*ArtifactsService) ListByJob

func (as *ArtifactsService) ListByJob(ctx context.Context, org string, pipeline string, build string, job string, opt *ArtifactListOptions) ([]Artifact, *Response, error)

ListByJob gets artifacts for a specific build

buildkite API docs: https://buildkite.com/docs/apis/rest-api/artifacts#list-artifacts-for-a-job

type Author

type Author struct {
	Username string `json:"username,omitempty"`
	Name     string `json:"name,omitempty"`
	Email    string `json:"email,omitempty"`
}

Author of a commit (used in CreateBuild)

type BitbucketSettings

type BitbucketSettings struct {
	BuildPullRequests                       bool   `json:"build_pull_requests,omitempty"`
	BuildBranches                           bool   `json:"build_branches,omitempty"`
	PullRequestBranchFilterEnabled          bool   `json:"pull_request_branch_filter_enabled,omitempty"`
	PullRequestBranchFilterConfiguration    string `json:"pull_request_branch_filter_configuration,omitempty"`
	SkipPullRequestBuildsForExistingCommits bool   `json:"skip_pull_request_builds_for_existing_commits,omitempty"`
	BuildTags                               bool   `json:"build_tags,omitempty"`
	PublishCommitStatus                     bool   `json:"publish_commit_status,omitempty"`
	PublishCommitStatusPerStep              bool   `json:"publish_commit_status_per_step,omitempty"`

	// Read-only
	Repository string `json:"repository,omitempty"`
}

BitbucketSettings are settings for pipelines building from Bitbucket repositories.

type Build

type Build struct {
	ID          string                 `json:"id,omitempty"`
	GraphQLID   string                 `json:"graphql_id,omitempty"`
	URL         string                 `json:"url,omitempty"`
	WebURL      string                 `json:"web_url,omitempty"`
	Number      int                    `json:"number,omitempty"`
	State       string                 `json:"state,omitempty"`
	Blocked     bool                   `json:"blocked,omitempty"`
	Message     string                 `json:"message,omitempty"`
	Commit      string                 `json:"commit,omitempty"`
	Branch      string                 `json:"branch,omitempty"`
	Author      Author                 `json:"author,omitempty"`
	Env         map[string]interface{} `json:"env,omitempty"`
	CreatedAt   *Timestamp             `json:"created_at,omitempty"`
	ScheduledAt *Timestamp             `json:"scheduled_at,omitempty"`
	StartedAt   *Timestamp             `json:"started_at,omitempty"`
	FinishedAt  *Timestamp             `json:"finished_at,omitempty"`
	MetaData    map[string]string      `json:"meta_data,omitempty"`
	Creator     Creator                `json:"creator,omitempty"`
	Source      string                 `json:"source,omitempty"`

	// jobs run during the build
	Jobs []Job `json:"jobs,omitempty"`

	// the pipeline this build is associated with
	Pipeline *Pipeline `json:"pipeline,omitempty"`

	// the build this build is a rebuild of
	RebuiltFrom *RebuiltFrom `json:"rebuilt_from,omitempty"`

	// the pull request this build is associated with
	PullRequest *PullRequest `json:"pull_request,omitempty"`

	// the build that this build is triggered from
	// https://buildkite.com/docs/pipelines/trigger-step
	TriggeredFrom *TriggeredFrom `json:"triggered_from,omitempty"`
}

Build represents a build which has run in buildkite

type BuildEvent

type BuildEvent struct {
	Event    string   `json:"event"`
	Build    Build    `json:"build"`
	Pipeline Pipeline `json:"pipeline"`
	Sender   User     `json:"sender"`
}

buildEvent is a wrapper for a build event notification

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events

type BuildFailingEvent

type BuildFailingEvent struct {
	BuildEvent
}

BuildFailingEvent is triggered when a build enters a failing state

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events

type BuildFinishedEvent

type BuildFinishedEvent struct {
	BuildEvent
}

BuildFinishedEvent is triggered when a build finishes

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events

type BuildRunningEvent

type BuildRunningEvent struct {
	BuildEvent
}

BuildRunningEvent is triggered when a build starts running

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events

type BuildScheduledEvent

type BuildScheduledEvent struct {
	BuildEvent
}

BuildScheduledEvent is triggered when a build is scheduled

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events

type BuildsListOptions

type BuildsListOptions struct {

	// Filters the results by the user who created the build
	Creator string `url:"creator,omitempty"`

	// Filters the results by builds created on or after the given time
	CreatedFrom time.Time `url:"created_from,omitempty"`

	// Filters the results by builds created before the given time
	CreatedTo time.Time `url:"created_to,omitempty"`

	// Filters the results by builds finished on or after the given time
	FinishedFrom time.Time `url:"finished_from,omitempty"`

	// State of builds to list.  Possible values are: running, scheduled, passed,
	// failed, canceled, skipped and not_run. Default is "".
	State []string `url:"state,brackets,omitempty"`

	// Filters the results by branch name(s)
	Branch []string `url:"branch,brackets,omitempty"`

	// Filters the results by builds for the specific commit SHA (full, not shortened). Default is "".
	Commit string `url:"commit,omitempty"`

	// Include all retried jobs in each build’s jobs list
	IncludeRetriedJobs bool `url:"include_retried_jobs,omitempty"`

	// Filters results by metadata.
	MetaData MetaDataFilters `url:"meta_data,omitempty"`

	ListOptions
}

BuildsListOptions specifies the optional parameters to the BuildsService.List method.

type BuildsService

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

BuildsService handles communication with the build related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/builds

func (*BuildsService) Cancel

func (bs *BuildsService) Cancel(ctx context.Context, org, pipeline, build string) (Build, error)

Cancel - Trigger a cancel for the target build

buildkite API docs: https://buildkite.com/docs/apis/rest-api/builds#cancel-a-build

func (*BuildsService) Create

func (bs *BuildsService) Create(ctx context.Context, org string, pipeline string, b CreateBuild) (Build, *Response, error)

Create - Create a pipeline

buildkite API docs: https://buildkite.com/docs/api/builds#create-a-build

func (*BuildsService) Get

func (bs *BuildsService) Get(ctx context.Context, org string, pipeline string, id string, opt *BuildsListOptions) (Build, *Response, error)

Get fetches a build.

buildkite API docs: https://buildkite.com/docs/api/builds#get-a-build

func (*BuildsService) List

func (bs *BuildsService) List(ctx context.Context, opt *BuildsListOptions) ([]Build, *Response, error)

List the builds for the current user.

buildkite API docs: https://buildkite.com/docs/api/builds#list-all-builds

func (*BuildsService) ListByOrg

func (bs *BuildsService) ListByOrg(ctx context.Context, org string, opt *BuildsListOptions) ([]Build, *Response, error)

ListByOrg lists the builds within the specified orginisation.

buildkite API docs: https://buildkite.com/docs/api/builds#list-builds-for-an-organization

func (*BuildsService) ListByPipeline

func (bs *BuildsService) ListByPipeline(ctx context.Context, org string, pipeline string, opt *BuildsListOptions) ([]Build, *Response, error)

ListByPipeline lists the builds for a pipeline within the specified originisation.

buildkite API docs: https://buildkite.com/docs/api/builds#list-builds-for-a-pipeline

func (*BuildsService) Rebuild

func (bs *BuildsService) Rebuild(ctx context.Context, org, pipeline, build string) (Build, error)

Rebuild triggers a rebuild for the target build

buildkite API docs: https://buildkite.com/docs/apis/rest-api/builds#rebuild-a-build

type ClaimRule

type ClaimRule struct {
	Equals    any      `json:"equals,omitempty"`
	NotEquals any      `json:"not_equals,omitempty"`
	In        []any    `json:"in,omitempty"`
	NotIn     []any    `json:"not_in,omitempty"`
	Matches   []string `json:"matches,omitempty"`
}

type Client

type Client struct {

	// Base URL for API requests.  Defaults to the public buildkite API. BaseURL should
	// always be specified with a trailing slash.
	BaseURL *url.URL

	// User agent used when communicating with the buildkite API.
	UserAgent string

	// Services used for talking to different parts of the buildkite API.
	AccessTokens             *AccessTokensService
	Agents                   *AgentsService
	Annotations              *AnnotationsService
	Artifacts                *ArtifactsService
	Builds                   *BuildsService
	Clusters                 *ClustersService
	ClusterQueues            *ClusterQueuesService
	ClusterTokens            *ClusterTokensService
	FlakyTests               *FlakyTestsService
	Jobs                     *JobsService
	Organizations            *OrganizationsService
	PackagesService          *PackagesService
	PackageRegistriesService *PackageRegistriesService
	Pipelines                *PipelinesService
	PipelineTemplates        *PipelineTemplatesService
	User                     *UserService
	Teams                    *TeamsService
	Tests                    *TestsService
	TestRuns                 *TestRunsService
	TestSuites               *TestSuitesService
	// contains filtered or unexported fields
}

Client - A Client manages communication with the buildkite API.

func NewClient

func NewClient(opts ...clientOpt) (*Client, error)

NewClient returns a new buildkite API client with the provided options. Note that at WithTokenAuth must be provided for requests to the buildkite API to succeed. Otherwise, sensible defaults are used.

func NewOpts

func NewOpts(opts ...clientOpt) (*Client, error)

NewOpts is an alias for NewClient

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) ListEmojis

func (c *Client) ListEmojis(ctx context.Context, org string) ([]Emoji, *Response, error)

ListEmojis list all the emojis for a given account, including custom emojis and aliases.

buildkite API docs: https://buildkite.com/docs/api/emojis

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type Cluster

type Cluster struct {
	ID              string         `json:"id,omitempty"`
	GraphQLID       string         `json:"graphql_id,omitempty"`
	DefaultQueueID  string         `json:"default_queue_id,omitempty"`
	Name            string         `json:"name,omitempty"`
	Description     string         `json:"description,omitempty"`
	Emoji           string         `json:"emoji,omitempty"`
	Color           string         `json:"color,omitempty"`
	URL             string         `json:"url,omitempty"`
	WebURL          string         `json:"web_url,omitempty"`
	QueuesURL       string         `json:"queues_url,omitempty"`
	DefaultQueueURL string         `json:"default_queue_url,omitempty"`
	CreatedAt       *Timestamp     `json:"created_at,omitempty"`
	CreatedBy       ClusterCreator `json:"created_by,omitempty"`
}

type ClusterCreate

type ClusterCreate struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Emoji       string `json:"emoji,omitempty"`
	Color       string `json:"color,omitempty"`
}

type ClusterCreator

type ClusterCreator struct {
	ID        string     `json:"id,omitempty"`
	GraphQLID string     `json:"graphql_id,omitempty"`
	Name      string     `json:"name,omitempty"`
	Email     string     `json:"email,omitempty"`
	AvatarURL string     `json:"avatar_url,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

type ClusterQueue

type ClusterQueue struct {
	ID                 string          `json:"id,omitempty"`
	GraphQLID          string          `json:"graphql_id,omitempty"`
	Key                string          `json:"key,omitempty"`
	Description        string          `json:"description,omitempty"`
	URL                string          `json:"url,omitempty"`
	WebURL             string          `json:"web_url,omitempty"`
	ClusterURL         string          `json:"cluster_url,omitempty"`
	DispatchPaused     bool            `json:"dispatch_paused,omitempty"`
	DispatchPausedBy   *ClusterCreator `json:"dispatch_paused_by,omitempty"`
	DispatchPausedAt   *Timestamp      `json:"dispatch_paused_at,omitempty"`
	DispatchPausedNote string          `json:"dispatch_paused_note,omitempty"`
	CreatedAt          *Timestamp      `json:"created_at,omitempty"`
	CreatedBy          ClusterCreator  `json:"created_by,omitempty"`
}

type ClusterQueueCreate

type ClusterQueueCreate struct {
	Key         string `json:"key,omitempty"`
	Description string `json:"description,omitempty"`
}

type ClusterQueuePause

type ClusterQueuePause struct {
	Note string `json:"dispatch_paused_note,omitempty"`
}

type ClusterQueueUpdate

type ClusterQueueUpdate struct {
	Description string `json:"description,omitempty"`
}

type ClusterQueuesListOptions

type ClusterQueuesListOptions struct {
	ListOptions
}

type ClusterQueuesService

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

ClusterQueuesService handles communication with cluster queue related methods of the Buildkite API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/clusters#cluster-queues

func (*ClusterQueuesService) Create

func (cqs *ClusterQueuesService) Create(ctx context.Context, org, clusterID string, qc ClusterQueueCreate) (ClusterQueue, *Response, error)

func (*ClusterQueuesService) Delete

func (cqs *ClusterQueuesService) Delete(ctx context.Context, org, clusterID, queueID string) (*Response, error)

func (*ClusterQueuesService) Get

func (cqs *ClusterQueuesService) Get(ctx context.Context, org, clusterID, queueID string) (ClusterQueue, *Response, error)

func (*ClusterQueuesService) List

func (cqs *ClusterQueuesService) List(ctx context.Context, org, clusterID string, opt *ClusterQueuesListOptions) ([]ClusterQueue, *Response, error)

func (*ClusterQueuesService) Pause

func (cqs *ClusterQueuesService) Pause(ctx context.Context, org, clusterID, queueID string, qp ClusterQueuePause) (ClusterQueue, *Response, error)

func (*ClusterQueuesService) Resume

func (cqs *ClusterQueuesService) Resume(ctx context.Context, org, clusterID, queueID string) (*Response, error)

func (*ClusterQueuesService) Update

func (cqs *ClusterQueuesService) Update(ctx context.Context, org, clusterID, queueID string, qu ClusterQueueUpdate) (ClusterQueue, *Response, error)

type ClusterToken

type ClusterToken struct {
	ID                 string         `json:"id,omitempty"`
	GraphQLID          string         `json:"graphql_id,omitempty"`
	Description        string         `json:"description,omitempty"`
	AllowedIPAddresses string         `json:"allowed_ip_addresses,omitempty"`
	URL                string         `json:"url,omitempty"`
	ClusterURL         string         `json:"cluster_url,omitempty"`
	CreatedAt          *Timestamp     `json:"created_at,omitempty"`
	CreatedBy          ClusterCreator `json:"created_by,omitempty"`
	Token              string         `json:"token,omitempty"`
}

type ClusterTokenCreateUpdate

type ClusterTokenCreateUpdate struct {
	Description        string `json:"description,omitempty"`
	AllowedIPAddresses string `json:"allowed_ip_addresses,omitempty"`
}

type ClusterTokensListOptions

type ClusterTokensListOptions struct {
	ListOptions
}

type ClusterTokensService

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

ClusterTokensService handles communication with cluster token related methods of the Buildkite API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/clusters#cluster-tokens

func (*ClusterTokensService) Create

func (*ClusterTokensService) Delete

func (cts *ClusterTokensService) Delete(ctx context.Context, org, clusterID, tokenID string) (*Response, error)

func (*ClusterTokensService) Get

func (cts *ClusterTokensService) Get(ctx context.Context, org, clusterID, tokenID string) (ClusterToken, *Response, error)

func (*ClusterTokensService) List

func (cts *ClusterTokensService) List(ctx context.Context, org, clusterID string, opt *ClusterTokensListOptions) ([]ClusterToken, *Response, error)

func (*ClusterTokensService) Update

func (cts *ClusterTokensService) Update(ctx context.Context, org, clusterID, tokenID string, ctc ClusterTokenCreateUpdate) (ClusterToken, *Response, error)

type ClusterUpdate

type ClusterUpdate struct {
	Name           string `json:"name,omitempty"`
	Description    string `json:"description,omitempty"`
	Emoji          string `json:"emoji,omitempty"`
	Color          string `json:"color,omitempty"`
	DefaultQueueID string `json:"default_queue_id,omitempty"`
}

type ClustersListOptions

type ClustersListOptions struct{ ListOptions }

type ClustersService

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

ClustersService handles communication with cluster related methods of the Buildkite API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/clusters#clusters

func (*ClustersService) Create

func (cs *ClustersService) Create(ctx context.Context, org string, cc ClusterCreate) (Cluster, *Response, error)

func (*ClustersService) Delete

func (cs *ClustersService) Delete(ctx context.Context, org, id string) (*Response, error)

func (*ClustersService) Get

func (cs *ClustersService) Get(ctx context.Context, org, id string) (Cluster, *Response, error)

func (*ClustersService) List

func (*ClustersService) Update

func (cs *ClustersService) Update(ctx context.Context, org, id string, cu ClusterUpdate) (Cluster, *Response, error)

type CreateBuild

type CreateBuild struct {
	Commit  string `json:"commit"`
	Branch  string `json:"branch"`
	Message string `json:"message"`

	// Optional fields
	Author                      Author            `json:"author,omitempty"`
	CleanCheckout               bool              `json:"clean_checkout,omitempty"`
	Env                         map[string]string `json:"env,omitempty"`
	MetaData                    map[string]string `json:"meta_data,omitempty"`
	IgnorePipelineBranchFilters bool              `json:"ignore_pipeline_branch_filters,omitempty"`
	PullRequestBaseBranch       string            `json:"pull_request_base_branch,omitempty"`
	PullRequestID               int64             `json:"pull_request_id,omitempty"`
	PullRequestRepository       string            `json:"pull_request_repository,omitempty"`
}

CreateBuild - Create a build.

type CreatePackageInput

type CreatePackageInput struct {
	Package  io.Reader // The package to upload. This can be an [os.File], or any other [io.Reader].
	Filename string    // The name of the file to upload. If PackageFile is an [os.File], this can be omitted, and the file's name will be used.
}

CreatePackageInput specifies the input parameters for the Create method. All fields are required, but if PackageFile is an os.File, Filename can be omitted.

type CreatePackageRegistryInput

type CreatePackageRegistryInput struct {
	Name        string                    `json:"name,omitempty"`        // The name of the package registry
	Ecosystem   string                    `json:"ecosystem,omitempty"`   // The ecosystem of the package registry
	Description string                    `json:"description,omitempty"` // A description for the package registry
	Emoji       string                    `json:"emoji,omitempty"`       // An emoji for the package registry, in buildkite format (eg ":rocket:")
	Color       string                    `json:"color,omitempty"`       // A color for the package registry, in hex format (eg "#FF0000")
	OIDCPolicy  PackageRegistryOIDCPolicy `json:"oidc_policy,omitempty"` // The OIDC policy for the package registry, as a YAML or JSON string
}

CreatePackageRegistryInput represents the input to create a package registry.

type CreatePipeline

type CreatePipeline struct {
	Name       string `json:"name"`
	Repository string `json:"repository"`

	// Either configuration needs to be specified as a yaml string or steps.
	Configuration string `json:"configuration,omitempty"`
	Steps         []Step `json:"steps,omitempty"`

	// Optional fields
	DefaultBranch                   string            `json:"default_branch,omitempty"`
	Description                     string            `json:"description,omitempty"`
	Env                             map[string]string `json:"env,omitempty"`
	ProviderSettings                ProviderSettings  `json:"provider_settings,omitempty"`
	BranchConfiguration             string            `json:"branch_configuration,omitempty"`
	SkipQueuedBranchBuilds          bool              `json:"skip_queued_branch_builds,omitempty"`
	SkipQueuedBranchBuildsFilter    string            `json:"skip_queued_branch_builds_filter,omitempty"`
	CancelRunningBranchBuilds       bool              `json:"cancel_running_branch_builds,omitempty"`
	CancelRunningBranchBuildsFilter string            `json:"cancel_running_branch_builds_filter,omitempty"`
	TeamUuids                       []string          `json:"team_uuids,omitempty"`
	ClusterID                       string            `json:"cluster_id,omitempty"`
	Visibility                      string            `json:"visibility,omitempty"`
	Tags                            []string          `json:"tags,omitempty"`
}

CreatePipeline - Create a Pipeline.

type Creator

type Creator struct {
	AvatarURL string     `json:"avatar_url"`
	CreatedAt *Timestamp `json:"created_at"`
	Email     string     `json:"email"`
	ID        string     `json:"id"`
	Name      string     `json:"name"`
}

Creator represents who created a build

type Emoji

type Emoji struct {
	Name string `json:"name,omitempty"`
	URL  string `json:"url,omitempty"`
}

Emoji emoji, what else can you say?

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response // HTTP response that caused this error
	Message  string         `json:"message"` // error message
	RawBody  []byte         `json:"-"`       // Raw Response Body
}

ErrorResponse provides a message.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Event

type Event struct {
	Type       string           `json:"type"`
	RawPayload *json.RawMessage `json:"payload,omitempty"`
}

Event represents a Buildkite webhook event

func (*Event) ParsePayload

func (e *Event) ParsePayload() (payload interface{}, err error)

ParsePayload parses the event payload. For recognized event types, a value of the corresponding struct type will be returned. An error will be returned for unrecognized event types.

Example usage:

type FlakyTest

type FlakyTest struct {
	ID                   string     `json:"id,omitempty"`
	WebURL               string     `json:"web_url,omitempty"`
	Scope                string     `json:"scope,omitempty"`
	Name                 string     `json:"name,omitempty"`
	Location             string     `json:"location,omitempty"`
	FileName             string     `json:"file_name,omitempty"`
	Instances            int        `json:"instances,omitempty"`
	MostRecentInstanceAt *Timestamp `json:"most_recent_instance_at,omitempty"`
}

type FlakyTestsListOptions

type FlakyTestsListOptions struct{ ListOptions }

type FlakyTestsService

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

FlakyTestsService handles communication with flaky test related methods of the Buildkite Test Analytics API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/analytics/flaky-tests

func (*FlakyTestsService) List

func (fts *FlakyTestsService) List(ctx context.Context, org, slug string, opt *FlakyTestsListOptions) ([]FlakyTest, *Response, error)

type GitHubEnterpriseSettings

type GitHubEnterpriseSettings struct {
	TriggerMode                             string `json:"trigger_mode,omitempty"`
	BuildPullRequests                       bool   `json:"build_pull_requests,omitempty"`
	BuildBranches                           bool   `json:"build_branches,omitempty"`
	PullRequestBranchFilterEnabled          bool   `json:"pull_request_branch_filter_enabled,omitempty"`
	PullRequestBranchFilterConfiguration    string `json:"pull_request_branch_filter_configuration,omitempty"`
	SkipPullRequestBuildsForExistingCommits bool   `json:"skip_pull_request_builds_for_existing_commits,omitempty"`
	BuildTags                               bool   `json:"build_tags,omitempty"`
	PublishCommitStatus                     bool   `json:"publish_commit_status,omitempty"`
	PublishCommitStatusPerStep              bool   `json:"publish_commit_status_per_step,omitempty"`

	// Read-only
	Repository string `json:"repository,omitempty"`
}

GitHubEnterpriseSettings are settings for pipelines building from GitHub Enterprise repositories.

type GitHubSettings

type GitHubSettings struct {
	TriggerMode                             string `json:"trigger_mode,omitempty"`
	BuildPullRequests                       bool   `json:"build_pull_requests,omitempty"`
	BuildBranches                           bool   `json:"build_branches,omitempty"`
	PullRequestBranchFilterEnabled          bool   `json:"pull_request_branch_filter_enabled,omitempty"`
	PullRequestBranchFilterConfiguration    string `json:"pull_request_branch_filter_configuration,omitempty"`
	SkipPullRequestBuildsForExistingCommits bool   `json:"skip_pull_request_builds_for_existing_commits,omitempty"`
	BuildPullRequestForks                   bool   `json:"build_pull_request_forks,omitempty"`
	PrefixPullRequestForkBranchNames        bool   `json:"prefix_pull_request_fork_branch_names,omitempty"`
	BuildTags                               bool   `json:"build_tags,omitempty"`
	PublishCommitStatus                     bool   `json:"publish_commit_status,omitempty"`
	PublishCommitStatusPerStep              bool   `json:"publish_commit_status_per_step,omitempty"`
	FilterEnabled                           bool   `json:"filter_enabled,omitempty"`
	FilterCondition                         string `json:"filter_condition,omitempty"`
	SeparatePullRequestStatuses             bool   `json:"separate_pull_request_statuses,omitempty"`
	PublishBlockedAsPending                 bool   `json:"publish_blocked_as_pending,omitempty"`

	// Read-only
	Repository string `json:"repository,omitempty"`
}

GitHubSettings are settings for pipelines building from GitHub repositories.

type GitLabSettings

type GitLabSettings struct {
	// Read-only
	Repository string `json:"repository,omitempty"`
}

GitLabSettings are settings for pipelines building from GitLab repositories.

type Job

type Job struct {
	ID                 string          `json:"id,omitempty"`
	GraphQLID          string          `json:"graphql_id,omitempty"`
	Type               string          `json:"type,omitempty"`
	Name               string          `json:"name,omitempty"`
	Label              string          `json:"label,omitempty"`
	StepKey            string          `json:"step_key,omitempty"`
	GroupKey           string          `json:"group_key,omitempty"`
	State              string          `json:"state,omitempty"`
	LogsURL            string          `json:"logs_url,omitempty"`
	RawLogsURL         string          `json:"raw_log_url,omitempty"`
	Command            string          `json:"command,omitempty"`
	ExitStatus         *int            `json:"exit_status,omitempty"`
	ArtifactPaths      string          `json:"artifact_paths,omitempty"`
	ArtifactsURL       string          `json:"artifacts_url,omitempty"`
	CreatedAt          *Timestamp      `json:"created_at,omitempty"`
	ScheduledAt        *Timestamp      `json:"scheduled_at,omitempty"`
	RunnableAt         *Timestamp      `json:"runnable_at,omitempty"`
	StartedAt          *Timestamp      `json:"started_at,omitempty"`
	FinishedAt         *Timestamp      `json:"finished_at,omitempty"`
	UnblockedAt        *Timestamp      `json:"unblocked_at,omitempty"`
	Agent              Agent           `json:"agent,omitempty"`
	AgentQueryRules    []string        `json:"agent_query_rules,omitempty"`
	WebURL             string          `json:"web_url"`
	Retried            bool            `json:"retried,omitempty"`
	RetriedInJobID     string          `json:"retried_in_job_id,omitempty"`
	RetriesCount       int             `json:"retries_count,omitempty"`
	RetrySource        *JobRetrySource `json:"retry_source,omitempty"`
	RetryType          string          `json:"retry_type,omitempty"`
	SoftFailed         bool            `json:"soft_failed,omitempty"`
	UnblockedBy        *UnblockedBy    `json:"unblocked_by,omitempty"`
	Unblockable        bool            `json:"unblockable,omitempty"`
	UnblockURL         string          `json:"unblock_url,omitempty"`
	ParallelGroupIndex *int            `json:"parallel_group_index,omitempty"`
	ParallelGroupTotal *int            `json:"parallel_group_total,omitempty"`
	ClusterID          string          `json:"cluster_id,omitempty"`
	ClusterQueueID     string          `json:"cluster_queue_id,omitempty"`
	TriggeredBuild     *TriggeredBuild `json:"triggered_build,omitempty"`
	Priority           *JobPriority    `json:"priority"`
}

Job represents a job run during a build in buildkite

type JobActivatedEvent

type JobActivatedEvent struct {
	JobEvent
}

JobActivatedEvent is triggered when a job is activated

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events

type JobEnvs

type JobEnvs struct {
	EnvironmentVariables map[string]string `json:"env"`
}

JobEnvs represent job environments output

type JobEvent

type JobEvent struct {
	Event    string   `json:"event"`
	Build    Build    `json:"build"`
	Job      Job      `json:"job"`
	Pipeline Pipeline `json:"pipeline"`
	Sender   User     `json:"sender"`
}

jobEvent is a wrapper for a job event notification

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events

type JobFinishedEvent

type JobFinishedEvent struct {
	JobEvent
}

JobFinishedEvent is triggered when a job is finished

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events

type JobLog

type JobLog struct {
	URL         string  `json:"url"`
	Content     string  `json:"content"`
	Size        int     `json:"size"`
	HeaderTimes []int64 `json:"header_times"`
}

JobLog represents a job log output

type JobPriority

type JobPriority struct {
	Number int `json:"number,omitempty"`
}

JobPriority represents the priority of the job

type JobRetrySource

type JobRetrySource struct {
	JobID     string `json:"job_id,omitempty"`
	RetryType string `json:"retry_type,omitempty"`
}

JobRetrySource represents what triggered this retry.

type JobScheduledEvent

type JobScheduledEvent struct {
	JobEvent
}

JobScheduledEvent is triggered when a job is scheduled

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events

type JobStartedEvent

type JobStartedEvent struct {
	JobEvent
}

JobStartedEvent is triggered when a job is started

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events

type JobUnblockOptions

type JobUnblockOptions struct {
	Fields map[string]string `json:"fields,omitempty"`
}

JobUnblockOptions specifies the optional parameters to UnblockJob

type JobsService

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

JobsService handles communication with the job related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/jobs

func (*JobsService) GetJobEnvironmentVariables

func (js *JobsService) GetJobEnvironmentVariables(ctx context.Context, org string, pipeline string, buildNumber string, jobID string) (JobEnvs, *Response, error)

GetJobEnvironmentVariables - get a job’s environment variables

buildkite API docs: https://buildkite.com/docs/apis/rest-api/jobs#get-a-jobs-environment-variables

func (*JobsService) GetJobLog

func (js *JobsService) GetJobLog(ctx context.Context, org string, pipeline string, buildNumber string, jobID string) (JobLog, *Response, error)

GetJobLog - get a job’s log output

buildkite API docs: https://buildkite.com/docs/apis/rest-api/jobs#get-a-jobs-log-output

func (*JobsService) RetryJob

func (js *JobsService) RetryJob(ctx context.Context, org string, pipeline string, buildNumber string, jobID string) (Job, *Response, error)

RetryJob - retry a job

buildkite API docs: https://buildkite.com/docs/apis/rest-api/jobs#retry-a-job

func (*JobsService) UnblockJob

func (js *JobsService) UnblockJob(ctx context.Context, org string, pipeline string, buildNumber string, jobID string, opt *JobUnblockOptions) (Job, *Response, error)

UnblockJob - unblock a job

buildkite API docs: https://buildkite.com/docs/apis/rest-api/jobs#unblock-a-job

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve.
	Page int `url:"page,omitempty"`

	// For paginated result sets, the number of results to include per page.
	PerPage int `url:"per_page,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support pagination.

type MetaDataFilters

type MetaDataFilters struct {
	MetaData map[string]string
}

func (MetaDataFilters) EncodeValues

func (mo MetaDataFilters) EncodeValues(parent_key string, v *url.Values) error

Encodes MetaData in the format expected by the buildkite API Example: ?meta_data[some-key]=some-value

type OIDCPolicyStatement

type OIDCPolicyStatement struct {
	Issuer string               `json:"iss"`
	Claims map[string]ClaimRule `json:"claims"`
}

type Organization

type Organization struct {
	ID           string     `json:"id,omitempty"`
	GraphQLID    string     `json:"graphql_id,omitempty"`
	URL          string     `json:"url,omitempty"`
	WebURL       string     `json:"web_url,omitempty"`
	Name         string     `json:"name,omitempty"`
	Slug         string     `json:"slug,omitempty"`
	Repository   string     `json:"repository,omitempty"`
	PipelinesURL string     `json:"pipelines_url,omitempty"`
	EmojisURL    string     `json:"emojis_url,omitempty"`
	AgentsURL    string     `json:"agents_url,omitempty"`
	CreatedAt    *Timestamp `json:"created_at,omitempty"`
}

Organization represents a buildkite organization.

type OrganizationListOptions

type OrganizationListOptions struct{ ListOptions }

OrganizationListOptions specifies the optional parameters to the OrganizationsService.List method.

type OrganizationsService

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

OrganizationsService handles communication with the organization related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/organizations

func (*OrganizationsService) Get

Get fetches an organization

buildkite API docs: https://buildkite.com/docs/api/organizations#get-an-organization

func (*OrganizationsService) List

List the organizations for the current user.

buildkite API docs: https://buildkite.com/docs/api/organizations#list-organizations

type Package

type Package struct {
	ID           string          `json:"id"`
	Name         string          `json:"name"`
	URL          string          `json:"url"`
	WebURL       string          `json:"web_url"`
	Organization Organization    `json:"organization"`
	Registry     PackageRegistry `json:"registry"`
}

Package represents a package which has been stored in a registry

type PackagePresignedUpload

type PackagePresignedUpload struct {
	OrganizationSlug string `json:"-"`
	RegistrySlug     string `json:"-"`

	URI  string                     `json:"uri"`
	Form PackagePresignedUploadForm `json:"form"`
	// contains filtered or unexported fields
}

PackagePresignedUpload represents a presigned upload URL for a Buildkite package, returned by the Buildkite API

func (*PackagePresignedUpload) Finalize

func (ppu *PackagePresignedUpload) Finalize(ctx context.Context, s3URL string) (Package, *Response, error)

Finalize creates a package in the registry for the organization, using the S3 URL of the uploaded package file.

func (*PackagePresignedUpload) Perform

func (ppu *PackagePresignedUpload) Perform(ctx context.Context, file *os.File) (string, error)

Perform performs uploads the package file referred to by `file` to the presigned upload URL. It does not create the package in the registry, only uploads the file to the package host. The returned string is the URL of the uploaded file in S3, which can then be passed to [Finalize] to create the package in the registry.

type PackagePresignedUploadForm

type PackagePresignedUploadForm struct {
	FileInput string            `json:"file_input"`
	Method    string            `json:"method"`
	URL       string            `json:"url"`
	Data      map[string]string `json:"data"`
}

type PackageRegistriesService

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

PackageRegistriesService handles communication with the package registries related Buildkite APIs

func (*PackageRegistriesService) Create

Create creates a package registry for an organization

func (*PackageRegistriesService) Delete

func (rs *PackageRegistriesService) Delete(ctx context.Context, organizationSlug, registrySlug string) (*Response, error)

Delete deletes a package registry for an organization

func (*PackageRegistriesService) Get

func (rs *PackageRegistriesService) Get(ctx context.Context, organizationSlug, registrySlug string) (PackageRegistry, *Response, error)

Get retrieves a package registry for an organization

func (*PackageRegistriesService) List

func (rs *PackageRegistriesService) List(ctx context.Context, organizationSlug string) ([]PackageRegistry, *Response, error)

List retrieves a list of package all package registries for an organization

func (*PackageRegistriesService) Update

func (rs *PackageRegistriesService) Update(ctx context.Context, organizationSlug, registrySlug string, upri UpdatePackageRegistryInput) (PackageRegistry, *Response, error)

Update updates a package registry for an organization

type PackageRegistry

type PackageRegistry struct {
	ID          string `json:"id"`
	GraphQLID   string `json:"graphql_id"`
	Slug        string `json:"slug"`
	URL         string `json:"url"`
	WebURL      string `json:"web_url"`
	Name        string `json:"name"`
	Ecosystem   string `json:"ecosystem"`
	Description string `json:"description"`
	Emoji       string `json:"emoji"`
	Color       string `json:"color"`
	Public      bool   `json:"public"`
	OIDCPolicy  string `json:"oidc_policy"`
}

PackageRegistry represents a package registry within Buildkite

type PackageRegistryOIDCPolicy

type PackageRegistryOIDCPolicy []OIDCPolicyStatement

type PackagesService

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

PackagesService handles communication with packages Buildkite API endpoints

func (*PackagesService) Create

func (ps *PackagesService) Create(ctx context.Context, organizationSlug, registrySlug string, cpi CreatePackageInput) (Package, *Response, error)

Create creates a package in a registry for an organization

func (*PackagesService) Get

func (ps *PackagesService) Get(ctx context.Context, organizationSlug, registrySlug, packageID string) (Package, *Response, error)

func (*PackagesService) RequestPresignedUpload

func (ps *PackagesService) RequestPresignedUpload(ctx context.Context, organizationSlug, registrySlug string) (*PackagePresignedUpload, *Response, error)

RequestPresignedUpload requests a presigned upload URL for a Buildkite package from the buildkite API

type PingEvent

type PingEvent struct {
	Event        string       `json:"event"`
	Organization Organization `json:"organization"`
	Sender       User         `json:"sender"`
}

PingEvent is triggered when a webhook notification setting is changed

Buildkite API docs: https://buildkite.com/docs/apis/webhooks/ping-events

type Pipeline

type Pipeline struct {
	ID                              string     `json:"id,omitempty"`
	GraphQLID                       string     `json:"graphql_id,omitempty"`
	URL                             string     `json:"url,omitempty"`
	WebURL                          string     `json:"web_url,omitempty"`
	Name                            string     `json:"name,omitempty"`
	Slug                            string     `json:"slug,omitempty"`
	Repository                      string     `json:"repository,omitempty"`
	BuildsURL                       string     `json:"builds_url,omitempty"`
	BadgeURL                        string     `json:"badge_url,omitempty"`
	CreatedAt                       *Timestamp `json:"created_at,omitempty"`
	ArchivedAt                      *Timestamp `json:"archived_at,omitempty"`
	DefaultBranch                   string     `json:"default_branch,omitempty"`
	Description                     string     `json:"description,omitempty"`
	BranchConfiguration             string     `json:"branch_configuration,omitempty"`
	SkipQueuedBranchBuilds          bool       `json:"skip_queued_branch_builds,omitempty"`
	SkipQueuedBranchBuildsFilter    string     `json:"skip_queued_branch_builds_filter,omitempty"`
	CancelRunningBranchBuilds       bool       `json:"cancel_running_branch_builds,omitempty"`
	CancelRunningBranchBuildsFilter string     `json:"cancel_running_branch_builds_filter,omitempty"`
	ClusterID                       string     `json:"cluster_id,omitempty"`
	Visibility                      string     `json:"visibility,omitempty"`
	Tags                            []string   `json:"tags,omitempty"`

	ScheduledBuildsCount int `json:"scheduled_builds_count,omitempty"`
	RunningBuildsCount   int `json:"running_builds_count,omitempty"`
	ScheduledJobsCount   int `json:"scheduled_jobs_count,omitempty"`
	RunningJobsCount     int `json:"running_jobs_count,omitempty"`
	WaitingJobsCount     int `json:"waiting_jobs_count,omitempty"`

	// the provider of sources
	Provider Provider `json:"provider,omitempty"`

	// build steps
	Steps         []Step         `json:"steps,omitempty"`
	Configuration string         `json:"configuration,omitempty"`
	Env           map[string]any `json:"env,omitempty"`
}

Pipeline represents a buildkite pipeline.

type PipelineListOptions

type PipelineListOptions struct{ ListOptions }

PipelineListOptions specifies the optional parameters to the PipelinesService.List method.

type PipelineTemplate

type PipelineTemplate struct {
	UUID          string `json:"uuid,omitempty"`
	GraphQLID     string `json:"graphql_id,omitempty"`
	Name          string `json:"name,omitempty"`
	Description   string `json:"description,omitempty"`
	Configuration string `json:"configuration,omitempty"`
	Available     bool   `json:"available,omitempty"`
	URL           string `json:"url,omitempty"`
	WebURL        string `json:"web_url,omitempty"`

	CreatedAt *Timestamp              `json:"created_at,omitempty"`
	CreatedBy PipelineTemplateCreator `json:"created_by,omitempty"`

	UpdatedAt *Timestamp              `json:"updated_at,omitempty"`
	UpdatedBy PipelineTemplateCreator `json:"updated_by,omitempty"`
}

type PipelineTemplateCreateUpdate

type PipelineTemplateCreateUpdate struct {
	Name          string `json:"name,omitempty"`
	Configuration string `json:"configuration,omitempty"`
	Description   string `json:"description,omitempty"`
	Available     bool   `json:"available,omitempty"`
}

type PipelineTemplateCreator

type PipelineTemplateCreator struct {
	ID        string     `json:"id,omitempty"`
	GraphQLID string     `json:"graphql_id,omitempty"`
	Name      string     `json:"name,omitempty"`
	Email     string     `json:"email,omitempty"`
	AvatarURL string     `json:"avatar_url,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

type PipelineTemplateListOptions

type PipelineTemplateListOptions struct {
	ListOptions
}

type PipelineTemplatesService

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

PipelineTemplatesService handles communication with pipeline template related methods of the Buildkite API.

Buildkite API docs: <to-fill>

func (*PipelineTemplatesService) Create

func (*PipelineTemplatesService) Delete

func (pts *PipelineTemplatesService) Delete(ctx context.Context, org, templateUUID string) (*Response, error)

func (*PipelineTemplatesService) Get

func (pts *PipelineTemplatesService) Get(ctx context.Context, org, templateUUID string) (PipelineTemplate, *Response, error)

func (*PipelineTemplatesService) List

func (*PipelineTemplatesService) Update

type PipelinesService

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

PipelinesService handles communication with the pipeline related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api/pipelines

func (*PipelinesService) AddWebhook

func (ps *PipelinesService) AddWebhook(ctx context.Context, org string, slug string) (*Response, error)

AddWebhook - Adds webhook in github for pipeline.

buildkite API docs: https://buildkite.com/docs/apis/rest-api/pipelines#add-a-webhook

func (*PipelinesService) Archive

func (ps *PipelinesService) Archive(ctx context.Context, org string, slug string) (*Response, error)

Archive - Archives a pipeline.

buildkite API docs: https://buildkite.com/docs/apis/rest-api/pipelines#archive-a-pipeline

func (*PipelinesService) Create

Create - Creates a pipeline for a given organisation.

buildkite API docs: https://buildkite.com/docs/rest-api/pipelines#create-a-pipeline

func (*PipelinesService) Delete

func (ps *PipelinesService) Delete(ctx context.Context, org, slug string) (*Response, error)

Delete a pipeline.

buildkite API docs: https://buildkite.com/docs/rest-api/pipelines#delete-a-pipeline

func (*PipelinesService) Get

func (ps *PipelinesService) Get(ctx context.Context, org string, slug string) (Pipeline, *Response, error)

Get fetches a pipeline.

buildkite API docs: https://buildkite.com/docs/rest-api/pipelines#get-a-pipeline

func (*PipelinesService) List

List the pipelines for a given organisation.

buildkite API docs: https://buildkite.com/docs/api/pipelines#list-pipelines

func (*PipelinesService) Unarchive

func (ps *PipelinesService) Unarchive(ctx context.Context, org string, slug string) (*Response, error)

Unarchive - Unarchive a pipeline.

buildkite API docs: https://buildkite.com/docs/apis/rest-api/pipelines#unarchive-a-pipeline

func (*PipelinesService) Update

func (ps *PipelinesService) Update(ctx context.Context, org, slug string, up UpdatePipeline) (Pipeline, *Response, error)

Update - Updates a pipeline.

buildkite API docs: https://buildkite.com/docs/rest-api/pipelines#update-a-pipeline

type Plugin

type Plugin map[string]interface{}

This is kept vague (map of string to whatever) as there are a lot of custom plugins out there.

type Plugins

type Plugins map[string]Plugin

func (*Plugins) UnmarshalJSON

func (p *Plugins) UnmarshalJSON(bs []byte) error

Support deprecated map structure as well as array structure

type Provider

type Provider struct {
	ID         string           `json:"id"`
	WebhookURL string           `json:"webhook_url"`
	Settings   ProviderSettings `json:"settings"`
}

Provider represents a source code provider. It is read-only, but settings may be written using Pipeline.ProviderSettings.

func (*Provider) UnmarshalJSON

func (p *Provider) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the Provider, choosing the type of the Settings from the ID.

type ProviderSettings

type ProviderSettings interface {
	// contains filtered or unexported methods
}

ProviderSettings represents the sum type of the settings for different source code providers.

type PullRequest

type PullRequest struct {
	ID         string `json:"id,omitempty"`
	Base       string `json:"base,omitempty"`
	Repository string `json:"repository,omitempty"`
}

PullRequest represents a Github PR

type RebuiltFrom

type RebuiltFrom struct {
	ID     string `json:"id"`
	Number int    `json:"number"`
	URL    string `json:"url"`
}

RebuiltFrom references a previous build

type Response

type Response struct {
	*http.Response

	NextPage  int
	PrevPage  int
	FirstPage int
	LastPage  int
}

Response is a buildkite API response. This wraps the standard http.Response returned from buildkite and provides convenient access to things like pagination links.

type Step

type Step struct {
	Type                string            `json:"type,omitempty"`
	Name                string            `json:"name,omitempty"`
	Label               string            `json:"label,omitempty"`
	Command             string            `json:"command,omitempty"`
	ArtifactPaths       string            `json:"artifact_paths,omitempty"`
	BranchConfiguration string            `json:"branch_configuration,omitempty"`
	Env                 map[string]string `json:"env,omitempty"`
	TimeoutInMinutes    *int              `json:"timeout_in_minutes,omitempty"`
	AgentQueryRules     []string          `json:"agent_query_rules,omitempty"`
	Plugins             Plugins           `json:"plugins,omitempty"`
}

Step represents a build step in buildkites build pipeline

type Team

type Team struct {
	ID          string     `json:"id,omitempty"`
	Name        string     `json:"name,omitempty"`
	Slug        string     `json:"slug,omitempty"`
	Description string     `json:"description,omitempty"`
	Privacy     string     `json:"privacy,omitempty"`
	Default     bool       `json:"default,omitempty"`
	CreatedAt   *Timestamp `json:"created_at,omitempty"`
	CreatedBy   *User      `json:"created_by,omitempty"`
}

Team represents a buildkite team.

type TeamsListOptions

type TeamsListOptions struct {
	ListOptions
	UserID string `url:"user_id,omitempty"`
}

TeamsListOptions specifies the optional parameters to the TeamsService.List method.

type TeamsService

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

TeamService handles communication with the teams related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api

func (*TeamsService) List

func (ts *TeamsService) List(ctx context.Context, org string, opt *TeamsListOptions) ([]Team, *Response, error)

Get the teams for an org.

buildkite API docs: https://buildkite.com/docs/api

type Test

type Test struct {
	ID       string `json:"id,omitempty"`
	URL      string `json:"url,omitempty"`
	WebURL   string `json:"web_url,omitempty"`
	Scope    string `json:"scope,omitempty"`
	Name     string `json:"name,omitempty"`
	Location string `json:"location,omitempty"`
	FileName string `json:"file_name,omitempty"`
}

type TestRun

type TestRun struct {
	ID        string     `json:"id,omitempty"`
	URL       string     `json:"url,omitempty"`
	WebURL    string     `json:"web_url,omitempty"`
	Branch    string     `json:"branch,omitempty"`
	CommitSHA string     `json:"commit_sha,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

type TestRunsListOptions

type TestRunsListOptions struct {
	ListOptions
}

type TestRunsService

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

TestRunsService handles communication with test run related methods of the Buildkite Test Analytics API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/analytics/runs

func (*TestRunsService) Get

func (trs *TestRunsService) Get(ctx context.Context, org, slug, runID string) (TestRun, *Response, error)

func (*TestRunsService) List

func (trs *TestRunsService) List(ctx context.Context, org, slug string, opt *TestRunsListOptions) ([]TestRun, *Response, error)

type TestSuite

type TestSuite struct {
	ID            string `json:"id,omitempty"`
	GraphQLID     string `json:"graphql_id,omitempty"`
	Slug          string `json:"slug,omitempty"`
	Name          string `json:"name,omitempty"`
	URL           string `json:"url,omitempty"`
	WebURL        string `json:"web_url,omitempty"`
	DefaultBranch string `json:"default_branch,omitempty"`
}

type TestSuiteCreate

type TestSuiteCreate struct {
	Name          string   `json:"name"`
	DefaultBranch string   `json:"default_branch,omitempty"`
	ShowAPIToken  bool     `json:"show_api_token,omitempty"`
	TeamUUIDs     []string `json:"team_ids,omitempty"`
}

type TestSuiteListOptions

type TestSuiteListOptions struct{ ListOptions }

type TestSuitesService

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

TestSuitesService handles communication with the test suite related methods of the Buildkite Test Analytics API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/analytics/suites

func (*TestSuitesService) Create

func (*TestSuitesService) Delete

func (tss *TestSuitesService) Delete(ctx context.Context, org, slug string) (*Response, error)

func (*TestSuitesService) Get

func (tss *TestSuitesService) Get(ctx context.Context, org, slug string) (TestSuite, *Response, error)

func (*TestSuitesService) List

func (*TestSuitesService) Update

func (tss *TestSuitesService) Update(ctx context.Context, org, slug string, ts TestSuite) (TestSuite, *Response, error)

type TestsService

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

TestsService handles communication with test related methods of the Buildkite Test Analytics API.

Buildkite API docs: https://buildkite.com/docs/apis/rest-api/analytics/tests

func (*TestsService) Get

func (ts *TestsService) Get(ctx context.Context, org, slug, testID string) (Test, *Response, error)

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp custom timestamp to support buildkite api timestamps

func NewTimestamp

func NewTimestamp(t time.Time) *Timestamp

NewTimestamp make a new timestamp using the time suplied.

func (Timestamp) Equal

func (ts Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) MarshalJSON

func (ts Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Timestamp) String

func (ts Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (ts *Timestamp) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

type Token

type Token struct {
	AccessToken string `json:"access_token,omitempty"`
	Type        string `json:"token_type,omitempty"`
}

Token an oauth access token for the buildkite service

type TriggeredBuild

type TriggeredBuild struct {
	ID     string `json:"id,omitempty"`
	Number int    `json:"number,omitempty"`
	URL    string `json:"url,omitempty"`
	WebURL string `json:"web_url,omitempty"`
}

type TriggeredFrom

type TriggeredFrom struct {
	BuildID           string `json:"build_id,omitempty"`
	BuildNumber       int    `json:"build_number,omitempty"`
	BuildPipelineSlug string `json:"build_pipeline_slug,omitempty"`
}

type UnblockedBy

type UnblockedBy struct {
	ID        string     `json:"id,omitempty"`
	Name      string     `json:"name,omitempty"`
	Email     string     `json:"email,omitempty"`
	AvatarURL string     `json:"avatar_url,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

UnblockedBy represents the unblocked status of a job, when present

type UpdatePackageRegistryInput

type UpdatePackageRegistryInput struct {
	Name        string                    `json:"name,omitempty"`        // The name of the package registry
	Description string                    `json:"description,omitempty"` // A description for the package registry
	Emoji       string                    `json:"emoji,omitempty"`       // An emoji for the package registry, in buildkite format (eg ":rocket:")
	Color       string                    `json:"color,omitempty"`       // A color for the package registry, in hex format (eg "#FF0000")
	OIDCPolicy  PackageRegistryOIDCPolicy `json:"oidc_policy,omitempty"` // The OIDC policy for the package registry, as a YAML or JSON string
}

type UpdatePipeline

type UpdatePipeline struct {
	// Either configuration needs to be specified as a yaml string or steps (based on what the pipeline uses)
	Configuration string `json:"configuration,omitempty"`
	Steps         []Step `json:"steps,omitempty"`

	Name                            string           `json:"name,omitempty"`
	Repository                      string           `json:"repository,omitempty"`
	DefaultBranch                   string           `json:"default_branch,omitempty"`
	Description                     string           `json:"description,omitempty"`
	ProviderSettings                ProviderSettings `json:"provider_settings,omitempty"`
	BranchConfiguration             string           `json:"branch_configuration,omitempty"`
	SkipQueuedBranchBuilds          bool             `json:"skip_queued_branch_builds,omitempty"`
	SkipQueuedBranchBuildsFilter    string           `json:"skip_queued_branch_builds_filter,omitempty"`
	CancelRunningBranchBuilds       bool             `json:"cancel_running_branch_builds,omitempty"`
	CancelRunningBranchBuildsFilter string           `json:"cancel_running_branch_builds_filter,omitempty"`
	ClusterID                       string           `json:"cluster_id,omitempty"`
	Visibility                      string           `json:"visibility,omitempty"`
	Tags                            []string         `json:"tags,omitempty"`
}

type User

type User struct {
	ID        string     `json:"id,omitempty"`
	Name      string     `json:"name,omitempty"`
	Email     string     `json:"email,omitempty"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

User represents a buildkite user.

type UserService

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

UserService handles communication with the user related methods of the buildkite API.

buildkite API docs: https://buildkite.com/docs/api

func (*UserService) CurrentUser

func (us *UserService) CurrentUser(ctx context.Context) (User, *Response, error)

CurrentUser returns the user associated with the access token being used

buildkite API docs: https://buildkite.com/docs/api

Jump to

Keyboard shortcuts

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