circleci

package
v0.0.0-...-873fc5a Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package circleci provides a Client for making requests to CircleCI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildAction

type BuildAction struct {
	OutputURL string `json:"output_url"`
	HasOutput bool   `json:"has_output"`
}

BuildAction is used to Marshal the response from CircleCI when retreiving the output of a build. A BuildAction contains a URL that has to the full output of a single action.

https://circleci.com/docs/api/v1/?shell#single-job

type BuildResponse

type BuildResponse struct {
	Steps []*BuildStep `json:"steps"`
}

BuildResponse is used to Marshal the response from CircleCI when retreiving the output of a Build.

https://circleci.com/docs/api/v1/?shell#single-job

type BuildStep

type BuildStep struct {
	Name    string         `json:"name"`
	Actions []*BuildAction `json:"actions"`
}

BuildStep is used to Marshal the response from CircleCI when retreiving the output of a Build. A Build can have multiple steps.

https://circleci.com/docs/api/v1/?shell#single-job

type Client

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

Client is used to make HTTP requests to CircleCI.

func New

func New(client *http.Client, rootURL string, project *Project, token string) *Client

New creates a Client.

func (*Client) Build

func (c *Client) Build(ctx context.Context, num uint64) (*BuildResponse, error)

Build retrieves the build for the given build number.

https://circleci.com/docs/api/v1/?shell#single-job

func (*Client) BuildActionOutput

func (c *Client) BuildActionOutput(ctx context.Context, b *BuildAction) (string, error)

BuildActionOutput is used to get the full output for a BuildAction. If the BuildAction has output, it will retrieve the full output from the OutputURL.

func (*Client) Pipelines

func (c *Client) Pipelines(ctx context.Context, branch string, limit uint64) ([]*Pipeline, error)

Pipelines returns a summary of the most recent Pipeline execution for the given branch.

func (*Client) RetryWorkflow

func (c *Client) RetryWorkflow(ctx context.Context, workflowID string) (string, error)

RetryWorkflow will re-run the given workflow. The endpoint documentation appears to allow specifying the job ids to presumably only run a single job in a workflow. However, this does not seem to be the behavior, instead it runs the full workflow even if a single job is specified.

https://circleci.com/docs/api/v2/#operation/rerunWorkflow

type Job

type Job struct {
	ID     string `json:"id"`
	Number uint64 `json:"job_number"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

Job provides a summary of a Job. A workflow contains one or more Jobs.

type Pipeline

type Pipeline struct {
	ID        string      `json:"id"`
	Number    uint64      `json:"number"`
	State     string      `json:"state"`
	Updated   *time.Time  `json:"updated_at"`
	Workflows []*Workflow `json:"-"`
}

Pipeline provides a summary of a single pipeline execution.

type Project

type Project struct {
	Name         string
	Organization string
	VCSType      string
}

Project represents a CircleCI project.

type Workflow

type Workflow struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
	Jobs   []*Job `json:"-"`
}

Workflow provides a summary of a Workflow. A pipeline is made up of one or more workflows. Each workflow has one or more Jobs.

Jump to

Keyboard shortcuts

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