drone

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: Apache-2.0 Imports: 16 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 = errors.NewPipelineError("no image provided", "An image is required for all steps in Drone. You can specify one with the '.WithImage(\"name\")' function.")
	ErrorNoName  = errors.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

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 New

func NewDaggerStep

func NewDaggerStep(c pipeline.Configurer, path, state, version string, p pipeline.Pipeline) (*yaml.Container, error)

Types

type Client

type Client struct {
	Opts clients.CommonOpts

	Log *logrus.Logger
}

Client is the Drone implementation of the pipeline Client interface. It will create a `.drone.yml` file that will run your pipeline the same way that it would run locally. It uses the dagger client to run an entire pipeline as a single step. While not ideal for visualization purposes, this does behavior is what enables consistency.

func (*Client) Done

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

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

func (*Client) Step

func (c *Client) Step(v pipeline.Pipeline, state string) (*yaml.Container, error)

func (*Client) Validate

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

Validate ensures that your step has a name and a docker image.

func (*Client) Value

func (c *Client) Value(arg state.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
)

Jump to

Keyboard shortcuts

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