compiler

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 7 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 WithContext added in v0.8.0

func WithContext(c context.Context, e Engine) context.Context

WithContext inserts the compiler Engine into the context.Context.

func WithGinContext added in v0.8.0

func WithGinContext(c *gin.Context, e Engine)

WithGinContext inserts the compiler Engine into the gin.Context.

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)

	// Duplicate defines a function that
	// creates a clone of the Engine.
	Duplicate() Engine

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

	// ParseRaw defines a function that converts
	// an object to a string.
	ParseRaw(interface{}) (string, error)

	// Validate defines a function that verifies
	// the yaml configuration is accurate.
	Validate(*yaml.Build) 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, raw.StringSliceMap) (yaml.StageSlice, error)
	// EnvironmentSteps defines a function that injects the environment
	// variables for each step into a yaml configuration.
	EnvironmentSteps(yaml.StepSlice, raw.StringSliceMap) (yaml.StepSlice, error)
	// EnvironmentStep defines a function that injects the environment
	// variables for a single step into a yaml configuration.
	EnvironmentStep(*yaml.Step, raw.StringSliceMap) (*yaml.Step, error)
	// EnvironmentServices defines a function that injects the environment
	// variables for each service into a yaml configuration.
	EnvironmentServices(yaml.ServiceSlice, raw.StringSliceMap) (yaml.ServiceSlice, error)

	// ExpandStages defines a function that injects the template
	// for each templated step in every stage in a yaml configuration.
	// nolint: lll // ignore long line length due to return args
	ExpandStages(*yaml.Build, map[string]*yaml.Template) (yaml.StageSlice, yaml.SecretSlice, yaml.ServiceSlice, error)
	// ExpandSteps defines a function that injects the template
	// for each templated step in a yaml configuration.
	// nolint: lll // ignore long line length due to return args
	ExpandSteps(*yaml.Build, map[string]*yaml.Template) (yaml.StepSlice, yaml.SecretSlice, yaml.ServiceSlice, error)

	// InitStage defines a function that injects the
	// init stage process into a yaml configuration.
	InitStage(*yaml.Build) (*yaml.Build, error)
	// InitStep 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
	// WithUser defines a function that sets
	// the private github client in the Engine.
	WithPrivateGitHub(string, string) 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 retrieves the compiler Engine from the context.Context.

func FromGinContext added in v0.8.0

func FromGinContext(c *gin.Context) Engine

FromGinContext retrieves the compiler Engine from the gin.Context.

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