atc

package
v1.6.1-0...-a0f72b6 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

README ¶

atc badge

air traffic control - web ui and build scheduler

Air Traffic Control

by NATS Press Office

reporting issues and requesting features

please report all issues and feature requests in concourse/concourse

about

atc is the brain of Concourse. It's responsible for scheduling builds across the cluster of workers, providing the API for the system, as well as serving the web interface.

It can be scaled horizontally behind a load balancer in order to scale the system.

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	TeamCacheName    = "teams"
	TeamCacheChannel = "team_cache"
)
View Source
const (
	ComponentScheduler                  = "scheduler"
	ComponentBuildTracker               = "tracker"
	ComponentLidarScanner               = "scanner"
	ComponentBuildReaper                = "reaper"
	ComponentSyslogDrainer              = "drainer"
	ComponentCollectorAccessTokens      = "collector_access_tokens"
	ComponentCollectorArtifacts         = "collector_artifacts"
	ComponentCollectorBuilds            = "collector_builds"
	ComponentCollectorCheckSessions     = "collector_check_sessions"
	ComponentCollectorChecks            = "collector_checks"
	ComponentCollectorContainers        = "collector_containers"
	ComponentCollectorResourceCacheUses = "collector_resource_cache_uses"
	ComponentCollectorResourceCaches    = "collector_resource_caches"
	ComponentCollectorTaskCaches        = "collector_task_caches"
	ComponentCollectorResourceConfigs   = "collector_resource_configs"
	ComponentCollectorVolumes           = "collector_volumes"
	ComponentCollectorWorkers           = "collector_workers"
	ComponentCollectorPipelines         = "collector_pipelines"
	ComponentPipelinePauser             = "pipeline_pauser"
	ComponentBeingWatchedBuildMarker    = "being_watched_build_marker"
)
View Source
const (
	ContainerStateCreated    = "created"
	ContainerStateCreating   = "creating"
	ContainerStateDestroying = "destroying"
	ContainerStateFailed     = "failed"
)
View Source
const (
	LinkRelNext     = "next"
	LinkRelPrevious = "previous"

	PaginationQueryTimestamps = "timestamps"
	PaginationQueryFrom       = "from"
	PaginationQueryTo         = "to"
	PaginationQueryLimit      = "limit"
	PaginationWebLimit        = 100
	PaginationAPIDefaultLimit = 100
)
View Source
const (
	SaveConfig = "SaveConfig"
	GetConfig  = "GetConfig"

	GetBuild            = "GetBuild"
	GetBuildPlan        = "GetBuildPlan"
	CreateBuild         = "CreateBuild"
	ListBuilds          = "ListBuilds"
	BuildEvents         = "BuildEvents"
	BuildResources      = "BuildResources"
	AbortBuild          = "AbortBuild"
	GetBuildPreparation = "GetBuildPreparation"
	SetBuildComment     = "SetBuildComment"

	GetJob         = "GetJob"
	CreateJobBuild = "CreateJobBuild"
	RerunJobBuild  = "RerunJobBuild"
	ListAllJobs    = "ListAllJobs"
	ListJobs       = "ListJobs"
	ListJobBuilds  = "ListJobBuilds"
	ListJobInputs  = "ListJobInputs"
	GetJobBuild    = "GetJobBuild"
	PauseJob       = "PauseJob"
	UnpauseJob     = "UnpauseJob"
	ScheduleJob    = "ScheduleJob"
	GetVersionsDB  = "GetVersionsDB"
	JobBadge       = "JobBadge"
	MainJobBadge   = "MainJobBadge"

	ClearTaskCache = "ClearTaskCache"

	ListAllResources          = "ListAllResources"
	ListSharedForResource     = "ListSharedForResource"
	ListSharedForResourceType = "ListSharedForResourceType"
	ListResources             = "ListResources"
	ListResourceTypes         = "ListResourceTypes"
	GetResource               = "GetResource"
	CheckResource             = "CheckResource"
	CheckResourceWebHook      = "CheckResourceWebHook"
	CheckResourceType         = "CheckResourceType"
	CheckPrototype            = "CheckPrototype"

	ListResourceVersions           = "ListResourceVersions"
	ClearResourceVersions          = "ClearResourceVersions"
	ClearResourceTypeVersions      = "ClearResourceTypeVersions"
	GetResourceVersion             = "GetResourceVersion"
	EnableResourceVersion          = "EnableResourceVersion"
	DisableResourceVersion         = "DisableResourceVersion"
	PinResourceVersion             = "PinResourceVersion"
	UnpinResource                  = "UnpinResource"
	SetPinCommentOnResource        = "SetPinCommentOnResource"
	ListBuildsWithVersionAsInput   = "ListBuildsWithVersionAsInput"
	ListBuildsWithVersionAsOutput  = "ListBuildsWithVersionAsOutput"
	ClearResourceCache             = "ClearResourceCache"
	GetDownstreamResourceCausality = "GetDownstreamResourceCausality"
	GetUpstreamResourceCausality   = "GetUpstreamResourceCausality"

	GetCC = "GetCC"

	ListAllPipelines          = "ListAllPipelines"
	ListPipelines             = "ListPipelines"
	GetPipeline               = "GetPipeline"
	DeletePipeline            = "DeletePipeline"
	OrderPipelines            = "OrderPipelines"
	OrderPipelinesWithinGroup = "OrderPipelinesWithinGroup"
	PausePipeline             = "PausePipeline"
	ArchivePipeline           = "ArchivePipeline"
	UnpausePipeline           = "UnpausePipeline"
	ExposePipeline            = "ExposePipeline"
	HidePipeline              = "HidePipeline"
	RenamePipeline            = "RenamePipeline"
	ListPipelineBuilds        = "ListPipelineBuilds"
	CreatePipelineBuild       = "CreatePipelineBuild"
	PipelineBadge             = "PipelineBadge"

	RegisterWorker  = "RegisterWorker"
	LandWorker      = "LandWorker"
	RetireWorker    = "RetireWorker"
	PruneWorker     = "PruneWorker"
	HeartbeatWorker = "HeartbeatWorker"
	ListWorkers     = "ListWorkers"
	DeleteWorker    = "DeleteWorker"

	SetLogLevel = "SetLogLevel"
	GetLogLevel = "GetLogLevel"

	DownloadCLI  = "DownloadCLI"
	GetInfo      = "GetInfo"
	GetInfoCreds = "GetInfoCreds"

	ListContainers           = "ListContainers"
	GetContainer             = "GetContainer"
	HijackContainer          = "HijackContainer"
	ListDestroyingContainers = "ListDestroyingContainers"
	ReportWorkerContainers   = "ReportWorkerContainers"

	ListVolumes           = "ListVolumes"
	ListDestroyingVolumes = "ListDestroyingVolumes"
	ReportWorkerVolumes   = "ReportWorkerVolumes"

	ListTeams      = "ListTeams"
	GetTeam        = "GetTeam"
	SetTeam        = "SetTeam"
	RenameTeam     = "RenameTeam"
	DestroyTeam    = "DestroyTeam"
	ListTeamBuilds = "ListTeamBuilds"

	CreateArtifact     = "CreateArtifact"
	GetArtifact        = "GetArtifact"
	ListBuildArtifacts = "ListBuildArtifacts"

	GetUser              = "GetUser"
	ListActiveUsersSince = "ListActiveUsersSince"

	SetWall   = "SetWall"
	GetWall   = "GetWall"
	ClearWall = "ClearWall"
)
View Source
const (
	ClearTaskCacheQueryPath = "cache_path"
	SaveConfigCheckCreds    = "check_creds"
)
View Source
const ConfigVersionHeader = "X-Concourse-Config-Version"
View Source
const DefaultTeamName = "main"
View Source
const InputsAll = "all"
View Source
const InputsDetect = "detect"
View Source
const MaxInFlightAll = "all"
View Source
const VersionEvery = "every"
View Source
const VersionLatest = "latest"

Variables ¶

View Source
var (
	EnableGlobalResources                bool
	EnableRedactSecrets                  bool
	EnableBuildRerunWhenWorkerDisappears bool
	EnableAcrossStep                     bool
	EnablePipelineInstances              bool
	EnableCacheStreamedVolumes           bool
	EnableResourceCausality              bool
)
View Source
var (
	DefaultCheckInterval   time.Duration
	DefaultWebhookInterval time.Duration
)
View Source
var (
	ErrAuthConfigEmpty   = errors.New("auth config for the team must not be empty")
	ErrAuthConfigInvalid = errors.New("auth config for the team does not have users and groups configured")
)
View Source
var ErrInvalidWorkerVersion = errors.New("invalid worker version, only numeric characters are allowed")
View Source
var ErrMissingWorkerGardenAddress = errors.New("missing garden address")
View Source
var ErrNoCoreStepDeclared = errors.New("no core step type declared (e.g. get, put, task, etc.)")
View Source
var ErrNoStepConfigured = errors.New("no step configured")

ErrNoStepConfigured is returned when a step does not have any keys that indicate its step type.

