compiler

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHostWorkspace

func CreateHostWorkspace(workdir string) func(*engine.Spec)

CreateHostWorkspace returns a WorkspaceFunc that mounts a host machine volume as the pipeline workspace.

func CreateWorkspace

func CreateWorkspace(spec *engine.Spec)

CreateWorkspace creates the workspace volume as an empty directory mount.

func DindFunc

func DindFunc(images []string) func(*yaml.Container) bool

DindFunc is a helper function that returns true if a container image (specifically a plugin) is a whitelisted dind container and should be executed in privileged mode.

func MountHostWorkspace

func MountHostWorkspace(step *engine.Step, base, path, full string)

MountHostWorkspace is a WorkspaceFunc that mounts the default workspace and host volume to the pipeline.

func MountWorkspace

func MountWorkspace(step *engine.Step, base, path, full string)

MountWorkspace is a WorkspaceFunc that mounts the default workspace volume to the pipeline step.

func SkipFunc

func SkipFunc(data SkipData) func(*yaml.Container) bool

SkipFunc returns a function that can be used to skip individual pipeline steps based on build metadata.

Types

type Compiler

type Compiler struct {
	// GitCredentialsFunc returns a .git-credentials file
	// that can be used by the default clone step to
	// authenticate to the remote repository.
	GitCredentialsFunc func() []byte

	// NetrcFunc returns a .netrc file that can be used by
	// the default clone step to authenticate to the remote
	// repository.
	NetrcFunc func() []byte

	// PrivilegedFunc returns true if the container should
	// be started in privileged mode. The intended use is
	// for plugins that run Docker-in-Docker. This will be
	// deprecated in a future release.
	PrivilegedFunc func(*yaml.Container) bool

	// SkipFunc returns true if the step should be skipped.
	// The skip function can be used to evaluate the when
	// clause of each step, and return true if it should
	// be skipped.
	SkipFunc func(*yaml.Container) bool

	// TransformFunc can be used to modify the compiled
	// output prior to completion. This can be useful when
	// you need to programatically modify the output,
	// set defaults, etc.
	TransformFunc func(*engine.Spec)

	// WorkspaceFunc can be used to set the workspace volume
	// that is created for the entire pipeline. The primary
	// use case for this function is running local builds,
	// where the workspace is mounted to the host machine
	// working directory.
	WorkspaceFunc func(*engine.Spec)

	// WorkspaceMountFunc can be used to override the default
	// workspace volume mount.
	WorkspaceMountFunc func(step *engine.Step, base, path, full string)
}

A Compiler compiles the pipeline configuration to an intermediate representation that can be executed by the Drone runtime engine.

func (*Compiler) Compile

func (c *Compiler) Compile(from *yaml.Pipeline) *engine.Spec

Compile returns an intermediate representation of the pipeline configuration that can be executed by the Drone runtime engine.

type SkipData

type SkipData struct {
	Branch   string
	Cron     string
	Event    string
	Instance string
	Ref      string
	Repo     string
	Target   string
	Action   string
}

SkipData provides build metadata use to determine if a pipeline step should be skipped.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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