drone

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package drone contians the drone client implementation for generating a Drone pipeline config.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNoImage = plumbing.NewPipelineError("no image provided", "An image is required for all steps in Drone. You can specify one with the '.WithImage(\"name\")' function.")
	ErrorNoName  = plumbing.NewPipelineError("no name provided", "A name is required for all steps in Drone. You can specify one with the '.WithName(\"name\")' function.")
)
View Source
var (
	PipelinePath = "/var/scribe/pipeline"
	StatePath    = "/var/scribe-state"
	ScribeVolume = &yaml.Volume{
		Name:     "scribe",
		EmptyDir: &yaml.VolumeEmptyDir{},
	}
	HostDockerVolume = &yaml.Volume{
		Name: stringutil.Slugify(pipeline.ArgumentDockerSocketFS.Key),
		HostPath: &yaml.VolumeHostPath{
			Path: "/var/run/docker.sock",
		},
	}
	ScribeStateVolume = &yaml.Volume{
		Name:     "scribe-state",
		EmptyDir: &yaml.VolumeEmptyDir{},
	}
	ScribeVolumeMount = &yaml.VolumeMount{
		Name:      "scribe",
		MountPath: "/var/scribe",
	}
	ScribeStateVolumeMount = &yaml.VolumeMount{
		Name:      "scribe-state",
		MountPath: StatePath,
	}
)

Functions

func Events added in v0.9.4

func Events(events []pipeline.Event) (yaml.Conditions, error)

Events converts the list of pipeline.Events to a list of drone 'Conditions'. Drone conditions are what prevents pipelines from running whenever certain certain conditions are met, or what runs pipelines only when certain conditions are met.

func HandleSecrets

func HandleSecrets(c pipeline.Configurer, step pipeline.Step) (map[string]*yaml.Variable, map[string]string)

HandleSecrets handles the different 'Secret' arguments that are defined in the pipeline step. Secrets are given a generated value and placed in the 'environment', not a user-defined one. That value is then used when the pipeline attempts to retrieve the value in the argument. String arguments are already provided in the command line arguments when `cmdutil.StepCommand'

func NewStep

func NewStep(c pipeline.Configurer, path, state, version string, step pipeline.Step) (*yaml.Container, error)

Types

type Client

type Client struct {
	Opts pipeline.CommonOpts

	Log *logrus.Logger

	// Language defines the language of the pipeline that will be generated.
	// For example, if Language is LanguageYAML, then the generated pipeline
	// will be the yaml that will tell drone to run the pipeline as it is written.
	//
	// Other languages will be generated using functions that you can use within
	// your own pipelines in those other languages. They are intended to facilitate
	// transitions between other systems and Scribe.
	Language DroneLanguage
}

func (*Client) Done

func (c *Client) Done(ctx context.Context, w pipeline.Walker) error

Done traverses through the tree and writes a .drone.yml file to the provided writer

func (*Client) StepWalkFunc

func (c *Client) StepWalkFunc(log logrus.FieldLogger, s *stepList, state string) func(ctx context.Context, steps ...pipeline.Step) error

func (*Client) Validate

func (c *Client) Validate(step pipeline.Step) error

func (*Client) Value

func (c *Client) Value(arg pipeline.Argument) (string, error)

The configurer for the Drone client returns equivalent environment variables for different arguments.

type DroneLanguage

type DroneLanguage int
const (
	// The languages that are available when generating a Drone config.
	LanguageYAML DroneLanguage = iota
	LanguageStarlark
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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