compiler

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

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

Usage:

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

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

WithContext inserts the compiler Engine into the context.Context.

func WithGinContext

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, *library.Pipeline, error)

	// CompileLite defines a function that produces an light executable
	// representation of a pipeline from an object. This calls
	// Parse internally to convert the object to a yaml configuration.
	CompileLite(interface{}, bool, bool) (*yaml.Build, *library.Pipeline, 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{}, string, *yaml.Template) (*yaml.Build, []byte, 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.
	ExpandStages(*yaml.Build, map[string]*yaml.Template, *pipeline.RuleData) (*yaml.Build, error)
	// ExpandSteps defines a function that injects the template
	// for each templated step in a yaml configuration with the provided template depth.
	ExpandSteps(*yaml.Build, map[string]*yaml.Template, *pipeline.RuleData, int) (*yaml.Build, 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
	// WithCommit defines a function that sets
	// the commit in the Engine.
	WithCommit(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
	// WithLocalTemplates defines a function that sets
	// the compiler local templates field in the Engine.
	WithLocalTemplates([]string) 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

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.
Package registry provides the ability for Vela to integrate with different supported Template registries.
Package registry provides the ability for Vela to integrate with different supported Template registries.
github
Package github provides the ability for Vela to integrate with GitHub or GitHub Enterprise as a template registry.
Package github provides the ability for Vela to integrate with GitHub or GitHub Enterprise as a template registry.
Package template provides the ability for Vela to render a templated yaml configuration into an executable pipeline.
Package template provides the ability for Vela to render a templated yaml configuration into an executable pipeline.
native
Package native provides the ability for Vela to render a templated yaml configuration into an executable pipeline.
Package native provides the ability for Vela to render a templated yaml configuration into an executable pipeline.

Jump to

Keyboard shortcuts

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