View Source
var ErrNoWorkers = errors.New("no workers available for checking")
View Source
var Routes = rata.Routes([]rata.Route{
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/config", Method: "PUT", Name: SaveConfig},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/config", Method: "GET", Name: GetConfig},

	{Path: "/api/v1/teams/:team_name/builds", Method: "POST", Name: CreateBuild},

	{Path: "/api/v1/builds", Method: "GET", Name: ListBuilds},
	{Path: "/api/v1/builds/:build_id", Method: "GET", Name: GetBuild},
	{Path: "/api/v1/builds/:build_id/plan", Method: "GET", Name: GetBuildPlan},
	{Path: "/api/v1/builds/:build_id/events", Method: "GET", Name: BuildEvents},
	{Path: "/api/v1/builds/:build_id/resources", Method: "GET", Name: BuildResources},
	{Path: "/api/v1/builds/:build_id/abort", Method: "PUT", Name: AbortBuild},
	{Path: "/api/v1/builds/:build_id/preparation", Method: "GET", Name: GetBuildPreparation},
	{Path: "/api/v1/builds/:build_id/artifacts", Method: "GET", Name: ListBuildArtifacts},
	{Path: "/api/v1/builds/:build_id/comment", Method: "PUT", Name: SetBuildComment},

	{Path: "/api/v1/jobs", Method: "GET", Name: ListAllJobs},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs", Method: "GET", Name: ListJobs},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name", Method: "GET", Name: GetJob},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/builds", Method: "GET", Name: ListJobBuilds},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/builds", Method: "POST", Name: CreateJobBuild},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/builds/:build_name", Method: "POST", Name: RerunJobBuild},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/inputs", Method: "GET", Name: ListJobInputs},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/builds/:build_name", Method: "GET", Name: GetJobBuild},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/pause", Method: "PUT", Name: PauseJob},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/unpause", Method: "PUT", Name: UnpauseJob},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/schedule", Method: "PUT", Name: ScheduleJob},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/badge", Method: "GET", Name: JobBadge},
	{Path: "/api/v1/pipelines/:pipeline_name/jobs/:job_name/badge", Method: "GET", Name: MainJobBadge},

	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/jobs/:job_name/tasks/:step_name/cache", Method: "DELETE", Name: ClearTaskCache},

	{Path: "/api/v1/pipelines", Method: "GET", Name: ListAllPipelines},
	{Path: "/api/v1/teams/:team_name/pipelines", Method: "GET", Name: ListPipelines},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name", Method: "GET", Name: GetPipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name", Method: "DELETE", Name: DeletePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/ordering", Method: "PUT", Name: OrderPipelines},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/ordering", Method: "PUT", Name: OrderPipelinesWithinGroup},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/pause", Method: "PUT", Name: PausePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/archive", Method: "PUT", Name: ArchivePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/unpause", Method: "PUT", Name: UnpausePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/expose", Method: "PUT", Name: ExposePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/hide", Method: "PUT", Name: HidePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/versions-db", Method: "GET", Name: GetVersionsDB},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/rename", Method: "PUT", Name: RenamePipeline},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/builds", Method: "GET", Name: ListPipelineBuilds},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/builds", Method: "POST", Name: CreatePipelineBuild},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/badge", Method: "GET", Name: PipelineBadge},

	{Path: "/api/v1/resources", Method: "GET", Name: ListAllResources},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources", Method: "GET", Name: ListResources},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/shared", Method: "GET", Name: ListSharedForResource},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resource-types/:resource_type_name/shared", Method: "GET", Name: ListSharedForResourceType},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resource-types", Method: "GET", Name: ListResourceTypes},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name", Method: "GET", Name: GetResource},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/check", Method: "POST", Name: CheckResource},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/check/webhook", Method: "POST", Name: CheckResourceWebHook},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resource-types/:resource_type_name/check", Method: "POST", Name: CheckResourceType},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/prototypes/:prototype_name/check", Method: "POST", Name: CheckPrototype},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/cache", Method: "DELETE", Name: ClearResourceCache},

	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions", Method: "GET", Name: ListResourceVersions},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions", Method: "DELETE", Name: ClearResourceVersions},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resource-types/:resource_type_name/versions", Method: "DELETE", Name: ClearResourceTypeVersions},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id", Method: "GET", Name: GetResourceVersion},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/enable", Method: "PUT", Name: EnableResourceVersion},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/disable", Method: "PUT", Name: DisableResourceVersion},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/pin", Method: "PUT", Name: PinResourceVersion},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/unpin", Method: "PUT", Name: UnpinResource},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/pin_comment", Method: "PUT", Name: SetPinCommentOnResource},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/input_to", Method: "GET", Name: ListBuildsWithVersionAsInput},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/output_of", Method: "GET", Name: ListBuildsWithVersionAsOutput},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/downstream", Method: "GET", Name: GetDownstreamResourceCausality},
	{Path: "/api/v1/teams/:team_name/pipelines/:pipeline_name/resources/:resource_name/versions/:resource_config_version_id/upstream", Method: "GET", Name: GetUpstreamResourceCausality},

	{Path: "/api/v1/teams/:team_name/cc.xml", Method: "GET", Name: GetCC},

	{Path: "/api/v1/workers", Method: "GET", Name: ListWorkers},
	{Path: "/api/v1/workers", Method: "POST", Name: RegisterWorker},
	{Path: "/api/v1/workers/:worker_name/land", Method: "PUT", Name: LandWorker},
	{Path: "/api/v1/workers/:worker_name/retire", Method: "PUT", Name: RetireWorker},
	{Path: "/api/v1/workers/:worker_name/prune", Method: "PUT", Name: PruneWorker},
	{Path: "/api/v1/workers/:worker_name/heartbeat", Method: "PUT", Name: HeartbeatWorker},
	{Path: "/api/v1/workers/:worker_name", Method: "DELETE", Name: DeleteWorker},

	{Path: "/api/v1/log-level", Method: "GET", Name: GetLogLevel},
	{Path: "/api/v1/log-level", Method: "PUT", Name: SetLogLevel},

	{Path: "/api/v1/cli", Method: "GET", Name: DownloadCLI},
	{Path: "/api/v1/info", Method: "GET", Name: GetInfo},
	{Path: "/api/v1/info/creds", Method: "GET", Name: GetInfoCreds},

	{Path: "/api/v1/user", Method: "GET", Name: GetUser},
	{Path: "/api/v1/users", Method: "GET", Name: ListActiveUsersSince},

	{Path: "/api/v1/containers/destroying", Method: "GET", Name: ListDestroyingContainers},
	{Path: "/api/v1/containers/report", Method: "PUT", Name: ReportWorkerContainers},
	{Path: "/api/v1/teams/:team_name/containers", Method: "GET", Name: ListContainers},
	{Path: "/api/v1/teams/:team_name/containers/:id", Method: "GET", Name: GetContainer},
	{Path: "/api/v1/teams/:team_name/containers/:id/hijack", Method: "GET", Name: HijackContainer},

	{Path: "/api/v1/teams/:team_name/volumes", Method: "GET", Name: ListVolumes},
	{Path: "/api/v1/volumes/destroying", Method: "GET", Name: ListDestroyingVolumes},
	{Path: "/api/v1/volumes/report", Method: "PUT", Name: ReportWorkerVolumes},

	{Path: "/api/v1/teams", Method: "GET", Name: ListTeams},
	{Path: "/api/v1/teams/:team_name", Method: "GET", Name: GetTeam},
	{Path: "/api/v1/teams/:team_name", Method: "PUT", Name: SetTeam},
	{Path: "/api/v1/teams/:team_name/rename", Method: "PUT", Name: RenameTeam},
	{Path: "/api/v1/teams/:team_name", Method: "DELETE", Name: DestroyTeam},
	{Path: "/api/v1/teams/:team_name/builds", Method: "GET", Name: ListTeamBuilds},

	{Path: "/api/v1/teams/:team_name/artifacts", Method: "POST", Name: CreateArtifact},
	{Path: "/api/v1/teams/:team_name/artifacts/:artifact_id", Method: "GET", Name: GetArtifact},

	{Path: "/api/v1/wall", Method: "GET", Name: GetWall},
	{Path: "/api/v1/wall", Method: "PUT", Name: SetWall},
	{Path: "/api/v1/wall", Method: "DELETE", Name: ClearWall},
})
View Source
var StepPrecedence = []StepDetector{
	{
		Key: "ensure",
		New: func() StepConfig { return &EnsureStep{} },
	},
	{
		Key: "on_error",
		New: func() StepConfig { return &OnErrorStep{} },
	},
	{
		Key: "on_abort",
		New: func() StepConfig { return &OnAbortStep{} },
	},
	{
		Key: "on_failure",
		New: func() StepConfig { return &OnFailureStep{} },
	},
	{
		Key: "on_success",
		New: func() StepConfig { return &OnSuccessStep{} },
	},
	{
		Key: "across",
		New: func() StepConfig { return &AcrossStep{} },
	},
	{
		Key: "attempts",
		New: func() StepConfig { return &RetryStep{} },
	},
	{
		Key: "run",
		New: func() StepConfig { return &RunStep{} },
	},
	{
		Key: "task",
		New: func() StepConfig { return &TaskStep{} },
	},
	{
		Key: "put",
		New: func() StepConfig { return &PutStep{} },
	},
	{
		Key: "get",
		New: func() StepConfig { return &GetStep{} },
	},
	{
		Key: "timeout",
		New: func() StepConfig { return &TimeoutStep{} },
	},
	{
		Key: "set_pipeline",
		New: func() StepConfig { return &SetPipelineStep{} },
	},
	{
		Key: "load_var",
		New: func() StepConfig { return &LoadVarStep{} },
	},
	{
		Key: "try",
		New: func() StepConfig { return &TryStep{} },
	},
	{
		Key: "do",
		New: func() StepConfig { return &DoStep{} },
	},
	{
		Key: "in_parallel",
		New: func() StepConfig { return &InParallelStep{} },
	},
}

StepPrecedence is a static list of all of the step types, listed in the order that they should be parsed. Broadly, modifiers are parsed first - with some important inter-modifier precedence - while core step types are parsed last.

Functions ¶

func DefaultSSHConfig ¶

func DefaultSSHConfig() ssh.Config

func DefaultTLSConfig ¶

func DefaultTLSConfig() *tls.Config

func FeatureFlags ¶

func FeatureFlags() map[string]bool

func FetchImagePlan ¶

func FetchImagePlan(planID PlanID, image ImageResource, resourceTypes ResourceTypes, stepTags Tags, skipInterval bool, checkEvery *CheckEvery) (Plan, *Plan)

func LoadBaseResourceTypeDefaults ¶

func LoadBaseResourceTypeDefaults(defaults map[string]Source)

func UnmarshalConfig ¶

func UnmarshalConfig(payload []byte, config interface{}) error

Types ¶

type AcrossPlan ¶

type AcrossPlan struct {
	Vars []AcrossVar `json:"vars"`
	// SubStepTemplate contains the uninterpolated JSON encoded plan for the
	// substep. This template must be interpolated for each substep using the
	// across vars, and the plan IDs must be updated.
	SubStepTemplate string `json:"substep_template"`
	FailFast        bool   `json:"fail_fast,omitempty"`
}

func (AcrossPlan) Public ¶

func (plan AcrossPlan) Public() *json.RawMessage

type AcrossStep ¶

type AcrossStep struct {
	Step     StepConfig        `json:"-"`
	Vars     []AcrossVarConfig `json:"across"`
	FailFast bool              `json:"fail_fast,omitempty"`
}

func (*AcrossStep) ParseJSON ¶

func (step *AcrossStep) ParseJSON(data []byte) error

func (*AcrossStep) Unwrap ¶

func (step *AcrossStep) Unwrap() StepConfig

func (*AcrossStep) Visit ¶

func (step *AcrossStep) Visit(v StepVisitor) error

func (*AcrossStep) Wrap ¶

func (step *AcrossStep) Wrap(sub StepConfig)

type AcrossVar ¶

type AcrossVar struct {
	Var         string             `json:"name"`
	Values      interface{}        `json:"values,omitempty"`
	MaxInFlight *MaxInFlightConfig `json:"max_in_flight,omitempty"`
}

type AcrossVarConfig ¶

type AcrossVarConfig struct {
	Var         string             `json:"var"`
	Values      interface{}        `json:"values,omitempty"`
	MaxInFlight *MaxInFlightConfig `json:"max_in_flight,omitempty"`
}

func (*AcrossVarConfig) UnmarshalJSON ¶

func (config *AcrossVarConfig) UnmarshalJSON(data []byte) error

type ArtifactInputPlan ¶

type ArtifactInputPlan struct {
	ArtifactID int    `json:"artifact_id"`
	Name       string `json:"name"`
}

func (ArtifactInputPlan) Public ¶

func (plan ArtifactInputPlan) Public() *json.RawMessage

type ArtifactOutputPlan ¶

type ArtifactOutputPlan struct {
	Name string `json:"name"`
}

func (ArtifactOutputPlan) Public ¶

func (plan ArtifactOutputPlan) Public() *json.RawMessage

type Build ¶

type Build struct {
	ID                   int           `json:"id"`
	TeamName             string        `json:"team_name"`
	Name                 string        `json:"name"`
	Status               BuildStatus   `json:"status"`
	APIURL               string        `json:"api_url"`
	Comment              string        `json:"comment,omitempty"`
	JobName              string        `json:"job_name,omitempty"`
	ResourceName         string        `json:"resource_name,omitempty"`
	PipelineID           int           `json:"pipeline_id,omitempty"`
	PipelineName         string        `json:"pipeline_name,omitempty"`
	PipelineInstanceVars InstanceVars  `json:"pipeline_instance_vars,omitempty"`
	StartTime            int64         `json:"start_time,omitempty"`
	EndTime              int64         `json:"end_time,omitempty"`
	ReapTime             int64         `json:"reap_time,omitempty"`
	RerunNumber          int           `json:"rerun_number,omitempty"`
	RerunOf              *RerunOfBuild `json:"rerun_of,omitempty"`
	CreatedBy            *string       `json:"created_by,omitempty"`
}

func (Build) Abortable ¶

func (b Build) Abortable() bool

