circleci

package
v0.0.0-...-2baebd5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	HTTPStatusCode int
	Message        string
}

APIError represents an error from CircleCI

func (*APIError) Error

func (e *APIError) Error() string

type Action

type Action struct {
	Background         bool       `json:"background"`
	BashCommand        *string    `json:"bash_command"`
	Canceled           *bool      `json:"canceled"`
	Continue           *string    `json:"continue"`
	EndTime            *time.Time `json:"end_time"`
	ExitCode           *int       `json:"exit_code"`
	Failed             *bool      `json:"failed"`
	HasOutput          bool       `json:"has_output"`
	Index              int        `json:"index"`
	InfrastructureFail *bool      `json:"infrastructure_fail"`
	Messages           []string   `json:"messages"`
	Name               string     `json:"name"`
	OutputURL          string     `json:"output_url"`
	Parallel           bool       `json:"parallel"`
	RunTimeMillis      int        `json:"run_time_millis"`
	StartTime          *time.Time `json:"start_time"`
	Status             string     `json:"status"`
	Step               int        `json:"step"`
	Timedout           *bool      `json:"timedout"`
	Truncated          bool       `json:"truncated"`
	Type               string     `json:"type"`
}

Action represents an individual action within a build step

type Build

type Build struct {
	//AllCommitDetails        []*CommitDetails  `json:"all_commit_details"`
	AuthorDate         *time.Time        `json:"author_date"`
	AuthorEmail        string            `json:"author_email"`
	AuthorName         string            `json:"author_name"`
	Body               string            `json:"body"`
	Branch             string            `json:"branch"`
	BuildNum           int               `json:"build_num"`
	BuildParameters    map[string]string `json:"build_parameters"`
	BuildTimeMillis    *int              `json:"build_time_millis"`
	BuildURL           string            `json:"build_url"`
	Canceled           bool              `json:"canceled"`
	CircleYML          *CircleYML        `json:"circle_yml"`
	CommitterDate      *time.Time        `json:"committer_date"`
	CommitterEmail     string            `json:"committer_email"`
	CommitterName      string            `json:"committer_name"`
	Compare            *string           `json:"compare"`
	DontBuild          *string           `json:"dont_build"`
	Failed             *bool             `json:"failed"`
	FeatureFlags       map[string]string `json:"feature_flags"`
	InfrastructureFail bool              `json:"infrastructure_fail"`
	IsFirstGreenBuild  bool              `json:"is_first_green_build"`
	JobName            *string           `json:"job_name"`
	Lifecycle          string            `json:"lifecycle"`
	Messages           []*Message        `json:"messages"`
	//Node                    []*Node           `json:"node"`
	OSS      bool   `json:"oss"`
	Outcome  string `json:"outcome"`
	Parallel int    `json:"parallel"`
	//Picard                  *Picard           `json:"picard"`
	Platform                string       `json:"platform"`
	Previous                *BuildStatus `json:"previous"`
	PreviousSuccessfulBuild *BuildStatus `json:"previous_successful_build"`
	//PullRequests            []*PullRequest    `json:"pull_requests"`
	QueuedAt string `json:"queued_at"`
	Reponame string `json:"reponame"`
	Retries  []int  `json:"retries"`
	RetryOf  *int   `json:"retry_of"`
	//SSHEnabled              *bool             `json:"ssh_enabled"`
	//SSHUsers                []*SSHUser        `json:"ssh_users"`
	StartTime     *time.Time `json:"start_time"`
	Status        string     `json:"status"`
	Steps         []*Step    `json:"steps"`
	StopTime      *time.Time `json:"stop_time"`
	Subject       string     `json:"subject"`
	Timedout      bool       `json:"timedout"`
	UsageQueuedAt string     `json:"usage_queued_at"`
	User          *BuildUser `json:"user"`
	Username      string     `json:"username"`
	VcsRevision   string     `json:"vcs_revision"`
	VcsTag        string     `json:"vcs_tag"`
	VCSURL        string     `json:"vcs_url"`
	Workflows     *Workflow  `json:"workflows"`
	Why           string     `json:"why"`
}

Build represents the details of a build

type BuildOutput

type BuildOutput struct {
	Message string    `json:"message"`
	Time    time.Time `json:"time"`
	Type    string    `json:"type"`
}

func GetBuildOutput

func GetBuildOutput(buildOutputURL string) ([]BuildOutput, error)

type BuildStatus

type BuildStatus struct {
	BuildTimeMillis int    `json:"build_time_millis"`
	Status          string `json:"status"`
	BuildNum        int    `json:"build_num"`
}

BuildStatus represents status information about the build Used when a short summary of previous builds is included

type BuildUser

type BuildUser struct {
	Email  *string `json:"email"`
	IsUser bool    `json:"is_user"`
	Login  string  `json:"login"`
	Name   *string `json:"name"`
}

BuildUser represents the user that triggered the build

type CircleYML

type CircleYML struct {
	String string `json:"string"`
}

CircleYML represents the serialized CircleCI YML file for a given build

type Client

type Client struct {
	BaseURL    *url.URL     // CircleCI API endpoint (defaults to DefaultEndpoint)
	Token      string       // CircleCI API token (needed for private repositories and mutative actions)
	HTTPClient *http.Client // HTTPClient to use for connecting to CircleCI (defaults to http.DefaultClient)

	Debug  bool   // debug logging enabled
	Logger Logger // logger to send debug messages on (if enabled), defaults to logging to stderr with the standard flags
}

Client is a CircleCI client Its zero value is a usable client for examining public CircleCI repositories

