config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{}

Functions

This section is empty.

Types

type BaseStep

type BaseStep struct {
	Type string `json:"type"`
	Name string `json:"name"`
	When *When  `json:"when"`
}

type CloneStep

type CloneStep struct {
	BaseStep          `json:",inline"`
	Depth             *int `json:"depth"`
	RecurseSubmodules bool `json:"recurse_submodules"`
}

type Config

type Config struct {
	Runs []*Run `json:"runs"`

	DockerRegistriesAuth map[string]*DockerRegistryAuth `json:"docker_registries_auth"`
}

func ParseConfig

func ParseConfig(configData []byte, format ConfigFormat, configContext *ConfigContext) (*Config, error)

func (*Config) Run

func (c *Config) Run(runName string) *Run

type ConfigContext added in v0.6.0

type ConfigContext struct {
	RefType       itypes.RunRefType `json:"ref_type"`
	Ref           string            `json:"ref"`
	Branch        string            `json:"branch"`
	Tag           string            `json:"tag"`
	PullRequestID string            `json:"pull_request_id"`
	CommitSHA     string            `json:"commit_sha"`
}

ConfigContext is the context to pass to the config generator. Fields are not marked as omitempty since we want to provide all of them with empty value if not existing in such context (i.e. pull_request_id will be an empty string when not a pull request)

type ConfigFormat

type ConfigFormat int
const (
	// ConfigFormatJSON handles both json or yaml format (since json is a subset of yaml)
	ConfigFormatJSON ConfigFormat = iota
	ConfigFormatJsonnet
	ConfigFormatStarlark
)

type Container

type Container struct {
	Image       string           `json:"image,omitempty"`
	Environment map[string]Value `json:"environment,omitempty"`
	User        string           `json:"user"`
	Privileged  bool             `json:"privileged"`
	Entrypoint  string           `json:"entrypoint"`
	Volumes     []Volume         `json:"volumes"`
}

type Depend

type Depend struct {
	TaskName   string            `json:"task"`
	Conditions []DependCondition `json:"conditions"`
}

type DependCondition

type DependCondition string
const (
	DependConditionOnSuccess DependCondition = "on_success"
	DependConditionOnFailure DependCondition = "on_failure"
	DependConditionOnSkipped DependCondition = "on_skipped"
)

type Depends

type Depends []*Depend

func (*Depends) UnmarshalJSON

func (d *Depends) UnmarshalJSON(b []byte) error

type DockerRegistryAuth

type DockerRegistryAuth struct {
	Type DockerRegistryAuthType `json:"type"`

	// basic auth
	Username Value `json:"username"`
	Password Value `json:"password"`

	// encoded auth
	Auth Value `json:"auth"`
}

type DockerRegistryAuthType

type DockerRegistryAuthType string
const (
	DockerRegistryAuthTypeBasic       DockerRegistryAuthType = "basic"
	DockerRegistryAuthTypeEncodedAuth DockerRegistryAuthType = "encodedauth"
)

type RestoreCacheStep

type RestoreCacheStep struct {
	BaseStep `json:",inline"`
	Keys     []string `json:"keys"`
	DestDir  string   `json:"dest_dir"`
}

type RestoreWorkspaceStep

type RestoreWorkspaceStep struct {
	BaseStep `json:",inline"`
	DestDir  string `json:"dest_dir"`
}

type Run

type Run struct {
	Name                 string                         `json:"name"`
	Tasks                []*Task                        `json:"tasks"`
	When                 *When                          `json:"when"`
	DockerRegistriesAuth map[string]*DockerRegistryAuth `json:"docker_registries_auth"`
}

func (*Run) Task

func (r *Run) Task(taskName string) *Task

type RunStep

type RunStep struct {
	BaseStep    `json:",inline"`
	Command     string           `json:"command"`
	Environment map[string]Value `json:"environment,omitempty"`
	WorkingDir  string           `json:"working_dir"`
	Shell       string           `json:"shell"`
	Tty         *bool            `json:"tty"`
}

type Runtime

type Runtime struct {
	Type       RuntimeType  `json:"type,omitempty"`
	Arch       types.Arch   `json:"arch,omitempty"`
	Containers []*Container `json:"containers,omitempty"`
}

type RuntimeType

type RuntimeType string
const (
	RuntimeTypePod RuntimeType = "pod"
)

type SaveCacheStep

type SaveCacheStep struct {
	BaseStep `json:",inline"`
	Key      string         `json:"key"`
	Contents []*SaveContent `json:"contents"`
}

type SaveContent

type SaveContent struct {
	SourceDir string   `json:"source_dir"`
	DestDir   string   `json:"dest_dir"`
	Paths     []string `json:"paths"`
}

type SaveToWorkspaceStep

type SaveToWorkspaceStep struct {
	BaseStep `json:",inline"`
	Contents []*SaveContent `json:"contents"`
}

type Step

type Step interface{}

type Steps

type Steps []Step

func (*Steps) UnmarshalJSON

func (s *Steps) UnmarshalJSON(b []byte) error

type Task

type Task struct {
	Name                 string                         `json:"name"`
	Runtime              *Runtime                       `json:"runtime"`
	Environment          map[string]Value               `json:"environment,omitempty"`
	WorkingDir           string                         `json:"working_dir"`
	Shell                string                         `json:"shell"`
	User                 string                         `json:"user"`
	Steps                Steps                          `json:"steps"`
	Depends              Depends                        `json:"depends"`
	IgnoreFailure        bool                           `json:"ignore_failure"`
	Approval             bool                           `json:"approval"`
	When                 *When                          `json:"when"`
	DockerRegistriesAuth map[string]*DockerRegistryAuth `json:"docker_registries_auth"`
}

type Value

type Value struct {
	Type  ValueType
	Value string
}

func (*Value) UnmarshalJSON

func (val *Value) UnmarshalJSON(b []byte) error

type ValueType

type ValueType int
const (
	ValueTypeString ValueType = iota
	ValueTypeFromVariable
)

type Volume added in v0.3.0

type Volume struct {
	Path string `json:"path"`

	TmpFS *VolumeTmpFS `json:"tmpfs"`
}

type VolumeTmpFS added in v0.3.0

type VolumeTmpFS struct {
	Size *resource.Quantity `json:"size"`
}

type When

type When types.When

func (*When) ToWhen added in v0.2.0

func (w *When) ToWhen() *types.When

func (*When) UnmarshalJSON

func (w *When) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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