func (Build) IsRunning ¶

func (b Build) IsRunning() bool

func (Build) OneOff ¶

func (b Build) OneOff() bool

type BuildInput ¶

type BuildInput struct {
	Name     string   `json:"name"`
	Resource string   `json:"resource"`
	Type     string   `json:"type"`
	Source   Source   `json:"source"`
	Params   Params   `json:"params,omitempty"`
	Version  Version  `json:"version"`
	Tags     []string `json:"tags,omitempty"`
}

type BuildInputsOutputs ¶

type BuildInputsOutputs struct {
	Inputs  []PublicBuildInput  `json:"inputs"`
	Outputs []PublicBuildOutput `json:"outputs"`
}

type BuildLogRetention ¶

type BuildLogRetention struct {
	Builds                 int `json:"builds,omitempty"`
	MinimumSucceededBuilds int `json:"minimum_succeeded_builds,omitempty"`
	Days                   int `json:"days,omitempty"`
}

type BuildPreparation ¶

type BuildPreparation struct {
	BuildID             int                               `json:"build_id"`
	PausedPipeline      BuildPreparationStatus            `json:"paused_pipeline"`
	PausedJob           BuildPreparationStatus            `json:"paused_job"`
	MaxRunningBuilds    BuildPreparationStatus            `json:"max_running_builds"`
	Inputs              map[string]BuildPreparationStatus `json:"inputs"`
	InputsSatisfied     BuildPreparationStatus            `json:"inputs_satisfied"`
	MissingInputReasons MissingInputReasons               `json:"missing_input_reasons"`
}

type BuildPreparationStatus ¶

type BuildPreparationStatus string
const (
	BuildPreparationStatusUnknown     BuildPreparationStatus = "unknown"
	BuildPreparationStatusBlocking    BuildPreparationStatus = "blocking"
	BuildPreparationStatusNotBlocking BuildPreparationStatus = "not_blocking"
)

type BuildStatus ¶

type BuildStatus string
const (
	StatusStarted   BuildStatus = "started"
	StatusPending   BuildStatus = "pending"
	StatusSucceeded BuildStatus = "succeeded"
	StatusFailed    BuildStatus = "failed"
	StatusErrored   BuildStatus = "errored"
	StatusAborted   BuildStatus = "aborted"
)

func (BuildStatus) String ¶

func (status BuildStatus) String() string

type BuildSummary ¶

type BuildSummary struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	Status BuildStatus `json:"status"`

	StartTime int64 `json:"start_time,omitempty"`
	EndTime   int64 `json:"end_time,omitempty"`

	TeamName string `json:"team_name"`

	PipelineID           int          `json:"pipeline_id"`
	PipelineName         string       `json:"pipeline_name"`
	PipelineInstanceVars InstanceVars `json:"pipeline_instance_vars,omitempty"`

	JobName string `json:"job_name,omitempty"`

	PublicPlan *json.RawMessage `json:"plan,omitempty"`
}

type CPULimit ¶

type CPULimit uint64

func (*CPULimit) UnmarshalJSON ¶

func (c *CPULimit) UnmarshalJSON(data []byte) error

type Causality ¶

type Causality struct {
	Jobs             []CausalityJob             `json:"jobs"`
	Builds           []CausalityBuild           `json:"builds"`
	Resources        []CausalityResource        `json:"resources"`
	ResourceVersions []CausalityResourceVersion `json:"resource_versions"`
}

type CausalityBuild ¶

type CausalityBuild struct {
	ID     int         `json:"id"`
	Name   string      `json:"name"`
	JobId  int         `json:"job_id"`
	Status BuildStatus `json:"status"`

	ResourceVersionIDs []int `json:"resource_version_ids,omitempty"`
}

type CausalityJob ¶

type CausalityJob struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	BuildIDs []int `json:"build_ids,omitempty"`
}

type CausalityResource ¶

type CausalityResource struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	VersionIDs []int `json:"version_ids,omitempty"`
}

type CausalityResourceVersion ¶

type CausalityResourceVersion struct {
	ID         int     `json:"id"`
	ResourceID int     `json:"resource_id"`
	Version    Version `json:"version"`

	BuildIDs []int `json:"build_ids,omitempty"`
}

type CheckEvery ¶

type CheckEvery struct {
	Never    bool
	Interval time.Duration
}

func (*CheckEvery) MarshalJSON ¶

func (c *CheckEvery) MarshalJSON() ([]byte, error)

func (*CheckEvery) UnmarshalJSON ¶

func (c *CheckEvery) UnmarshalJSON(checkEvery []byte) error

type CheckPlan ¶

type CheckPlan struct {
	// The name of the step.
	Name string `json:"name"`

	// The resource config to check.
	Type   string `json:"type"`
	Source Source `json:"source"`

	// Information needed for fetching the image
	TypeImage TypeImage `json:"image"`

	// The version to check from. If not specified, defaults to the latest
	// version of the config.
	FromVersion Version `json:"from_version,omitempty"`

	// A pipeline resource, resource type, or prototype to assign the config to.
	Resource     string `json:"resource,omitempty"`
	ResourceType string `json:"resource_type,omitempty"`
	Prototype    string `json:"prototype,omitempty"`

	// The interval on which to check - if it has not elapsed since the config
	// was last checked, and the build has not been manually triggered, the check
	// will be skipped. It will also be set as Never if the user has specified
	// for it to not be checked periodically.
	Interval CheckEvery `json:"interval,omitempty"`

	// If set, the check interval will not be respected, (i.e. a new check will
	// be run even if the interval has not elapsed).
	SkipInterval bool `json:"skip_interval,omitempty"`

	// A timeout to enforce on the resource `check` process. Note that fetching
	// the resource's image does not count towards the timeout.
	Timeout string `json:"timeout,omitempty"`

	// Worker tags to influence placement of the container.
	Tags Tags `json:"tags,omitempty"`
}

func (CheckPlan) IsResourceCheck ¶

func (plan CheckPlan) IsResourceCheck() bool

func (CheckPlan) Public ¶

func (plan CheckPlan) Public() *json.RawMessage

type CheckRequestBody ¶

type CheckRequestBody struct {
	From    Version `json:"from"`
	Shallow bool    `json:"shallow"`
}

type ClearResourceCacheResponse ¶

type ClearResourceCacheResponse struct {
	CachesRemoved int64 `json:"caches_removed"`
}

type ClearTaskCacheResponse ¶

type ClearTaskCacheResponse struct {
	CachesRemoved int64 `json:"caches_removed"`
}

type ClearVersionsResponse ¶

type ClearVersionsResponse struct {
	VersionsRemoved int64 `json:"versions_removed"`
}

type CoercedString ¶

type CoercedString string

func (*CoercedString) UnmarshalJSON ¶

func (cs *CoercedString) UnmarshalJSON(p []byte) error

type Component ¶

type Component struct {
	Name     string
	Interval time.Duration
}

type Config ¶

type Config struct {
	Groups        GroupConfigs     `json:"groups,omitempty"`
	VarSources    VarSourceConfigs `json:"var_sources,omitempty"`
	Resources     ResourceConfigs  `json:"resources,omitempty"`
	ResourceTypes ResourceTypes    `json:"resource_types,omitempty"`
	Prototypes    Prototypes       `json:"prototypes,omitempty"`
	Jobs          JobConfigs       `json:"jobs,omitempty"`
	Display       *DisplayConfig   `json:"display,omitempty"`
}

func (Config) Diff ¶

func (c Config) Diff(out io.Writer, newConfig Config) bool

func (Config) JobIsPublic ¶

func (config Config) JobIsPublic(jobName string) (bool, error)

type ConfigResponse ¶

type ConfigResponse struct {
	Config Config `json:"config"`
}

type ConfigWarning ¶

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

func ValidateIdentifier ¶

func ValidateIdentifier(identifier string, context ...string) (*ConfigWarning, error)

type Container ¶

type Container struct {
	ID         string `json:"id"`
	WorkerName string `json:"worker_name"`

	State string `json:"state,omitempty"`
	Type  string `json:"type,omitempty"`

	StepName string `json:"step_name,omitempty"`
	Attempt  string `json:"attempt,omitempty"`

	PipelineID     int `json:"pipeline_id,omitempty"`
	JobID          int `json:"job_id,omitempty"`
	BuildID        int `json:"build_id,omitempty"`
	ResourceID     int `json:"resource_id,omitempty"`
	ResourceTypeID int `json:"resource_type_id,omitempty"`

	PipelineName         string       `json:"pipeline_name,omitempty"`
	PipelineInstanceVars InstanceVars `json:"pipeline_instance_vars,omitempty"`

	JobName          string `json:"job_name,omitempty"`
	BuildName        string `json:"build_name,omitempty"`
	ResourceName     string `json:"resource_name,omitempty"`
	ResourceTypeName string `json:"resource_type_name,omitempty"`

	User             string `json:"user,omitempty"`
	WorkingDirectory string `json:"working_directory,omitempty"`

	ExpiresIn string `json:"expires_in,omitempty"`
}

type ContainerLimits ¶

type ContainerLimits struct {
	CPU    *CPULimit    `json:"cpu,omitempty"`
	Memory *MemoryLimit `json:"memory,omitempty"`
}

type ContextKey ¶

type ContextKey string

When using a context in your package, instead of a string use this type

type DebugBuildInput ¶

type DebugBuildInput struct {
	DebugResourceVersion
	BuildID   int
	JobID     int
	InputName string
}

type DebugBuildOutput ¶

type DebugBuildOutput struct {
	DebugResourceVersion
	BuildID int
	JobID   int
}

type DebugBuildRerun ¶

type DebugBuildRerun struct {
	BuildID int
	JobID   int
	RerunOf int
}

type DebugJob ¶

type DebugJob struct {
	Name string
	ID   int
}

type DebugResource ¶

type DebugResource struct {
	Name    string
	ID      int
	ScopeID *int
}

type DebugResourceVersion ¶

type DebugResourceVersion struct {
	VersionID  int
	ResourceID int
	CheckOrder int

	// not present pre-6.0
	ScopeID int
}

type DebugVersionsDB ¶

type DebugVersionsDB struct {
	Jobs             []DebugJob
	Resources        []DebugResource
	ResourceVersions []DebugResourceVersion
	BuildOutputs     []DebugBuildOutput
	BuildInputs      []DebugBuildInput
	BuildReruns      []DebugBuildRerun

	// backwards-compatibility with pre-6.0 VersionsDB
	LegacyJobIDs      map[string]int `json:"JobIDs,omitempty"`
	LegacyResourceIDs map[string]int `json:"ResourceIDs,omitempty"`
}

type DependentGetPlan ¶

type DependentGetPlan struct {
	Type     string `json:"type"`
	Name     string `json:"name,omitempty"`
	Resource string `json:"resource"`
}

func (DependentGetPlan) Public ¶

func (plan DependentGetPlan) Public() *json.RawMessage

type Diff ¶

type Diff struct {
	Before interface{}
	After  interface{}
}

func (Diff) Render ¶

func (diff Diff) Render(to io.Writer, label string)

type Diffs ¶

type Diffs []Diff

type DisplayConfig ¶

type DisplayConfig struct {
	BackgroundImage string `json:"background_image,omitempty"`
}

type DisplayDiff ¶

type DisplayDiff struct {
	Before *DisplayConfig
	After  *DisplayConfig
}

func (DisplayDiff) Render ¶

func (diff DisplayDiff) Render(to io.Writer)

type DisplayUserIdGenerator ¶

type DisplayUserIdGenerator interface {
	DisplayUserId(connector, userid, username, preferredUsername, email string) string
}

type DoPlan ¶

