native

package
v0.27.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: Apache-2.0 Imports: 34 Imported by: 2

Documentation

Overview

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

Usage:

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBytes

func ParseBytes(data []byte) (*yaml.Build, []byte, []string, error)

ParseBytes converts a byte slice to a yaml configuration.

func ParseFile

func ParseFile(f *os.File) (*yaml.Build, []byte, []string, error)

ParseFile converts an os.File into a yaml configuration.

func ParseFileRaw

func ParseFileRaw(f *os.File) (string, error)

ParseFileRaw converts an os.File into a string.

func ParsePath

func ParsePath(p string) (*yaml.Build, []byte, []string, error)

ParsePath converts a file path into a yaml configuration.

func ParsePathRaw

func ParsePathRaw(p string) (string, error)

ParsePathRaw converts a file path into a yaml configuration.

func ParseReader

func ParseReader(r io.Reader) (*yaml.Build, []byte, []string, error)

ParseReader converts an io.Reader into a yaml configuration.

func ParseReaderRaw

func ParseReaderRaw(r io.Reader) (string, error)

ParseReaderRaw converts an io.Reader into a yaml configuration.

func ParseString

func ParseString(s string) (*yaml.Build, []byte, []string, error)

ParseString converts a string into a yaml configuration.

Types

type Client added in v0.27.0

type Client struct {
	Github           registry.Service
	PrivateGithub    registry.Service
	UsePrivateGithub bool

	ModificationService ModificationConfig
	TemplateCache       map[string][]byte

	settings.Compiler
	// contains filtered or unexported fields
}

func FromCLICommand added in v0.27.0

func FromCLICommand(ctx context.Context, cmd *cli.Command) (*Client, error)

FromCLICommand returns a Pipeline implementation that integrates with the supported registries.

func (*Client) CloneStage added in v0.27.0

func (c *Client) CloneStage(p *yaml.Build) (*yaml.Build, error)

CloneStage injects the clone stage process into a yaml configuration.

func (*Client) CloneStep added in v0.27.0

func (c *Client) CloneStep(p *yaml.Build) (*yaml.Build, error)

CloneStep injects the clone step process into a yaml configuration.

func (*Client) Compile added in v0.27.0

func (c *Client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, *api.Pipeline, error)

Compile produces an executable pipeline from a yaml configuration.

func (*Client) CompileLite added in v0.27.0

func (c *Client) CompileLite(ctx context.Context, v interface{}, ruleData *pipeline.RuleData, substitute bool) (*yaml.Build, *api.Pipeline, error)

CompileLite produces a partial of an executable pipeline from a yaml configuration.

func (*Client) Duplicate added in v0.27.0

func (c *Client) Duplicate() compiler.Engine

Duplicate creates a clone of the Engine.

func (*Client) EnvironmentBuild added in v0.27.0

func (c *Client) EnvironmentBuild() map[string]string

EnvironmentBuild injects environment variables for the build in a yaml configuration.

func (*Client) EnvironmentSecrets added in v0.27.0

func (c *Client) EnvironmentSecrets(s yaml.SecretSlice, globalEnv raw.StringSliceMap) (yaml.SecretSlice, error)

EnvironmentSecrets injects environment variables for each secret plugin in a yaml configuration.

func (*Client) EnvironmentServices added in v0.27.0

func (c *Client) EnvironmentServices(s yaml.ServiceSlice, globalEnv raw.StringSliceMap) (yaml.ServiceSlice, error)

EnvironmentServices injects environment variables for each service in a yaml configuration.

func (*Client) EnvironmentStage added in v0.27.0

func (c *Client) EnvironmentStage(s *yaml.Stage, globalEnv raw.StringSliceMap) (*yaml.Stage, error)

EnvironmentStage injects environment variables for each stage in a yaml configuration.

func (*Client) EnvironmentStages added in v0.27.0

func (c *Client) EnvironmentStages(s yaml.StageSlice, globalEnv raw.StringSliceMap) (yaml.StageSlice, error)

EnvironmentStages injects environment variables for each stage in a yaml configuration.

func (*Client) EnvironmentStep added in v0.27.0

func (c *Client) EnvironmentStep(s *yaml.Step, stageEnv raw.StringSliceMap) (*yaml.Step, error)

EnvironmentStep injects environment variables a single step in a yaml configuration.

func (*Client) EnvironmentSteps added in v0.27.0

func (c *Client) EnvironmentSteps(s yaml.StepSlice, stageEnv raw.StringSliceMap) (yaml.StepSlice, error)

EnvironmentSteps injects environment variables for each step in a stage for the yaml configuration.

func (*Client) ExpandDeployment added in v0.27.0

func (c *Client) ExpandDeployment(ctx context.Context, b *yaml.Build, tmpls map[string]*yaml.Template) (*yaml.Build, error)

ExpandDeployment injects the template for a templated deployment config in a yaml configuration.

func (*Client) ExpandStages added in v0.27.0

func (c *Client) ExpandStages(ctx context.Context, s *yaml.Build, tmpls map[string]*yaml.Template, r *pipeline.RuleData, warnings []string) (*yaml.Build, []string, error)

ExpandStages injects the template for each templated step in every stage in a yaml configuration.

func (*Client) ExpandSteps added in v0.27.0

func (c *Client) ExpandSteps(ctx context.Context, s *yaml.Build, tmpls map[string]*yaml.Template, r *pipeline.RuleData, warnings []string, depth int) (*yaml.Build, []string, error)

ExpandSteps injects the template for each templated step in a yaml configuration.

func (*Client) GetSettings added in v0.27.0

func (c *Client) GetSettings() settings.Compiler

GetSettings retrieves the api settings type.

func (*Client) InitStage added in v0.27.0

