compiler

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: Apache-2.0 Imports: 14 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
}

Compiler compiles the yaml.

func New

func New(opts ...Option) *Compiler

New creates a new Compiler with options.

func (*Compiler) Compile

func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, error)

Compile compiles the YAML configuration to the pipeline intermediate representation configuration format.

type ErrExtraHostFormat

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

func (*ErrExtraHostFormat) Error

func (err *ErrExtraHostFormat) Error() string

func (*ErrExtraHostFormat) Is

func (*ErrExtraHostFormat) Is(target error) bool

type ErrStepDependencyCycle

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

func (*ErrStepDependencyCycle) Error

func (err *ErrStepDependencyCycle) Error() string

func (*ErrStepDependencyCycle) Is

func (*ErrStepDependencyCycle) Is(target error) bool

type ErrStepMissingDependency

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

func (*ErrStepMissingDependency) Error

func (err *ErrStepMissingDependency) Error() string

func (*ErrStepMissingDependency) Is

func (*ErrStepMissingDependency) Is(target error) bool

type Option

type Option func(*Compiler)

Option configures a compiler option.

func WithDefaultCloneImage

func WithDefaultCloneImage(cloneImage string) Option

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 WithEscalated

func WithEscalated(images ...string) Option

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

func WithLocal

func WithLocal(local bool) Option

WithLocal configures the compiler with the local flag. The local flag indicates the pipeline execution is running in a local development environment with a mounted local working directory.

func WithMetadata

func WithMetadata(metadata metadata.Metadata) Option

WithMetadata configures the compiler with the repository, pipeline and system metadata. The metadata is used to remove steps from the compiled pipeline configuration that should be skipped. The metadata is also added to each container as environment variables.

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 WithNetrcOnlyTrusted

func WithNetrcOnlyTrusted(only bool) Option

WithNetrcOnlyTrusted configures the compiler with the netrcOnlyTrusted repo option.

func WithNetworks

func WithNetworks(networks ...string) Option

WithNetworks configures the compiler with additional networks to be connected to pipeline containers.

func WithOption

func WithOption(option Option, b bool) Option

WithOption configures the compiler with the given option if boolean b evaluates to true.

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix configures the compiler with the prefix. The prefix is used to prefix container, volume and network names to avoid collision at runtime.

func WithProxy

func WithProxy(opt ProxyOptions) Option

WithProxy configures the compiler with HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables added by default to every container in the pipeline.

func WithRegistry

func WithRegistry(registries ...Registry) Option

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

func WithResourceLimit

func WithResourceLimit(swap, mem, shmSize, cpuQuota, cpuShares int64, cpuSet string) Option

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

func WithSecret

func WithSecret(secrets ...Secret) Option

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

func WithTrusted

func WithTrusted(trusted bool) Option

WithTrusted configures the compiler with the trusted repo option.

func WithVolumes

func WithVolumes(volumes ...string) Option

WithVolumes configures 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 pipeline and plugin steps in the pipeline.

func WithWorkspaceFromURL

func WithWorkspaceFromURL(base, u string) Option

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

type ProxyOptions

type ProxyOptions struct {
	NoProxy    string
	HTTPProxy  string
	HTTPSProxy string
}

type Registry

type Registry struct {
	Hostname string
	Username string
	Password string
}

Registry represents registry credentials.

type ResourceLimit

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

type Secret

type Secret struct {
	Name           string
	Value          string
	AllowedPlugins []string
	Events         []string
}

func (*Secret) Available

func (s *Secret) Available(event string, container *yaml_types.Container) error

func (*Secret) Match added in v2.3.0

func (s *Secret) Match(event string) bool

Match returns true if an image and event match the restricted list. Note that EventPullClosed are treated as EventPull.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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