type DoPlan []Plan

func (DoPlan) Public ¶

func (plan DoPlan) Public() *json.RawMessage

type DoStep ¶

type DoStep struct {
	Steps []Step `json:"do"`
}

func (*DoStep) Visit ¶

func (step *DoStep) Visit(v StepVisitor) error

type EnsurePlan ¶

type EnsurePlan struct {
	Step Plan `json:"step"`
	Next Plan `json:"ensure"`
}

func (EnsurePlan) Public ¶

func (plan EnsurePlan) Public() *json.RawMessage

type EnsureStep ¶

type EnsureStep struct {
	Step StepConfig `json:"-"`
	Hook Step       `json:"ensure"`
}

func (*EnsureStep) Unwrap ¶

func (step *EnsureStep) Unwrap() StepConfig

func (*EnsureStep) Visit ¶

func (step *EnsureStep) Visit(v StepVisitor) error

func (*EnsureStep) Wrap ¶

func (step *EnsureStep) Wrap(sub StepConfig)

type Event ¶

type Event interface {
	EventType() EventType
	Version() EventVersion
}

Event represents an event emitted by a build. They are interpreted as a stream to render the build's output.

type EventType ¶

type EventType string

EventType is a classification of an event payload, associated to a struct to parse it into.

type EventVersion ¶

type EventVersion string

EventVersion is a MAJOR.MINOR version corresponding to an event type.

Minor bumps must be backwards-compatible, meaning older clients can still unmarshal them into their old type and still handle the event.

An example of a minor bump would be an additive change, i.e. a new field.

Major bumps are backwards-incompatible and must be parsed and handled differently. An example of a major bump would be the changing or removal of a field.

func (EventVersion) IsCompatibleWith ¶

func (version EventVersion) IsCompatibleWith(other EventVersion) bool

IsCompatibleWith checks whether the versions have the same major version.

type GetPlan ¶

type GetPlan struct {
	// The name of the step.
	Name string `json:"name,omitempty"`

	// The resource config to fetch from.
	Type   string `json:"type"`
	Source Source `json:"source"`

	// Information needed for fetching the image
	TypeImage TypeImage `json:"image"`

	// The version of the resource to fetch. One of these must be specified.
	Version     *Version `json:"version,omitempty"`
	VersionFrom *PlanID  `json:"version_from,omitempty"`

	// Params to pass to the get operation.
	Params Params `json:"params,omitempty"`

	// A pipeline resource to update with metadata.
	Resource string `json:"resource,omitempty"`

	// Worker tags to influence placement of the container.
	Tags Tags `json:"tags,omitempty"`

	// A timeout to enforce on the resource `get` process. Note that fetching the
	// resource's image does not count towards the timeout.
	Timeout string `json:"timeout,omitempty"`
}

func (GetPlan) Public ¶

func (plan GetPlan) Public() *json.RawMessage

type GetStep ¶

type GetStep struct {
	Name     string         `json:"get"`
	Resource string         `json:"resource,omitempty"`
	Version  *VersionConfig `json:"version,omitempty"`
	Params   Params         `json:"params,omitempty"`
	Passed   []string       `json:"passed,omitempty"`
	Trigger  bool           `json:"trigger,omitempty"`
	Tags     Tags           `json:"tags,omitempty"`
	Timeout  string         `json:"timeout,omitempty"`
}

func (*GetStep) ResourceName ¶

func (step *GetStep) ResourceName() string

func (*GetStep) Visit ¶

func (step *GetStep) Visit(v StepVisitor) error

type GroupConfig ¶

type GroupConfig struct {
	Name      string   `json:"name"`
	Jobs      []string `json:"jobs,omitempty"`
	Resources []string `json:"resources,omitempty"`
}

type GroupConfigs ¶

type GroupConfigs []GroupConfig

func (GroupConfigs) Lookup ¶

func (groups GroupConfigs) Lookup(name string) (GroupConfig, int, bool)

type GroupIndex ¶

type GroupIndex GroupConfigs

func (GroupIndex) FindEquivalentWithOrder ¶

func (index GroupIndex) FindEquivalentWithOrder(obj interface{}) (interface{}, int, bool)

func (GroupIndex) Slice ¶

func (index GroupIndex) Slice() []interface{}

type HijackInput ¶

type HijackInput struct {
	Closed  bool           `json:"closed,omitempty"`
	Stdin   []byte         `json:"stdin,omitempty"`
	TTYSpec *HijackTTYSpec `json:"tty,omitempty"`
}

type HijackOutput ¶

type HijackOutput struct {
	Stdout             []byte `json:"stdout,omitempty"`
	Stderr             []byte `json:"stderr,omitempty"`
	Error              string `json:"error,omitempty"`
	ExitStatus         *int   `json:"exit_status,omitempty"`
	ExecutableNotFound bool   `json:"executable_not_found,omitempty"`
}

type HijackProcessSpec ¶

type HijackProcessSpec struct {
	Path string   `json:"path"`
	Args []string `json:"args"`
	Env  []string `json:"env"`
	Dir  string   `json:"dir"`

	Privileged bool   `json:"privileged"`
	User       string `json:"user"`

	TTY *HijackTTYSpec `json:"tty"`
}

type HijackTTYSpec ¶

type HijackTTYSpec struct {
	WindowSize HijackWindowSize `json:"window_size"`
}

type HijackWindowSize ¶

type HijackWindowSize struct {
	Columns int `json:"columns"`
	Rows    int `json:"rows"`
}

type ImagePlanner ¶

type ImagePlanner interface {
	ImageForType(planID PlanID, resourceType string, stepTags Tags, skipInterval bool) TypeImage
}

type ImageResource ¶

type ImageResource struct {
	Name    string  `json:"name"`
	Type    string  `json:"type"`
	Source  Source  `json:"source"`
	Version Version `json:"version,omitempty"`
	Params  Params  `json:"params,omitempty"`
	Tags    Tags    `json:"tags,omitempty"`
}

func (*ImageResource) ApplySourceDefaults ¶

func (ir *ImageResource) ApplySourceDefaults(resourceTypes ResourceTypes)

type InParallelConfig ¶

type InParallelConfig struct {
	Steps    []Step `json:"steps,omitempty"`
	Limit    int    `json:"limit,omitempty"`
	FailFast bool   `json:"fail_fast,omitempty"`
}

func (*InParallelConfig) UnmarshalJSON ¶

func (c *InParallelConfig) UnmarshalJSON(payload []byte) error

type InParallelPlan ¶

type InParallelPlan struct {
	Steps    []Plan `json:"steps"`
	Limit    int    `json:"limit,omitempty"`
	FailFast bool   `json:"fail_fast,omitempty"`
}

func (InParallelPlan) Public ¶

func (plan InParallelPlan) Public() *json.RawMessage

type InParallelStep ¶

type InParallelStep struct {
	Config InParallelConfig `json:"in_parallel"`
}

func (*InParallelStep) Visit ¶

func (step *InParallelStep) Visit(v StepVisitor) error

type Index ¶

type Index interface {
	FindEquivalent(interface{}) (interface{}, bool)
	Slice() []interface{}
}

type Info ¶

type Info struct {
	Version       string          `json:"version"`
	WorkerVersion string          `json:"worker_version"`
	FeatureFlags  map[string]bool `json:"feature_flags"`
	ExternalURL   string          `json:"external_url,omitempty"`
	ClusterName   string          `json:"cluster_name,omitempty"`
}

type InputsConfig ¶

type InputsConfig struct {
	All       bool
	Detect    bool
	Specified []string
}

A InputsConfig represents the choice to include every artifact within the job as an input to the put step or specific ones.

func (InputsConfig) MarshalJSON ¶

func (c InputsConfig) MarshalJSON() ([]byte, error)

func (*InputsConfig) UnmarshalJSON ¶

func (c *InputsConfig) UnmarshalJSON(inputs []byte) error

type InstanceVars ¶

type InstanceVars map[string]interface{}

func InstanceVarsFromQueryParams ¶

func InstanceVarsFromQueryParams(q url.Values) (InstanceVars, error)

func (InstanceVars) String ¶

func (iv InstanceVars) String() string

type Job ¶

type Job struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	TeamName string `json:"team_name"`

	PipelineID           int          `json:"pipeline_id"`
	PipelineName         string       `json:"pipeline_name"`
	PipelineInstanceVars InstanceVars `json:"pipeline_instance_vars,omitempty"`

	Paused       bool   `json:"paused,omitempty"`
	PausedBy     string `json:"paused_by,omitempty"`
	PausedAt     int64  `json:"paused_at,omitempty"`
	HasNewInputs bool   `json:"has_new_inputs,omitempty"`

	Groups []string `json:"groups,omitempty"`

	FirstLoggedBuildID   int  `json:"first_logged_build_id,omitempty"`
	DisableManualTrigger bool `json:"disable_manual_trigger,omitempty"`

	NextBuild       *Build `json:"next_build"`
	FinishedBuild   *Build `json:"finished_build"`
	TransitionBuild *Build `json:"transition_build,omitempty"`

	Inputs  []JobInput  `json:"inputs,omitempty"`
	Outputs []JobOutput `json:"outputs,omitempty"`
}

type JobConfig ¶

type JobConfig struct {
	Name    string `json:"name"`
	OldName string `json:"old_name,omitempty"`
	Public  bool   `json:"public,omitempty"`

	DisableManualTrigger bool     `json:"disable_manual_trigger,omitempty"`
	Serial               bool     `json:"serial,omitempty"`
	Interruptible        bool     `json:"interruptible,omitempty"`
	SerialGroups         []string `json:"serial_groups,omitempty"`
	RawMaxInFlight       int      `json:"max_in_flight,omitempty"`
	BuildLogsToRetain    int      `json:"build_logs_to_retain,omitempty"`

	BuildLogRetention *BuildLogRetention `json:"build_log_retention,omitempty"`

	OnSuccess *Step `json:"on_success,omitempty"`
	OnFailure *Step `json:"on_failure,omitempty"`
	OnAbort   *Step `json:"on_abort,omitempty"`
	OnError   *Step `json:"on_error,omitempty"`
	Ensure    *Step `json:"ensure,omitempty"`

	PlanSequence []Step `json:"plan"`
}

func (JobConfig) Inputs ¶

func (config JobConfig) Inputs() []JobInputParams

func (JobConfig) MaxInFlight ¶

func (config JobConfig) MaxInFlight() int

func (JobConfig) Outputs ¶

func (config JobConfig) Outputs() []JobOutput

func (JobConfig) Step ¶

func (config JobConfig) Step() Step

func (JobConfig) StepConfig ¶

func (config JobConfig) StepConfig() StepConfig

type JobConfigs ¶

type JobConfigs []JobConfig

func (JobConfigs) Lookup ¶

func (jobs JobConfigs) Lookup(name string) (JobConfig, bool)

type JobIndex ¶

type JobIndex JobConfigs

func (JobIndex) FindEquivalent ¶

func (index JobIndex) FindEquivalent(obj interface{}) (interface{}, bool)

func (JobIndex) Slice ¶

func (index JobIndex) Slice() []interface{}

type JobInput ¶

type JobInput struct {
	Name     string         `json:"name"`
	Resource string         `json:"resource"`
	Trigger  bool           `json:"trigger"`
	Passed   []string       `json:"passed,omitempty"`
	Version  *VersionConfig `json:"version,omitempty"`
}

type JobInputParams ¶

type JobInputParams struct {
	JobInput
	Params Params `json:"params,omitempty"`
	Tags   Tags   `json:"tags,omitempty"`
}

type JobInputSummary ¶