func (c *Client) InitStage(p *yaml.Build) (*yaml.Build, error)

InitStage injects the init stage process into a yaml configuration.

func (*Client) InitStep added in v0.27.0

func (c *Client) InitStep(p *yaml.Build) (*yaml.Build, error)

InitStep injects the init step process into a yaml configuration.

func (*Client) Parse added in v0.27.0

func (c *Client) Parse(v interface{}, pipelineType string, template *yaml.Template) (*yaml.Build, []byte, []string, error)

Parse converts an object to a yaml configuration.

func (*Client) ParseRaw added in v0.27.0

func (c *Client) ParseRaw(v interface{}) (string, error)

ParseRaw converts an object to a string.

func (*Client) ScriptStages added in v0.27.0

func (c *Client) ScriptStages(s yaml.StageSlice) (yaml.StageSlice, error)

ScriptStages injects the script for each step in every stage in a yaml configuration.

func (*Client) ScriptSteps added in v0.27.0

func (c *Client) ScriptSteps(s yaml.StepSlice) (yaml.StepSlice, error)

ScriptSteps injects the script for each step in a yaml configuration.

func (*Client) SetSettings added in v0.27.0

func (c *Client) SetSettings(s *settings.Platform)

SetSettings sets the api settings type.

func (*Client) SubstituteStages added in v0.27.0

func (c *Client) SubstituteStages(s types.StageSlice) (types.StageSlice, error)

SubstituteStages replaces every declared environment variable with its corresponding value for each step in every stage in a yaml configuration.

func (*Client) SubstituteSteps added in v0.27.0

func (c *Client) SubstituteSteps(s types.StepSlice) (types.StepSlice, error)

SubstituteSteps replaces every declared environment variable with its corresponding value for each step in a yaml configuration.

func (*Client) TransformStages added in v0.27.0

func (c *Client) TransformStages(r *pipeline.RuleData, p *yaml.Build) (*pipeline.Build, error)

TransformStages converts a yaml configuration with stages into an executable pipeline.

func (*Client) TransformSteps added in v0.27.0

func (c *Client) TransformSteps(r *pipeline.RuleData, p *yaml.Build) (*pipeline.Build, error)

TransformSteps converts a yaml configuration with steps into an executable pipeline.

func (*Client) ValidatePipeline added in v0.27.0

func (c *Client) ValidatePipeline(p *pipeline.Build) error

ValidatePipeline verifies the final pipeline configuration is valid.

func (*Client) ValidateYAML added in v0.27.0

func (c *Client) ValidateYAML(p *yaml.Build) error

ValidateYAML verifies the yaml configuration is valid.

func (*Client) WithBuild added in v0.27.0

func (c *Client) WithBuild(b *api.Build) compiler.Engine

WithBuild sets the API build type in the Engine.

func (*Client) WithComment added in v0.27.0

func (c *Client) WithComment(cmt string) compiler.Engine

WithComment sets the comment in the Engine.

func (*Client) WithCommit added in v0.27.0

func (c *Client) WithCommit(cmt string) compiler.Engine

WithCommit sets the comment in the Engine.

func (*Client) WithDatabase added in v0.27.0

func (c *Client) WithDatabase(db database.Interface) compiler.Engine

WithDatabase sets the database in the Engine.

func (*Client) WithFiles added in v0.27.0

func (c *Client) WithFiles(f []string) compiler.Engine

WithFiles sets the changeset files in the Engine.

func (*Client) WithLabels added in v0.27.0

func (c *Client) WithLabels(labels []string) compiler.Engine

WithLabels sets the label(s) in the Engine.

func (*Client) WithLocal added in v0.27.0

func (c *Client) WithLocal(local bool) compiler.Engine

WithLocal sets the compiler metadata type in the Engine.

func (*Client) WithLocalTemplates added in v0.27.0

func (c *Client) WithLocalTemplates(templates []string) compiler.Engine

WithLocalTemplates sets the compiler local templates in the Engine.

func (*Client) WithMetadata added in v0.27.0

func (c *Client) WithMetadata(m *internal.Metadata) compiler.Engine

WithMetadata sets the compiler metadata type in the Engine.

func (*Client) WithNetrc added in v0.27.0

func (c *Client) WithNetrc(n string) compiler.Engine

WithNetrc sets the netrc in the Engine.

func (*Client) WithPrivateGitHub added in v0.27.0

func (c *Client) WithPrivateGitHub(ctx context.Context, url, token string) compiler.Engine

WithPrivateGitHub sets the private github client in the Engine.

func (*Client) WithRepo added in v0.27.0

func (c *Client) WithRepo(r *api.Repo) compiler.Engine

WithRepo sets the API repo type in the Engine.

func (*Client) WithSCM added in v0.27.0

func (c *Client) WithSCM(_scm scm.Service) compiler.Engine

WithSCM sets the scm in the Engine.

func (*Client) WithUser added in v0.27.0

func (c *Client) WithUser(u *api.User) compiler.Engine

WithUser sets the API user type in the Engine.

type ModificationConfig

type ModificationConfig struct {
	Timeout  time.Duration
	Retries  int
	Endpoint string
	Secret   string
}

type ModifyRequest

type ModifyRequest struct {
	Pipeline string `json:"pipeline,omitempty"`
	Build    int64  `json:"build,omitempty"`
	Repo     string `json:"repo,omitempty"`
	Org      string `json:"org,omitempty"`
	User     string `json:"user,omitempty"`
}

ModifyRequest contains the payload passed to the modification endpoint.

type ModifyResponse

type ModifyResponse struct {
	Pipeline string `json:"pipeline,omitempty"`
}

ModifyResponse contains the payload returned by the modification endpoint.

Jump to

Keyboard shortcuts

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