compiler

package
v0.0.0-...-e51861b Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

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

A Compiler compiles a pipeline configuration to an intermediate runtime.

func New

func New(opts ...Option) *Compiler

New returns a new compiler

func (*Compiler) Compile

func (c *Compiler) Compile(conf *config.Config) (*engine.Config, error)

Compile compiles the parsed yaml configuration and converts to the drone runtime intermediate representation.

type Metadata

type Metadata struct {
	Ref         string
	Repo        string
	Platform    string
	Environment string
	Event       string
	Branch      string
	Matrix      map[string]string
}

Metadata represents pipeline metadata required to filter pipeline steps.

type Option

type Option func(*Compiler)

Option set a compiler option.

func WithClone

func WithClone(clone bool) Option

WithClone returns a compiler option to clone.

func WithEnviron

func WithEnviron(env map[string]string) Option

WithEnviron configures the compiler with environment variables added by default to every container in the pipeline.

func WithLimits

func WithLimits(limits Resources) Option

WithLimits configures the compiler with default resource limits that are applied each container in the pipeline.

func WithMetadata

func WithMetadata(m Metadata) Option

WithMetadata returns a compiler option to set metadata.

func WithNetrc

func WithNetrc(username, password, machine string) Option

WithNetrc configures the compiler with netrc authentication credentials added by default to every container in the pipeline.

func WithNetworks

func WithNetworks(networks ...string) Option

WithNetworks configures the compiler with additionnal networks to be connected to build containers

func WithPrivileged

func WithPrivileged(images ...string) Option

WithPrivileged configures the compiler to automatically execute images as privileged containers if the match the given list.

func WithRegistry

func WithRegistry(registries ...Registry) Option

WithRegistry configures the compiler with registry credentials that should be used to download images.

func WithSecret

func WithSecret(secrets ...Secret) Option

WithSecret configures the compiler with external secrets to be injected into the container at runtime.

func WithTransform

func WithTransform(t Transform) Option

WithTransform returns a compiler option to set transform t.

func WithVolumes

func WithVolumes(volumes ...string) Option

WithVolumes configutes the compiler with default volumes that are mounted to each container in the pipeline.

func WithWorkspace

func WithWorkspace(base, path string) Option

WithWorkspace configures the compiler with the workspace base and path. The workspace base is a volume created at runtime and mounted into all containers in the pipeline. The base and path are joined to provide the working directory for all build and plugin steps in the pipeline.

func WithWorkspaceFromURL

func WithWorkspaceFromURL(base, link string) Option

WithWorkspaceFromURL configures the compiler with the workspace base and path based on the repository url.

type Registry

type Registry struct {
	Hostname string
	Username string
	Password string
	Email    string
	Token    string
}

Registry represents registry credentials used to pull private images from a docker registry.

type Resources

type Resources struct {
	MemSwapLimit int64
	MemLimit     int64
	ShmSize      int64
	CPUQuota     int64
	CPUShares    int64
	CPUSet       string
}

Resources represents the container resource limits.

type Secret

type Secret struct {
	Name  string
	Value string
	Match []string
}

Secret represents a repository secret that should be passed to the container at runtime.

type Transform

type Transform func(*engine.Step, *yaml.Container, *config.Config)

Transform transforms container configuration to runtime configuration.

Jump to

Keyboard shortcuts

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