type JobInputSummary struct {
	Name     string   `json:"name"`
	Resource string   `json:"resource"`
	Passed   []string `json:"passed,omitempty"`
	Trigger  bool     `json:"trigger,omitempty"`
}

type JobOutput ¶

type JobOutput struct {
	Name     string `json:"name"`
	Resource string `json:"resource"`
}

type JobOutputSummary ¶

type JobOutputSummary struct {
	Name     string `json:"name"`
	Resource string `json:"resource"`
}

type JobSummary ¶

type JobSummary struct {
	ID   int    `json:"id"`
	Name string `json:"name"`

	TeamName string `json:"team_name"`

	PipelineID           int          `json:"pipeline_id"`
	PipelineName         string       `json:"pipeline_name"`
	PipelineInstanceVars InstanceVars `json:"pipeline_instance_vars,omitempty"`

	Paused       bool   `json:"paused,omitempty"`
	PausedBy     string `json:"paused_by,omitempty"`
	PausedAt     int64  `json:"paused_at,omitempty"`
	HasNewInputs bool   `json:"has_new_inputs,omitempty"`

	Groups []string `json:"groups,omitempty"`

	FinishedBuild   *BuildSummary `json:"finished_build,omitempty"`
	NextBuild       *BuildSummary `json:"next_build,omitempty"`
	TransitionBuild *BuildSummary `json:"transition_build,omitempty"`

	Inputs  []JobInputSummary  `json:"inputs,omitempty"`
	Outputs []JobOutputSummary `json:"outputs,omitempty"`
}

type LoadVarPlan ¶

type LoadVarPlan struct {
	Name   string `json:"name"`
	File   string `json:"file"`
	Format string `json:"format,omitempty"`
	Reveal bool   `json:"reveal,omitempty"`
}

func (LoadVarPlan) Public ¶

func (plan LoadVarPlan) Public() *json.RawMessage

type LoadVarStep ¶

type LoadVarStep struct {
	Name   string `json:"load_var"`
	File   string `json:"file,omitempty"`
	Format string `json:"format,omitempty"`
	Reveal bool   `json:"reveal,omitempty"`
}

func (*LoadVarStep) Visit ¶

func (step *LoadVarStep) Visit(v StepVisitor) error

type LogLevel ¶

type LogLevel string
const (
	LogLevelInvalid LogLevel = ""
	LogLevelDebug   LogLevel = "debug"
	LogLevelInfo    LogLevel = "info"
	LogLevelError   LogLevel = "error"
	LogLevelFatal   LogLevel = "fatal"
)

type MalformedConfigError ¶

type MalformedConfigError struct {
	UnmarshalError error
}

func (MalformedConfigError) Error ¶

func (err MalformedConfigError) Error() string

type MalformedStepError ¶

type MalformedStepError struct {
	StepType string
	Err      error
}

func (MalformedStepError) Error ¶

func (err MalformedStepError) Error() string

func (MalformedStepError) Unwrap ¶

func (err MalformedStepError) Unwrap() error

type MaxInFlightConfig ¶

type MaxInFlightConfig struct {
	All   bool
	Limit int
}

MaxInFlightConfig can represent either running all values in an AcrossStep in parallel or a applying a limit to the sub-steps that can run at once.

func (*MaxInFlightConfig) EffectiveLimit ¶

func (c *MaxInFlightConfig) EffectiveLimit(numSteps int) int

func (*MaxInFlightConfig) MarshalJSON ¶

func (c *MaxInFlightConfig) MarshalJSON() ([]byte, error)

func (*MaxInFlightConfig) UnmarshalJSON ¶

func (c *MaxInFlightConfig) UnmarshalJSON(version []byte) error

type MemoryLimit ¶

type MemoryLimit uint64

func ParseMemoryLimit ¶

func ParseMemoryLimit(limit string) (MemoryLimit, error)

func (*MemoryLimit) UnmarshalJSON ¶

func (m *MemoryLimit) UnmarshalJSON(data []byte) error

type MetadataField ¶

type MetadataField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type MissingInputReasons ¶

type MissingInputReasons map[string]string

type OnAbortPlan ¶

type OnAbortPlan struct {
	Step Plan `json:"step"`
	Next Plan `json:"on_abort"`
}

func (OnAbortPlan) Public ¶

func (plan OnAbortPlan) Public() *json.RawMessage

type OnAbortStep ¶

type OnAbortStep struct {
	Step StepConfig `json:"-"`
	Hook Step       `json:"on_abort"`
}

func (*OnAbortStep) Unwrap ¶

func (step *OnAbortStep) Unwrap() StepConfig

func (*OnAbortStep) Visit ¶

func (step *OnAbortStep) Visit(v StepVisitor) error

func (*OnAbortStep) Wrap ¶

func (step *OnAbortStep) Wrap(sub StepConfig)

type OnErrorPlan ¶

type OnErrorPlan struct {
	Step Plan `json:"step"`
	Next Plan `json:"on_error"`
}

func (OnErrorPlan) Public ¶

func (plan OnErrorPlan) Public() *json.RawMessage

type OnErrorStep ¶

type OnErrorStep struct {
	Step StepConfig `json:"-"`
	Hook Step       `json:"on_error"`
}

func (*OnErrorStep) Unwrap ¶

func (step *OnErrorStep) Unwrap() StepConfig

func (*OnErrorStep) Visit ¶

func (step *OnErrorStep) Visit(v StepVisitor) error

func (*OnErrorStep) Wrap ¶

func (step *OnErrorStep) Wrap(sub StepConfig)

type OnFailurePlan ¶

type OnFailurePlan struct {
	Step Plan `json:"step"`
	Next Plan `json:"on_failure"`
}

func (OnFailurePlan) Public ¶

func (plan OnFailurePlan) Public() *json.RawMessage

type OnFailureStep ¶

type OnFailureStep struct {
	Step StepConfig `json:"-"`
	Hook Step       `json:"on_failure"`
}

func (*OnFailureStep) Unwrap ¶

func (step *OnFailureStep) Unwrap() StepConfig

func (*OnFailureStep) Visit ¶

func (step *OnFailureStep) Visit(v StepVisitor) error

func (*OnFailureStep) Wrap ¶

func (step *OnFailureStep) Wrap(sub StepConfig)

type OnSuccessPlan ¶

type OnSuccessPlan struct {
	Step Plan `json:"step"`
	Next Plan `json:"on_success"`
}

func (OnSuccessPlan) Public ¶

func (plan OnSuccessPlan) Public() *json.RawMessage

type OnSuccessStep ¶

type OnSuccessStep struct {
	Step StepConfig `json:"-"`
	Hook Step       `json:"on_success"`
}

func (*OnSuccessStep) Unwrap ¶

func (step *OnSuccessStep) Unwrap() StepConfig

func (*OnSuccessStep) Visit ¶

func (step *OnSuccessStep) Visit(v StepVisitor) error

func (*OnSuccessStep) Wrap ¶

func (step *OnSuccessStep) Wrap(sub StepConfig)

type Params ¶

type Params map[string]interface{}

func (Params) MarshalJSON ¶

func (ps Params) MarshalJSON() ([]byte, error)

type PathFlag ¶

type PathFlag string

func (*PathFlag) Complete ¶

func (path *PathFlag) Complete(match string) []flags.Completion

func (*PathFlag) FromStdin ¶

func (path *PathFlag) FromStdin() bool

func (*PathFlag) UnmarshalFlag ¶

func (path *PathFlag) UnmarshalFlag(value string) error

type Pipe ¶

type Pipe struct {
	ID string `json:"id"`

	ReadURL  string `json:"read_url"`
	WriteURL string `json:"write_url"`
}

type Pipeline ¶

type Pipeline struct {
	ID            int            `json:"id"`
	Name          string         `json:"name"`
	InstanceVars  InstanceVars   `json:"instance_vars,omitempty"`
	Paused        bool           `json:"paused"`
	PausedBy      string         `json:"paused_by,omitempty"`
	PausedAt      int64          `json:"paused_at,omitempty"`
	Public        bool           `json:"public"`
	Archived      bool           `json:"archived"`
	Groups        GroupConfigs   `json:"groups,omitempty"`
	TeamName      string         `json:"team_name"`
	Display       *DisplayConfig `json:"display,omitempty"`
	ParentBuildID int            `json:"parent_build_id,omitempty"`
	ParentJobID   int            `json:"parent_job_id,omitempty"`
	LastUpdated   int64          `json:"last_updated,omitempty"`
}

func (Pipeline) Ref ¶

func (p Pipeline) Ref() PipelineRef

type PipelineRef ¶

type PipelineRef struct {
	Name         string       `json:"name"`
	InstanceVars InstanceVars `json:"instance_vars,omitempty"`
}

func (PipelineRef) QueryParams ¶

func (ref PipelineRef) QueryParams() url.Values

func (PipelineRef) String ¶

func (ref PipelineRef) String() string

type Plan ¶

type Plan struct {
	ID       PlanID `json:"id"`
	Attempts []int  `json:"attempts,omitempty"`

	Get         *GetPlan         `json:"get,omitempty"`
	Put         *PutPlan         `json:"put,omitempty"`
	Check       *CheckPlan       `json:"check,omitempty"`
	Task        *TaskPlan        `json:"task,omitempty"`
	Run         *RunPlan         `json:"run,omitempty"`
	SetPipeline *SetPipelinePlan `json:"set_pipeline,omitempty"`
	LoadVar     *LoadVarPlan     `json:"load_var,omitempty"`

	Do         *DoPlan         `json:"do,omitempty"`
	InParallel *InParallelPlan `json:"in_parallel,omitempty"`
	Across     *AcrossPlan     `json:"across,omitempty"`

	OnSuccess *OnSuccessPlan `json:"on_success,omitempty"`
	OnFailure *OnFailurePlan `json:"on_failure,omitempty"`
	OnAbort   *OnAbortPlan   `json:"on_abort,omitempty"`
	OnError   *OnErrorPlan   `json:"on_error,omitempty"`
	Ensure    *EnsurePlan    `json:"ensure,omitempty"`

	Try     *TryPlan     `json:"try,omitempty"`
	Timeout *TimeoutPlan `json:"timeout,omitempty"`
	Retry   *RetryPlan   `json:"retry,omitempty"`

	// used for 'fly execute'
	ArtifactInput  *ArtifactInputPlan  `json:"artifact_input,omitempty"`
	ArtifactOutput *ArtifactOutputPlan `json:"artifact_output,omitempty"`

	// deprecated, kept for backwards compatibility to be able to show old builds
	DependentGet *DependentGetPlan `json:"dependent_get,omitempty"`
}

func (*Plan) Each ¶

func (plan *Plan) Each(f func(*Plan))

func (*Plan) Public ¶

func (plan *Plan) Public() *json.RawMessage

type PlanConfig ¶

type PlanConfig interface {
	Public() *json.RawMessage
}

type PlanFactory ¶

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

func NewPlanFactory ¶

func NewPlanFactory(startingNum int64) PlanFactory

func (PlanFactory) NewPlan ¶

func (factory PlanFactory) NewPlan(step PlanConfig) Plan

type PlanID ¶

type PlanID string

func (PlanID) String ¶

func (id PlanID) String() string

type Prototype ¶

type Prototype struct {
	Name       string      `json:"name"`
	Type       string      `json:"type"`
	Source     Source      `json:"source"`
	Defaults   Source      `json:"defaults,omitempty"`
	Privileged bool        `json:"privileged,omitempty"`
	CheckEvery *CheckEvery `json:"check_every,omitempty"`
	Tags       Tags        `json:"tags,omitempty"`
	Params     Params      `json:"params,omitempty"`
}

type Prototypes ¶

