compiler

package
v0.7.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package compiler provides the ability for Vela to reconstruct a yaml configuration into an executable pipeline.

Usage:

import "github.com/go-vela/compiler/compiler"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToContext

func ToContext(c Setter, e Engine)

ToContext adds the compiler Engine to this context if it supports the Setter interface.

Types

type Engine

type Engine interface {

	// Compile defines a function that produces an executable
	// representation of a pipeline from an object. This calls
	// Parse internally to convert the object to a yaml configuration.
	Compile(interface{}) (*pipeline.Build, error)

	// Parse defines a function that converts
	// an object to a yaml configuration.
	Parse(interface{}) (*yaml.Build, []byte, error)

	// CloneStage defines a function that injects the
	// clone stage process into a yaml configuration.
	CloneStage(*yaml.Build) (*yaml.Build, error)
	// CloneStep defines a function that injects the
	// clone step process into a yaml configuration.
	CloneStep(*yaml.Build) (*yaml.Build, error)

	// EnvironmentStages defines a function that injects the environment
	// variables for each step in every stage into a yaml configuration.
	EnvironmentStages(yaml.StageSlice) (yaml.StageSlice, error)
	// EnvironmentSteps defines a function that injects the environment
	// variables for each step into a yaml configuration.
	EnvironmentSteps(yaml.StepSlice) (yaml.StepSlice, error)
	// EnvironmentStep defines a function that injects the environment
	// variables for a single step into a yaml configuration.
	EnvironmentStep(*yaml.Step) (*yaml.Step, error)
	// EnvironmentServices defines a function that injects the environment
	// variables for each service into a yaml configuration.
	EnvironmentServices(yaml.ServiceSlice) (yaml.ServiceSlice, error)

	// ExpandStages defines a function that injects the template
	// for each templated step in every stage in a yaml configuration.
	ExpandStages(yaml.StageSlice, map[string]*yaml.Template) (yaml.StageSlice, error)
	// ExpandSteps defines a function that injects the template
	// for each templated step in a yaml configuration.
	ExpandSteps(yaml.StepSlice, map[string]*yaml.Template) (yaml.StepSlice, error)

	// InitStage defines a function that injects the
	// init stage process into a yaml configuration.
	InitStage(*yaml.Build) (*yaml.Build, error)
	// CloneStep defines a function that injects the
	// init step process into a yaml configuration.
	InitStep(*yaml.Build) (*yaml.Build, error)

	// ScriptStages defines a function that injects the script
	// for each step in every stage in a yaml configuration.
	ScriptStages(yaml.StageSlice) (yaml.StageSlice, error)
	// ScriptSteps defines a function that injects the script
	// for each step in a yaml configuration.
	ScriptSteps(yaml.StepSlice) (yaml.StepSlice, error)

	// SubstituteStages defines a function that replaces every
	// declared environment variable with it's corresponding
	// value for each step in every stage in a yaml configuration.
	SubstituteStages(yaml.StageSlice) (yaml.StageSlice, error)
	// SubstituteSteps defines a function that replaces every
	// declared environment variable with it's corresponding
	// value for each step in a yaml configuration.
	SubstituteSteps(yaml.StepSlice) (yaml.StepSlice, error)

	// TransformStages defines a function that converts a yaml
	// configuration with stages into an executable pipeline.
	TransformStages(*pipeline.RuleData, *yaml.Build) (*pipeline.Build, error)
	// TransformSteps defines a function that converts a yaml
	// configuration with steps into an executable pipeline.
	TransformSteps(*pipeline.RuleData, *yaml.Build) (*pipeline.Build, error)

	// WithBuild defines a function that sets
	// the library build type in the Engine.
	WithBuild(*library.Build) Engine
	// WithComment defines a function that sets
	// the comment in the Engine.
	WithComment(string) Engine
	// WithFiles defines a function that sets
	// the changeset files in the Engine.
	WithFiles([]string) Engine
	// WithLocal defines a function that sets
	// the compiler local field in the Engine.
	WithLocal(bool) Engine
	// WithMetadata defines a function that sets
	// the compiler Metadata type in the Engine.
	WithMetadata(*types.Metadata) Engine
	// WithRepo defines a function that sets
	// the library repo type in the Engine.
	WithRepo(*library.Repo) Engine
	// WithUser defines a function that sets
	// the library user type in the Engine.
	WithUser(*library.User) Engine
}

Engine represents an interface for converting a yaml configuration to an executable pipeline for Vela.

func FromContext

func FromContext(c context.Context) Engine

FromContext returns the compiler Engine associated with this context.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Directories

Path Synopsis
Package native provides the ability for Vela to reconstruct a yaml configuration into an executable pipeline.
Package native provides the ability for Vela to reconstruct a yaml configuration into an executable pipeline.

Jump to

Keyboard shortcuts

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