runner

package
v0.0.0-...-9aada0e Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactConfig

type ArtifactConfig struct {
	ArtifactUploaderImage string `yaml:"artifactUploaderImage"`
	ImagePullSecret       string `yaml:"imagePullSecret"`
}

type BCEntries

type BCEntries map[string]interface{}

type BuildContext

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

func NewBuildContext

func NewBuildContext(vals BCEntries) *BuildContext

func (*BuildContext) Get

func (c *BuildContext) Get() context.Context

func (*BuildContext) GetVal

func (c *BuildContext) GetVal(key string) interface{}

func (*BuildContext) WithValue

func (c *BuildContext) WithValue(key string, val interface{}) *BuildContext

func (*BuildContext) WithValues

func (c *BuildContext) WithValues(vals BCEntries) *BuildContext

type BuildState

type BuildState struct {
	Pipeline     *Pipeline
	BuildContext *BuildContext
}

type Config

type Config struct {
	Kubernetes KubeConfig  `yaml:"kubernetes"`
	Redis      RedisConfig `yaml:"redis"`
	// image to use for artifact scraping
	Artifacts ArtifactConfig `yaml:"artifacts"`
}

type Interface

type Interface interface {
	RunPipeline(req *Request) (<-chan *BuildState, error)
	GetPipeline(uid string) (*Pipeline, error)
	ListArtifacts(pipelineId string) ([]string, error)
	GetArtifact(pipelineId, name string) ([]byte, error)
	RetryFailedJobs(pipelineId string, ctx *BuildContext) (<-chan *BuildState, error)
}

func New

func New(cfg *Config, runnerId string, logger *log.Logger) Interface

type Job

type Job struct {
	JobDef         `json:"def"`
	UID            string    `json:"uid"`
	Status         JobStatus `json:"status"`
	Done           bool      `json:"done"`
	Name           string    `json:"name"`
	StartTime      time.Time `json:"startTime"`
	CompletionTime time.Time `json:"completionTime"`
}

type JobDef

type JobDef struct {
	Name         string            `yaml:"name" json:"name"`
	Image        string            `yaml:"image" json:"image"`
	Script       string            `yaml:"script" json:"script"`
	Env          map[string]string `yaml:"env" json:"env"`
	Secrets      []Secret          `yaml:"secrets" json:"secrets"`
	PullSecrets  []string          `yaml:"pullSecrets" json:"pullSecrets"`
	AllowFailure bool              `yaml:"allowFailure" json:"allowFailure"`
}

type JobStatus

type JobStatus int
const (
	JOB_ACTIVE JobStatus = iota
	JOB_FAILED
	JOB_SUCCEEDED
	JOB_UNKNOWN
	JOB_SCHEDULED
)

func (JobStatus) FromString

func (js JobStatus) FromString(status string) JobStatus

func (JobStatus) MarshalJSON

func (js JobStatus) MarshalJSON() ([]byte, error)

func (JobStatus) String

func (js JobStatus) String() string

func (*JobStatus) UnmarshalJSON

func (js *JobStatus) UnmarshalJSON(data []byte) error

type KubeConfig

type KubeConfig struct {
	// setting this to true means that the application is running outside of the cluster
	DevMode bool `yaml:"devMode"`
	// this must be set if dev mode is set to true
	Kubeconfig string `yaml:"kubeconfig"`
	// namespace to run jobs in
	JobNamespace string `yaml:"jobNamespace"`
}

type Pipeline

type Pipeline struct {
	PipelineDef   `json:"def"`
	Jobs          []*Job         `json:"jobs"`
	UID           string         `json:"uid"`
	Status        PipelineStatus `json:"status"`
	StatusContext string         `json:"statusContext"`
}

type PipelineDef

type PipelineDef struct {
	Name string   `yaml:"name" json:"name"`
	Jobs []JobDef `yaml:"jobs" json:"jobs"`
}

func (PipelineDef) DeepCopy

func (pd PipelineDef) DeepCopy() PipelineDef

type PipelineStatus

type PipelineStatus int
const (
	PIPELINE_RUNNING PipelineStatus = iota
	PIPELINE_FAILED
	PIPELINE_COMPLETED
)

func (PipelineStatus) FromString

func (ps PipelineStatus) FromString(status string) PipelineStatus

func (PipelineStatus) MarshalJSON

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

func (PipelineStatus) String

func (ps PipelineStatus) String() string

func (*PipelineStatus) UnmarshalJSON

func (ps *PipelineStatus) UnmarshalJSON(data []byte) error

type RedisConfig

type RedisConfig struct {
	IsCluster bool   `yaml:"isCluster"`
	Address   string `yaml:"address"`
}

type Request

type Request struct {
	PipelineDef *PipelineDef
	Context     *BuildContext
}

type Secret

type Secret struct {
	Name string `yaml:"name" json:"name"`
	// Kubernetes secret name to refer to
	ValueRef string `yaml:"valueRef" json:"valueRef"`
	// Key inside the secret. If not specified, all data will be taken and exposed either via ENV or mounted to specified path
	Key string `yaml:"key" json:"key"`
	// If this is specified, secret will be mounted to specified path
	// If key is specified, the resulting path will be Mountpath/Key
	MountPath string `yaml:"mountPath" json:"mountPath"`
}

If MountPath is specified, then the secret will be mounted as file If MountPath is not specified, secret will be injected into environment

Jump to

Keyboard shortcuts

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