instance

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentImage is the image we'll use to create a working volume.
	AgentImage = "gcr.io/cirrus-ci-community/cirrus-ci-agent:v1.8.0"

	// Where working volume is mounted to.
	WorkingVolumeMountpoint = "/tmp/cirrus-ci"

	// Agent binary relative to the WorkingVolumeMountpoint.
	WorkingVolumeAgent = "cirrus-ci-agent"

	// Working directory relative to the WorkingVolumeMountpoint.
	WorkingVolumeWorkingDir = "working-dir"
)

Variables

View Source
var (
	ErrUnsupportedInstance       = errors.New("unsupported instance type")
	ErrAdditionalContainerFailed = errors.New("additional container failed")
)
View Source
var (
	ErrVolumeCreationFailed = errors.New("working volume creation failed")
	ErrVolumeCleanupFailed  = errors.New("failed to clean up working volume")
)
View Source
var ErrPipeCreationFailed = errors.New("failed to create pipe instance")

Functions

func CreateTempArchive added in v0.3.0

func CreateTempArchive(dir string) (string, error)

func RunDockerizedAgent added in v0.3.0

func RunDockerizedAgent(ctx context.Context, config *RunConfig, params *Params) error

Types

type ContainerInstance added in v0.3.0

type ContainerInstance struct {
	Image                string
	CPU                  float32
	Memory               uint32
	AdditionalContainers []*api.AdditionalContainer
}

func (*ContainerInstance) Run added in v0.3.0

func (inst *ContainerInstance) Run(ctx context.Context, config *RunConfig) error

type Instance

type Instance interface {
	Run(context.Context, *RunConfig) error
}

func NewFromProto

func NewFromProto(anyInstance *any.Any, commands []*api.Command) (Instance, error)

type Params added in v0.3.0

type Params struct {
	Image                  string
	CPU                    float32
	Memory                 uint32
	AdditionalContainers   []*api.AdditionalContainer
	CommandFrom, CommandTo string
	WorkingVolumeName      string
}

type PipeInstance added in v0.3.0

type PipeInstance struct {
	Stages []PipeStage
	CPU    float32
	Memory uint32
}

func (*PipeInstance) Run added in v0.3.0

func (pi *PipeInstance) Run(ctx context.Context, config *RunConfig) error

type PipeStage added in v0.3.0

type PipeStage struct {
	Image                  string
	CommandFrom, CommandTo string
}

func PipeStagesFromCommands added in v0.3.0

func PipeStagesFromCommands(commands []*api.Command) ([]PipeStage, error)

PipeStagesFromCommands uses image hints in commands to build the stages.

type PrebuiltInstance added in v0.3.0

type PrebuiltInstance struct {
	Image      string
	Dockerfile string
	Arguments  map[string]string
}

func (*PrebuiltInstance) Run added in v0.3.0

func (prebuilt *PrebuiltInstance) Run(ctx context.Context, config *RunConfig) error

type RunConfig

type RunConfig struct {
	ProjectDir                 string
	Endpoint                   string
	ServerSecret, ClientSecret string
	TaskID                     int64
	Logger                     *echelon.Logger
	DirtyMode                  bool
	DockerOptions              options.DockerOptions
}

type Volume added in v0.3.0

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

func CreateWorkingVolume added in v0.3.0

func CreateWorkingVolume(ctx context.Context, projectDir string, dontPopulate bool) (*Volume, error)

CreateWorkingVolume returns a Docker volume name with the agent and copied projectDir.

func CreateWorkingVolumeFromConfig added in v0.3.0

func CreateWorkingVolumeFromConfig(ctx context.Context, config *RunConfig) (*Volume, error)

CreateWorkingVolume returns a Docker volume name with the agent and copied projectDir.

func (*Volume) Close added in v0.3.0

func (volume *Volume) Close() error

func (*Volume) Name added in v0.3.0

func (volume *Volume) Name() string

Jump to

Keyboard shortcuts

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