type Prototypes []Prototype

func (Prototypes) Lookup ¶

func (types Prototypes) Lookup(name string) (Prototype, bool)

type PruneWorkerResponseBody ¶

type PruneWorkerResponseBody struct {
	Stderr string `json:"stderr"`
}

type PublicBuildInput ¶

type PublicBuildInput struct {
	Name            string  `json:"name"`
	Version         Version `json:"version"`
	PipelineID      int     `json:"pipeline_id"`
	FirstOccurrence bool    `json:"first_occurrence"`
}

type PublicBuildOutput ¶

type PublicBuildOutput struct {
	Name    string  `json:"name"`
	Version Version `json:"version"`
}

type PublicBuildPlan ¶

type PublicBuildPlan struct {
	Schema string           `json:"schema"`
	Plan   *json.RawMessage `json:"plan"`
}

type PutPlan ¶

type PutPlan struct {
	// The name of the step.
	Name string `json:"name"`

	// The resource config to push to.
	Type   string `json:"type"`
	Source Source `json:"source"`

	// Information needed for fetching the image
	TypeImage TypeImage `json:"image"`

	// Params to pass to the put operation.
	Params Params `json:"params,omitempty"`

	// Inputs to pass to the put operation.
	Inputs *InputsConfig `json:"inputs,omitempty"`

	// A pipeline resource to save the versions onto.
	Resource string `json:"resource,omitempty"`

	// Worker tags to influence placement of the container.
	Tags Tags `json:"tags,omitempty"`

	// A timeout to enforce on the resource `put` process. Note that fetching the
	// resource's image does not count towards the timeout.
	Timeout string `json:"timeout,omitempty"`

	// If or not expose BUILD_CREATED_BY to build metadata
	ExposeBuildCreatedBy bool `json:"expose_build_created_by,omitempty"`
}

func (PutPlan) Public ¶

func (plan PutPlan) Public() *json.RawMessage

type PutStep ¶

type PutStep struct {
	Name      string        `json:"put"`
	Resource  string        `json:"resource,omitempty"`
	Params    Params        `json:"params,omitempty"`
	Inputs    *InputsConfig `json:"inputs,omitempty"`
	Tags      Tags          `json:"tags,omitempty"`
	GetParams Params        `json:"get_params,omitempty"`
	Timeout   string        `json:"timeout,omitempty"`
	NoGet     bool          `json:"no_get,omitempty"`
}

func (*PutStep) ResourceName ¶

func (step *PutStep) ResourceName() string

func (*PutStep) Visit ¶

func (step *PutStep) Visit(v StepVisitor) error

type RenameRequest ¶

type RenameRequest struct {
	NewName string `json:"name"`
}

type RerunOfBuild ¶

type RerunOfBuild struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Resource ¶

type Resource struct {
	Name                 string       `json:"name"`
	PipelineID           int          `json:"pipeline_id"`
	PipelineName         string       `json:"pipeline_name"`
	PipelineInstanceVars InstanceVars `json:"pipeline_instance_vars,omitempty"`
	TeamName             string       `json:"team_name"`
	Type                 string       `json:"type"`
	LastChecked          int64        `json:"last_checked,omitempty"`
	Icon                 string       `json:"icon,omitempty"`

	PinnedVersion  Version `json:"pinned_version,omitempty"`
	PinnedInConfig bool    `json:"pinned_in_config,omitempty"`
	PinComment     string  `json:"pin_comment,omitempty"`

	Build *BuildSummary `json:"build,omitempty"`
}

type ResourceConfig ¶

type ResourceConfig struct {
	Name                 string      `json:"name"`
	OldName              string      `json:"old_name,omitempty"`
	Public               bool        `json:"public,omitempty"`
	WebhookToken         string      `json:"webhook_token,omitempty"`
	Type                 string      `json:"type"`
	Source               Source      `json:"source"`
	CheckEvery           *CheckEvery `json:"check_every,omitempty"`
	CheckTimeout         string      `json:"check_timeout,omitempty"`
	Tags                 Tags        `json:"tags,omitempty"`
	Version              Version     `json:"version,omitempty"`
	Icon                 string      `json:"icon,omitempty"`
	ExposeBuildCreatedBy bool        `json:"expose_build_created_by,omitempty"`
}

type ResourceConfigs ¶

type ResourceConfigs []ResourceConfig

func (ResourceConfigs) Lookup ¶

func (resources ResourceConfigs) Lookup(name string) (ResourceConfig, bool)

type ResourceIdentifier ¶

type ResourceIdentifier struct {
	Name         string `json:"name"`
	PipelineName string `json:"pipeline_name"`
	TeamName     string `json:"team_name"`
}

type ResourceIdentifiers ¶

type ResourceIdentifiers []ResourceIdentifier

type ResourceIndex ¶

type ResourceIndex ResourceConfigs

func (ResourceIndex) FindEquivalent ¶

func (index ResourceIndex) FindEquivalent(obj interface{}) (interface{}, bool)

func (ResourceIndex) Slice ¶

func (index ResourceIndex) Slice() []interface{}

type ResourceType ¶

type ResourceType struct {
	Name       string      `json:"name"`
	Type       string      `json:"type"`
	Source     Source      `json:"source"`
	Defaults   Source      `json:"defaults,omitempty"`
	Privileged bool        `json:"privileged,omitempty"`
	CheckEvery *CheckEvery `json:"check_every,omitempty"`
	Tags       Tags        `json:"tags,omitempty"`
	Params     Params      `json:"params,omitempty"`
}

type ResourceTypeIndex ¶

type ResourceTypeIndex ResourceTypes

func (ResourceTypeIndex) FindEquivalent ¶

func (index ResourceTypeIndex) FindEquivalent(obj interface{}) (interface{}, bool)

func (ResourceTypeIndex) Slice ¶

func (index ResourceTypeIndex) Slice() []interface{}

type ResourceTypes ¶

type ResourceTypes []ResourceType

func (ResourceTypes) ImageForType ¶

func (types ResourceTypes) ImageForType(planID PlanID, resourceType string, stepTags Tags, skipInterval bool) TypeImage

func (ResourceTypes) Lookup ¶

func (types ResourceTypes) Lookup(name string) (ResourceType, bool)

func (ResourceTypes) Without ¶

func (types ResourceTypes) Without(name string) ResourceTypes

type ResourceVersion ¶

type ResourceVersion struct {
	ID       int             `json:"id"`
	Metadata []MetadataField `json:"metadata,omitempty"`
	Version  Version         `json:"version"`
	Enabled  bool            `json:"enabled"`
}

type ResourcesAndTypes ¶

type ResourcesAndTypes struct {
	Resources     ResourceIdentifiers `json:"resources"`
	ResourceTypes ResourceIdentifiers `json:"resource_types"`
}

type RetryPlan ¶

type RetryPlan []Plan

func (RetryPlan) Public ¶

func (plan RetryPlan) Public() *json.RawMessage

type RetryStep ¶

type RetryStep struct {
	Step     StepConfig `json:"-"`
	Attempts int        `json:"attempts"`
}

func (*RetryStep) Unwrap ¶

func (step *RetryStep) Unwrap() StepConfig

func (*RetryStep) Visit ¶

func (step *RetryStep) Visit(v StepVisitor) error

func (*RetryStep) Wrap ¶

func (step *RetryStep) Wrap(sub StepConfig)

type RunPlan ¶

type RunPlan struct {
	// The message to run on the prototype.
	Message string `json:"message"`

	// The prototype name.
	Type string `json:"type"`

	// Object to provide to the prototype. Result of merging run.params with
	// prototype.defaults.
	Object Params `json:"object,omitempty"`

	// Run in 'privileged' mode. What this means depends on the platform, but
	// typically you expose your workers to more risk by enabling this.
	Privileged bool `json:"privileged"`

	// Worker tags to influence placement of the container.
	Tags Tags `json:"tags,omitempty"`

	// Limits to set on the Container
	Limits *ContainerLimits `json:"container_limits,omitempty"`

	// A timeout to enforce on the run step's process. Note that fetching the
	// prototype's image does not count towards the timeout.
	Timeout string `json:"timeout,omitempty"`
}

func (RunPlan) Public ¶

func (plan RunPlan) Public() *json.RawMessage

type RunStep ¶

type RunStep struct {
	Message    string           `json:"run"`
	Type       string           `json:"type"`
	Params     Params           `json:"params,omitempty"`
	Privileged bool             `json:"privileged,omitempty"`
	Tags       Tags             `json:"tags,omitempty"`
	Limits     *ContainerLimits `json:"container_limits,omitempty"`
	Timeout    string           `json:"timeout,omitempty"`
}

func (*RunStep) Visit ¶

func (step *RunStep) Visit(v StepVisitor) error

type SaveConfigResponse ¶

type SaveConfigResponse struct {
	Errors   []string        `json:"errors,omitempty"`
	Warnings []ConfigWarning `json:"warnings,omitempty"`
}

type SetBuildCommentBody ¶

type SetBuildCommentBody struct {
	Comment string `json:"comment"`
}

type SetPinCommentRequestBody ¶

type SetPinCommentRequestBody struct {
	PinComment string `json:"pin_comment"`
}

type SetPipelinePlan ¶

type SetPipelinePlan struct {
	Name         string                 `json:"name"`
	File         string                 `json:"file"`
	Team         string                 `json:"team,omitempty"`
	Vars         map[string]interface{} `json:"vars,omitempty"`
	VarFiles     []string               `json:"var_files,omitempty"`
	InstanceVars map[string]interface{} `json:"instance_vars,omitempty"`
}

func (SetPipelinePlan) Public ¶

func (plan SetPipelinePlan) Public() *json.RawMessage

type SetPipelineStep ¶

type SetPipelineStep struct {
	Name         string       `json:"set_pipeline"`
	File         string       `json:"file,omitempty"`
	Team         string       `json:"team,omitempty"`
	Vars         Params       `json:"vars,omitempty"`
	VarFiles     []string     `json:"var_files,omitempty"`
	InstanceVars InstanceVars `json:"instance_vars,omitempty"`
}

func (*SetPipelineStep) Visit ¶

func (step *SetPipelineStep) Visit(v StepVisitor) error

type Source ¶

type Source map[string]interface{}

func FindBaseResourceTypeDefaults ¶

func FindBaseResourceTypeDefaults(name string) (Source, bool)

func (Source) MarshalJSON ¶

func (src Source) MarshalJSON() ([]byte, error)

func (Source) Merge ¶

func (src Source) Merge(other Source) Source

Merge returns a new Source that merged other into src. The original src is not updated.

type Step ¶

type Step struct {
	Config        StepConfig
	UnknownFields map[string]*json.RawMessage
}

Step is an "envelope" type, acting as a wrapper to handle the marshaling and unmarshaling of an underlying StepConfig.

func (Step) MarshalJSON ¶

func (step Step) MarshalJSON() ([]byte, error)

MarshalJSON marshals step configuration in multiple passes, looping and calling .Unwrap to marshal all nested steps into one big set of fields which is then marshalled and returned.

func (*Step) UnmarshalJSON ¶

func (step *Step) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals step configuration in multiple passes, determining precedence by the order of StepDetectors listed in the StepPrecedence variable.

First, the step data is unmarshalled into a map[string]*json.RawMessage. Next, UnmarshalJSON loops over StepPrecedence to determine the type of step.

For any StepDetector with a .Key field present in the map, .New is called to construct an empty StepConfig, and then json.Unmarshal is called on it to parse the data.

For step modifiers like `timeout:` and `attempts:` they eventuallly wrap a core step type (e.g. get, put, task etc.). Core step types do not wrap other steps.