func (*Client) GetBuild

func (c *Client) GetBuild(vcs, account, repo string, buildNum int) (*Build, error)

GetBuild fetches a given build by number

func (*Client) GetPipeline

func (c *Client) GetPipeline(pipelineID string) (*Pipeline, error)

GetPipeline gets a specific Pipeline with the V2 API

func (*Client) GetProject

func (c *Client) GetProject(vcsProvider, account, repo string) (*Project, error)

GetProject gets a project with the v2 API

func (*Client) GetProjectPipelines

func (c *Client) GetProjectPipelines(vcsProvider, account, repo string) ([]Pipeline, error)

GetProjectPipelines gets recent pipelines for a repo with the V2 API

func (*Client) GetWorkflow

func (c *Client) GetWorkflow(workflowID string) (*Workflow, error)

GetWorkflow gets a worflow with the v2 API

func (*Client) GetWorkflowJobs

func (c *Client) GetWorkflowJobs(workflowID string) ([]Job, error)

GetWorkflowJobs gets jobs associated with a workflow with the V2 API

func (*Client) Me

func (c *Client) Me() (*User, error)

Me returns information about the current user

type GetProjectPipelinesResponse

type GetProjectPipelinesResponse struct {
	Items         []Pipeline  `json:"items"`
	NextPageToken interface{} `json:"next_page_token"`
}

type GetWorkflowJobsResponse

type GetWorkflowJobsResponse struct {
	NextPageToken interface{} `json:"next_page_token"`
	Items         []Job       `json:"items"`
}

type Job

type Job struct {
	Dependencies []string  `json:"dependencies"`
	JobNumber    int       `json:"job_number"`
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	ProjectSlug  string    `json:"project_slug"`
	Status       string    `json:"status"`
	StopTime     time.Time `json:"stop_time"`
	Type         string    `json:"type"`
	StartTime    time.Time `json:"start_time"`
}

type Logger

type Logger interface {
	Printf(fmt string, args ...interface{})
}

Logger is a minimal interface for injecting custom logging logic for debug logs

type Message

type Message struct {
	Message string `json:"message"`
	Type    string `json:"type"`
}

Message represents build messages

type Pipeline

type Pipeline struct {
	Workflows []struct {
		ID string `json:"id"`
	} `json:"workflows"`
	ID          string        `json:"id"`
	Errors      []interface{} `json:"errors"`
	ProjectSlug string        `json:"project_slug"`
	UpdatedAt   time.Time     `json:"updated_at"`
	Number      int           `json:"number"`
	State       string        `json:"state"`
	CreatedAt   time.Time     `json:"created_at"`
	Trigger     struct {
		Type       string    `json:"type"`
		ReceivedAt time.Time `json:"received_at"`
		Actor      struct {
			Login     string `json:"login"`
			AvatarURL string `json:"avatar_url"`
		} `json:"actor"`
	} `json:"trigger"`
	Vcs struct {
		ProviderName        string `json:"provider_name"`
		OriginRepositoryURL string `json:"origin_repository_url"`
		TargetRepositoryURL string `json:"target_repository_url"`
		Revision            string `json:"revision"`
		Branch              string `json:"branch"`
	} `json:"vcs"`
}

type Project

type Project struct {
	Slug             string `json:"slug"`
	Name             string `json:"name"`
	OrganizationName string `json:"organization_name"`
	VcsInfo          struct {
		VcsURL        string `json:"vcs_url"`
		Provider      string `json:"provider"`
		DefaultBranch string `json:"default_branch"`
	} `json:"vcs_info"`
}

type Step

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

Step represents an individual step in a build Will contain more than one action if the step was parallelized

type User

type User struct {
	Admin               bool      `json:"admin"`
	AllEmails           []string  `json:"all_emails"`
	AvatarURL           string    `json:"avatar_url"`
	BasicEmailPrefs     string    `json:"basic_email_prefs"`
	Containers          int       `json:"containers"`
	CreatedAt           time.Time `json:"created_at"`
	DaysLeftInTrial     int       `json:"days_left_in_trial"`
	GithubID            int       `json:"github_id"`
	GithubOauthScopes   []string  `json:"github_oauth_scopes"`
	GravatarID          *string   `json:"gravatar_id"`
	HerokuAPIKey        *string   `json:"heroku_api_key"`
	LastViewedChangelog time.Time `json:"last_viewed_changelog"`
	Login               string    `json:"login"`
	Name                *string   `json:"name"`
	Parallelism         int       `json:"parallelism"`
	Plan                *string   `json:"plan"`
	//Projects            map[string]*UserProject `json:"projects"`
	SelectedEmail *string   `json:"selected_email"`
	SignInCount   int       `json:"sign_in_count"`
	TrialEnd      time.Time `json:"trial_end"`
}

User represents a CircleCI user

type Workflow

type Workflow struct {
	CreatedAt      time.Time `json:"created_at"`
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	PipelineID     string    `json:"pipeline_id"`
	PipelineNumber int       `json:"pipeline_number"`
	ProjectSlug    string    `json:"project_slug"`
	Status         string    `json:"status"`
	StoppedAt      time.Time `json:"stopped_at"`

	// v1
	JobName        string    `json:"job_name"`
	JobID          string    `json:"job_id"`
	UpstreamJobIds []*string `json:"upstream_job_ids"`
	WorkflowID     string    `json:"workflow_id"`
	WorkspaceID    string    `json:"workspace_id"`
	WorkflowName   string    `json:"workflow_name"`
}

Jump to

Keyboard shortcuts

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