When a core step type is encountered parsing stops and any remaining keys in rawStepConfig are considered invalid. This is how we stop someone from putting a `get` and `put` in the same step while still allowing valid step modifiers. This is also why step modifiers are listed first in StepPrecedence.

If no StepDetectors match, no step is parsed, ErrNoStepConfigured is returned.

type StepConfig ¶

type StepConfig interface {
	// Visit must call StepVisitor with the appropriate method corresponding to
	// this step type.
	//
	// When a new step type is added, the StepVisitor interface must be extended.
	// This allows the compiler to help us track down all the places where steps
	// must be handled type-by-type.
	Visit(StepVisitor) error
}

StepConfig is implemented by all step types.

type StepDetector ¶

type StepDetector struct {
	// Key is the field that, if present, indicates that the step is configured.
	Key string

	// If Key is present, New will be called to construct an empty StepConfig.
	New func() StepConfig
}

StepDetector is a simple structure used to detect whether a step type is configured.

type StepRecursor ¶

type StepRecursor struct {
	// OnTask will be invoked for any *TaskStep present in the StepConfig.
	OnTask func(*TaskStep) error

	// OnGet will be invoked for any *GetStep present in the StepConfig.
	OnGet func(*GetStep) error

	// OnPut will be invoked for any *PutStep present in the StepConfig.
	OnPut func(*PutStep) error

	// OnRun will be invoked for any *RunStep present in the StepConfig.
	OnRun func(*RunStep) error

	// OnSetPipeline will be invoked for any *SetPipelineStep present in the StepConfig.
	OnSetPipeline func(*SetPipelineStep) error

	// OnLoadVar will be invoked for any *LoadVarStep present in the StepConfig.
	OnLoadVar func(*LoadVarStep) error
}

StepRecursor is a StepVisitor helper used for traversing a StepConfig and calling configured hooks on the "base" step types, i.e. step types that do not contain any other steps.

StepRecursor must be updated with any new step type added. Steps which wrap other steps must recurse through them, while steps which are "base" steps must have a hook added for them, called when they visit the StepRecursor.

func (StepRecursor) VisitAcross ¶

func (recursor StepRecursor) VisitAcross(step *AcrossStep) error

VisitAcross recurses through to the wrapped step.

func (StepRecursor) VisitDo ¶

func (recursor StepRecursor) VisitDo(step *DoStep) error

VisitDo recurses through to the wrapped steps.

func (StepRecursor) VisitEnsure ¶

func (recursor StepRecursor) VisitEnsure(step *EnsureStep) error

VisitEnsure recurses through to the wrapped step and hook.

func (StepRecursor) VisitGet ¶

func (recursor StepRecursor) VisitGet(step *GetStep) error

VisitGet calls the OnGet hook if configured.

func (StepRecursor) VisitInParallel ¶

func (recursor StepRecursor) VisitInParallel(step *InParallelStep) error

VisitInParallel recurses through to the wrapped steps.

func (StepRecursor) VisitLoadVar ¶

func (recursor StepRecursor) VisitLoadVar(step *LoadVarStep) error

VisitLoadVar calls the OnLoadVar hook if configured.

func (StepRecursor) VisitOnAbort ¶

func (recursor StepRecursor) VisitOnAbort(step *OnAbortStep) error

VisitOnAbort recurses through to the wrapped step and hook.

func (StepRecursor) VisitOnError ¶

func (recursor StepRecursor) VisitOnError(step *OnErrorStep) error

VisitOnError recurses through to the wrapped step and hook.

func (StepRecursor) VisitOnFailure ¶

func (recursor StepRecursor) VisitOnFailure(step *OnFailureStep) error

VisitOnFailure recurses through to the wrapped step and hook.

func (StepRecursor) VisitOnSuccess ¶

func (recursor StepRecursor) VisitOnSuccess(step *OnSuccessStep) error

VisitOnSuccess recurses through to the wrapped step and hook.

func (StepRecursor) VisitPut ¶

func (recursor StepRecursor) VisitPut(step *PutStep) error

VisitPut calls the OnPut hook if configured.

func (StepRecursor) VisitRetry ¶

func (recursor StepRecursor) VisitRetry(step *RetryStep) error

VisitRetry recurses through to the wrapped step.

func (StepRecursor) VisitRun ¶

func (recursor StepRecursor) VisitRun(step *RunStep) error

VisitRun calls the OnRun hook if configured.

func (StepRecursor) VisitSetPipeline ¶

func (recursor StepRecursor) VisitSetPipeline(step *SetPipelineStep) error

VisitSetPipeline calls the OnSetPipeline hook if configured.

func (StepRecursor) VisitTask ¶

func (recursor StepRecursor) VisitTask(step *TaskStep) error

VisitTask calls the OnTask hook if configured.

func (StepRecursor) VisitTimeout ¶

func (recursor StepRecursor) VisitTimeout(step *TimeoutStep) error

VisitTimeout recurses through to the wrapped step.

func (StepRecursor) VisitTry ¶

func (recursor StepRecursor) VisitTry(step *TryStep) error

VisitTry recurses through to the wrapped step.

type StepValidator ¶

type StepValidator struct {
	// Warnings is a slice of warning messages to show to the user, while still
	// allowing the pipeline to be configured. This is typically used for
	// deprecations.
	//
	// This field will be populated after visiting the step.
	Warnings []ConfigWarning

	// Errors is a slice of critical errors which will prevent configuring the
	// pipeline.
	//
	// This field will be populated after visiting the step.
	Errors []string
	// contains filtered or unexported fields
}

StepValidator is a StepVisitor which validates each step that visits it, collecting warnings and errors as it goes.

func NewStepValidator ¶

func NewStepValidator(config Config, context []string) *StepValidator

NewStepValidator is a constructor which initializes internal data.

The Config specified is used to validate the existence of resources and jobs referenced by steps.

The context argument contains the initial context used to annotate error and warning messages. For example, []string{"jobs(foo)", ".plan"} will result in errors like 'jobs(foo).plan.task(bar): blah blah'.

func (*StepValidator) Validate ¶

func (validator *StepValidator) Validate(step Step) error

func (*StepValidator) VisitAcross ¶

func (validator *StepValidator) VisitAcross(step *AcrossStep) error

func (*StepValidator) VisitDo ¶

func (validator *StepValidator) VisitDo(step *DoStep) error

func (*StepValidator) VisitEnsure ¶

func (validator *StepValidator) VisitEnsure(step *EnsureStep) error

func (*StepValidator) VisitGet ¶

func (validator *StepValidator) VisitGet(step *GetStep) error

func (*StepValidator) VisitInParallel ¶

func (validator *StepValidator) VisitInParallel(step *InParallelStep) error

func (*StepValidator) VisitLoadVar ¶

func (validator *StepValidator) VisitLoadVar(step *LoadVarStep) error

func (*StepValidator) VisitOnAbort ¶

func (validator *StepValidator) VisitOnAbort(step *OnAbortStep) error

func (*StepValidator) VisitOnError ¶

func (validator *StepValidator) VisitOnError(step *OnErrorStep) error

func (*StepValidator) VisitOnFailure ¶

func (validator *StepValidator) VisitOnFailure(step *OnFailureStep) error

func (*StepValidator) VisitOnSuccess ¶

func (validator *StepValidator) VisitOnSuccess(step *OnSuccessStep) error

func (*StepValidator) VisitPut ¶

func (validator *StepValidator) VisitPut(step *PutStep) error

func (*StepValidator) VisitRetry ¶

func (validator *StepValidator) VisitRetry(step *RetryStep) error

func (*StepValidator) VisitRun ¶

func (validator *StepValidator) VisitRun(step *RunStep) error

func (*StepValidator) VisitSetPipeline ¶

func (validator *StepValidator) VisitSetPipeline(step *SetPipelineStep) error

func (*StepValidator) VisitTask ¶

func (validator *StepValidator) VisitTask(plan *TaskStep) error

func (*StepValidator) VisitTimeout ¶

func (validator *StepValidator) VisitTimeout(step *TimeoutStep) error

func (*StepValidator) VisitTry ¶

func (validator *StepValidator) VisitTry(step *TryStep) error

type StepVisitor ¶

type StepVisitor interface {
	VisitTask(*TaskStep) error
	VisitGet(*GetStep) error
	VisitPut(*PutStep) error
	VisitRun(*RunStep) error
	VisitSetPipeline(*SetPipelineStep) error
	VisitLoadVar(*LoadVarStep) error
	VisitTry(*TryStep) error
	VisitDo(*DoStep) error
	VisitInParallel(*InParallelStep) error
	VisitAcross(*AcrossStep) error
	VisitTimeout(*TimeoutStep) error
	VisitRetry(*RetryStep) error
	VisitOnSuccess(*OnSuccessStep) error
	VisitOnFailure(*OnFailureStep) error
	VisitOnAbort(*OnAbortStep) error
	VisitOnError(*OnErrorStep) error
	VisitEnsure(*EnsureStep) error
}

StepVisitor is an interface used to assist in finding all the places that need to be updated whenever a new step type is introduced.

Each StepConfig must implement .Visit to call the appropriate method on the given StepVisitor.

type StepWrapper ¶

type StepWrapper interface {
	// Wrap is called during (Step).UnmarshalJSON whenever an 'inner' step is
	// parsed.
	//
	// Modifier step types should implement this function by assigning the
	// passed in StepConfig to an internal field that has a `json:"-"` tag.
	Wrap(StepConfig)

	// Unwrap is called during (Step).MarshalJSON and must return the wrapped
	// StepConfig.
	Unwrap() StepConfig
}

StepWrapper is an optional interface for step types that is implemented by steps that wrap/modify other steps (e.g. hooks like `on_success`, `timeout`, etc.)

type Tags ¶

type Tags []string

func (*Tags) UnmarshalJSON ¶

func (t *Tags) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals as a []string, removing any empty elements. Empty tags are treated as unset.

type TaskCacheConfig ¶

type TaskCacheConfig struct {
	Path string `json:"path,omitempty"`
}

type TaskConfig ¶

type TaskConfig struct {
	// The platform the task must run on (e.g. linux, windows).
	Platform string `json:"platform,omitempty"`

	// Optional string specifying an image to use for the build. Depending on the
	// platform, this may or may not be required (e.g. Windows/OS X vs. Linux).
	RootfsURI string `json:"rootfs_uri,omitempty"`

	ImageResource *ImageResource `json:"image_resource,omitempty"`

	// Limits to set on the Task Container
	Limits *ContainerLimits `json:"container_limits,omitempty"`

	// Parameters to pass to the task via environment variables.
	Params TaskEnv `json:"params,omitempty"`

	// Script to execute.
	Run TaskRunConfig `json:"run,omitempty"`

	// The set of (logical, name-only) inputs required by the task.
	Inputs []TaskInputConfig `json:"inputs,omitempty"`

	// The set of (logical, name-only) outputs provided by the task.
	Outputs []TaskOutputConfig `json:"outputs,omitempty"`

	// Path to cached directory that will be shared between builds for the same task.
	Caches []TaskCacheConfig `json:"caches,omitempty"`
}

func NewTaskConfig ¶

func NewTaskConfig(configBytes []byte) (TaskConfig, error)

func (TaskConfig) Validate ¶

func (config TaskConfig) Validate() error

type TaskEnv ¶

type TaskEnv map[string]string

func (TaskEnv) Env ¶

func (te TaskEnv) Env() []string

func (*TaskEnv) UnmarshalJSON ¶

func (te *TaskEnv) UnmarshalJSON(p []byte) error

type TaskInputConfig ¶

type TaskInputConfig struct {
	Name     string `json:"name"`
	Path     string `json:"path,omitempty"`
	Optional bool   `json:"optional,omitempty"`
}

type TaskOutputConfig ¶

type TaskOutputConfig struct {
	Name string `json:"name"`
	Path string `json:"path,omitempty"`
}

type TaskPlan ¶

type TaskPlan struct {
	// The name of the step.
	Name string `json:"name"`

	// Run the task in 'privileged' mode. What this means depends on the
	// platform, but typically you expose your workers to more risk by enabling
	// this.
	Privileged bool `json:"privileged"`

	// Run the task in 'hermetic' mode. If set to true, network traffic from
	// the container to external will be dropped.
	Hermetic bool `json:"hermetic"`

	// Worker tags to influence placement of the container.
	Tags Tags `json:"tags,omitempty"`

	// The task config to execute - either fetched from a path at runtime, or
	// provided statically.
	ConfigPath string      `json:"config_path,omitempty"`
	Config     *TaskConfig `json:"config,omitempty"`

	// Limits to set on the Task Container
	Limits *ContainerLimits `json:"container_limits,omitempty"`

	// An artifact in the build plan to use as the task's image. Overrides any
	// image set in the task's config.
	ImageArtifactName string `json:"image,omitempty"`

	// Vars to use to parameterize the task config.
	Vars Params `json:"vars,omitempty"`

	// Params to set in the task's environment.
	Params TaskEnv `json:"params,omitempty"`

	// Remap inputs and output artifacts from task names to other names in the
	// build plan.
	InputMapping  map[string]string `json:"input_mapping,omitempty"`
	OutputMapping map[string]string `json:"output_mapping,omitempty"`

	// A timeout to enforce on the task's process. Note that fetching the task's
	// image does not count towards the timeout.
	Timeout string `json:"timeout,omitempty"`

	// Resource types to have available for use when fetching the task's image.
	ResourceTypes ResourceTypes `json:"resource_types,omitempty"`

	// If set, the check plan for the image will be forced to run and not respect
	// the checking interval
	CheckSkipInterval bool `json:"check_skip_interval,omitempty"`
}

func (TaskPlan) Public ¶

func (plan TaskPlan) Public() *json.RawMessage

type TaskRunConfig ¶

type TaskRunConfig struct {
	Path string   `json:"path"`
	Args []string `json:"args,omitempty"`
	Dir  string   `json:"dir,omitempty"`

	// The user that the task will run as (defaults to whatever the docker image specifies)
	User string `json:"user,omitempty"`
}

type TaskStep ¶

type TaskStep struct {
	Name              string            `json:"task"`
	Privileged        bool              `json:"privileged,omitempty"`
	Hermetic          bool              `json:"hermetic,omitempty"`
	ConfigPath        string            `json:"file,omitempty"`
	Limits            *ContainerLimits  `json:"container_limits,omitempty"`
	Config            *TaskConfig       `json:"config,omitempty"`
	Params            TaskEnv           `json:"params,omitempty"`
	Vars              Params            `json:"vars,omitempty"`
	Tags              Tags              `json:"tags,omitempty"`
	InputMapping      map[string]string `json:"input_mapping,omitempty"`
	OutputMapping     map[string]string `json:"output_mapping,omitempty"`
	ImageArtifactName string            `json:"image,omitempty"`
	Timeout           string            `json:"timeout,omitempty"`
}

func (*TaskStep) Visit ¶

func (step *TaskStep) Visit(v StepVisitor) error

type TaskValidationError ¶

type TaskValidationError struct {
	Errors []string
}

func (TaskValidationError) Error ¶

func (err TaskValidationError) Error() string

type Team ¶

type Team struct {
	ID   int      `json:"id,omitempty"`
	Name string   `json:"name,omitempty"`
	Auth TeamAuth `json:"auth,omitempty"`
}

func (Team) Validate ¶

func (team Team) Validate() error

type TeamAuth ¶

type TeamAuth map[string]map[string][]string

func (TeamAuth) Validate ¶

func (auth TeamAuth) Validate() error

type TimeoutPlan ¶

type TimeoutPlan struct {
	Step     Plan   `json:"step"`
	Duration string `json:"duration"`
}

func (TimeoutPlan) Public ¶

func (plan TimeoutPlan) Public() *json.RawMessage

type TimeoutStep ¶

type TimeoutStep struct {
	Step StepConfig `json:"-"`

	// it's very tempting to make this a Duration type, but that would probably
	// prevent using `((vars))` to parameterize it
	Duration string `json:"timeout"`
}

func (*TimeoutStep) Unwrap ¶

func (step *TimeoutStep) Unwrap() StepConfig

func (*TimeoutStep) Visit ¶

func (step *TimeoutStep) Visit(v StepVisitor) error

func (*TimeoutStep) Wrap ¶

func (step *TimeoutStep) Wrap(sub StepConfig)

type TryPlan ¶

type TryPlan struct {
	Step Plan `json:"step"`
}

func (TryPlan) Public ¶

func (plan TryPlan) Public() *json.RawMessage

type TryStep ¶

type TryStep struct {
	Step Step `json:"try"`
}

func (*TryStep) Visit ¶

func (step *TryStep) Visit(v StepVisitor) error

type TypeImage ¶

type TypeImage struct {
	// Image of the container. One of these must be specified.
	CheckPlan *Plan `json:"check_plan,omitempty"`
	GetPlan   *Plan `json:"get_plan,omitempty"`

	// The bottom-most resource type that this get step relies on.
	BaseType string `json:"base_type,omitempty"`

	// Privileged indicates whether the parent resource type is privileged.
	Privileged bool `json:"privileged,omitempty"`
}

func (TypeImage) EachPlan ¶

func (t TypeImage) EachPlan(f func(*Plan))

type User ¶

type User struct {
	ID        int    `json:"id,omitempty"`
	Username  string `json:"username,omitempty"`
	Connector string `json:"connector,omitempty"`
	LastLogin int64  `json:"last_login,omitempty"`
	Sub       string `json:"sub,omitempty"`
}

type UserInfo ¶

type UserInfo struct {
	Sub           string              `json:"sub"`
	Name          string              `json:"name"`
	UserId        string              `json:"user_id"`
	UserName      string              `json:"user_name"`
	Email         string              `json:"email"`
	IsAdmin       bool                `json:"is_admin"`
	IsSystem      bool                `json:"is_system"`
	Teams         map[string][]string `json:"teams"`
	Connector     string              `json:"connector"`
	DisplayUserId string              `json:"display_user_id"`
}

type VarScopedPlan ¶

type VarScopedPlan struct {
	Step   Plan          `json:"step"`
	Values []interface{} `json:"values"`
}

func (VarScopedPlan) Public ¶

func (plan VarScopedPlan) Public() *json.RawMessage

type VarSourceConfig ¶

type VarSourceConfig struct {
	Name   string      `json:"name"`
	Type   string      `json:"type"`
	Config interface{} `json:"config"`
}

type VarSourceConfigs ¶

type VarSourceConfigs []VarSourceConfig

func (VarSourceConfigs) Lookup ¶

func (c VarSourceConfigs) Lookup(name string) (VarSourceConfig, bool)

func (VarSourceConfigs) OrderByDependency ¶

func (c VarSourceConfigs) OrderByDependency() (VarSourceConfigs, error)

type VarSourceIndex ¶

type VarSourceIndex VarSourceConfigs

func (VarSourceIndex) FindEquivalent ¶

func (index VarSourceIndex) FindEquivalent(obj interface{}) (interface{}, bool)

func (VarSourceIndex) Slice ¶

func (index VarSourceIndex) Slice() []interface{}

type Version ¶

type Version map[string]string

type VersionConfig ¶

type VersionConfig struct {
	Every  bool
	Latest bool
	Pinned Version
}

A VersionConfig represents the choice to include every version of a resource, the latest version of a resource, or a pinned (specific) one.

func (*VersionConfig) MarshalJSON ¶

func (c *VersionConfig) MarshalJSON() ([]byte, error)

func (*VersionConfig) UnmarshalJSON ¶

func (c *VersionConfig) UnmarshalJSON(version []byte) error

type VersionDeleteBody ¶

type VersionDeleteBody struct {
	Version Version `json:"version"`
}

type Volume ¶

type Volume struct {
	ID                   string                  `json:"id"`
	WorkerName           string                  `json:"worker_name"`
	Type                 string                  `json:"type"`
	ContainerHandle      string                  `json:"container_handle"`
	Path                 string                  `json:"path"`
	ParentHandle         string                  `json:"parent_handle"`
	ResourceType         *VolumeResourceType     `json:"resource_type"`
	BaseResourceType     *VolumeBaseResourceType `json:"base_resource_type"`
	PipelineID           int                     `json:"pipeline_id"`
	PipelineName         string                  `json:"pipeline_name"`
	PipelineInstanceVars InstanceVars            `json:"pipeline_instance_vars"`
	JobName              string                  `json:"job_name"`
	StepName             string                  `json:"step_name"`
}

type VolumeBaseResourceType ¶

type VolumeBaseResourceType struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type VolumeResourceType ¶

type VolumeResourceType struct {
	ResourceType     *VolumeResourceType     `json:"resource_type"`
	BaseResourceType *VolumeBaseResourceType `json:"base_resource_type"`
	Version          Version                 `json:"version"`
}

type Wall ¶

type Wall struct {
	Message string        `json:"message,omitempty"`
	TTL     time.Duration `json:"TTL,omitempty"`
}

type Worker ¶

type Worker struct {
	// not garden_addr, for backwards-compatibility
	GardenAddr      string `json:"addr"`
	BaggageclaimURL string `json:"baggageclaim_url"`

	CertsPath *string `json:"certs_path,omitempty"`

	HTTPProxyURL  string `json:"http_proxy_url,omitempty"`
	HTTPSProxyURL string `json:"https_proxy_url,omitempty"`
	NoProxy       string `json:"no_proxy,omitempty"`

	ActiveContainers int `json:"active_containers"`
	ActiveVolumes    int `json:"active_volumes"`
	ActiveTasks      int `json:"active_tasks"`

	ResourceTypes []WorkerResourceType `json:"resource_types"`

	Platform  string `json:"platform"`
	Tags      Tags   `json:"tags"`
	Team      string `json:"team"`
	Name      string `json:"name"`
	Version   string `json:"version"`
	StartTime int64  `json:"start_time"`
	Ephemeral bool   `json:"ephemeral"`
	State     string `json:"state"`
}

func (Worker) Validate ¶

func (w Worker) Validate() error

type WorkerArtifact ¶

type WorkerArtifact struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	BuildID   int    `json:"build_id"`
	CreatedAt int64  `json:"created_at"`
}

type WorkerResourceType ¶

type WorkerResourceType struct {
	Type                 string `json:"type"`
	Image                string `json:"image"`
	Version              string `json:"version"`
	Privileged           bool   `json:"privileged"`
	UniqueVersionHistory bool   `json:"unique_version_history"`
}

Directories ¶

Path Synopsis
api
accessor/accessorfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
apifakes
Code generated by counterfeiter.
Code generated by counterfeiter.
auth/authfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
containerserver/containerserverfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
pipelineserver/pipelineserverfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
policychecker/policycheckerfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
auditorfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
buildsfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
cmd
atc
compressionfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
credsfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
ssm
db
dbfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
encryption/encryptionfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
lock/lockfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
enginefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
execfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
gc
gcfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
emitter/emitterfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
metricfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
opa
policyfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
schedulerfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
syslogfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
gardenruntime/gclient/connection/connectionfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
gardenruntime/gclient/gclientfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
gardenruntime/transport/transportfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
wrappafakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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