pipeline

package
v0.9.6 Latest Latest
Warning

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

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

Documentation

Overview

Package pipeline contains the meta types and interfaces that define a Scribe pipeline.

Index

Constants

This section is empty.

Variables

View Source
var (
	ArgumentDockerSocketFS = NewUnpackagedDirectoryArgument("docker-socket")

	// Git arguments
	ArgumentCommitSHA = NewStringArgument("git-commit-sha")
	ArgumentCommitRef = NewStringArgument("git-commit-ref")
	ArgumentBranch    = NewStringArgument("git-branch")
	ArgumentRemoteURL = NewStringArgument("remote-url")
	ArgumentTagName   = NewStringArgument("git-tag")

	// Standard pipeline arguments
	ArgumentWorkingDir = NewStringArgument("workdir")
	// ArgumentSourceFS is the path to the root of the source code for this project.
	ArgumentSourceFS = NewUnpackagedDirectoryArgument("source")

	// CI service arguments
	ArgumentBuildID = NewStringArgument("build-id")
)

These arguments are the pre-defined ones and are mostly used in events.

View Source
var (
	ErrorEmptyState = errors.New("state is empty")
	ErrorNotFound   = errors.New("key not found in state")
	ErrorKeyExists  = errors.New("key already exists in state")
	ErrorReadOnly   = errors.New("state is read-only")
)
View Source
var (
	ErrorNoSteps = errors.New("no steps were provided")
)
View Source
var ErrorStepNotFound = errors.New("step not found")
View Source
var NoOpStep = Step{
	Name: "no op",
	Action: func(context.Context, ActionOpts) error {
		return nil
	},
}

NoOpStep is used to represent a step which only exists to form uncommon relationships or for testing. Most clients should completely ignore NoOpSteps.

Functions

func ArgumentTypesEqual

func ArgumentTypesEqual(arg Argument, argTypes ...ArgumentType) bool

func PipelineNames

func PipelineNames(s []Pipeline) []string

func StepIDs

func StepIDs(steps []Step) []int64

func StepNames

func StepNames(s []Step) []string

Types

type Action

type Action func(context.Context, ActionOpts) error

Action is the function signature that a step provides when it does something.

var DefaultAction Action = nil

DefaultAction is a nil action intentionally. In some client implementations, a nil step indicates a specific behavior. In Drone and Docker, for example, a nil step indicates that the docker command or entrypoint should not be supplied, thus using the default command for that image.

type ActionOpts

type ActionOpts struct {
	State  *State
	Stdout io.Writer
	Stderr io.Writer
	Tracer opentracing.Tracer
	Logger logrus.FieldLogger

	// Path is the path to the pipeline, typically provided via the `-path` argument, but automatically supplied if using the scribe CLI.
	Path string
	// Version refers to the version of Scribe that was used to run the pipeline.
	// This value is set using the `-version` argument when running a pipeline, which is automatically set by the `scribe` command.
	Version string
}

The ActionOpts are provided to every step that is ran. Each step can choose to use these options.

type ArgMapReader

type ArgMapReader struct {
	// contains filtered or unexported fields
}

ArgMapReader attempts to read state values from the provided "ArgMap". The ArgMap is provided by the user by using the '-arg={key}={value}' argument. This is typically only used in local executions where some values will not be provided.

func NewArgMapReader

func NewArgMapReader(defaults plumbing.ArgMap) *ArgMapReader

func (*ArgMapReader) Exists added in v0.9.2

func (s *ArgMapReader) Exists(arg Argument) (bool, error)

func (*ArgMapReader) GetDirectory

func (s *ArgMapReader) GetDirectory(arg Argument) (fs.FS, error)

func (*ArgMapReader) GetDirectoryString added in v0.9.2

func (s *ArgMapReader) GetDirectoryString(arg Argument) (string, error)

func (*ArgMapReader) GetFile

func (s *ArgMapReader) GetFile(arg Argument) (*os.File, error)

func (*ArgMapReader) GetFloat64

func (s *ArgMapReader) GetFloat64(arg Argument) (float64, error)

func (*ArgMapReader) GetInt64

func (s *ArgMapReader) GetInt64(arg Argument) (int64, error)

func (*ArgMapReader) GetString

func (s *ArgMapReader) GetString(arg Argument) (string, error)

type Argument

type Argument struct {
	Type ArgumentType
	Key  string
}

An Argument is a pre-defined argument that is used in a typical CI pipeline. This allows the scribe library to define different methods of retrieving the same information in different run modes. For example, when running in CLI or Docker mode, getting the git ref might be as simple as running `git rev-parse HEAD`. But in a Drone pipeline, that information may be available before the repository has been cloned in an environment variable. Other arguments may require the user to be prompted if they have not been provided. These arguments can be provided to the CLI by using the flag `-arg`, for example `-arg=workdir=./example` will set the "workdir" argument to "example" in the CLI run-mode By default, all steps expect a WorkingDir and Repository.

func NewDirectoryArgument

func NewDirectoryArgument(key string) Argument

func NewFileArgument

func NewFileArgument(key string) Argument

func NewFloat64Argument

func NewFloat64Argument(key string) Argument

func NewInt64Argument

func NewInt64Argument(key string) Argument

func NewSecretArgument

func NewSecretArgument(key string) Argument

func NewStringArgument

func NewStringArgument(key string) Argument

func NewUnpackagedDirectoryArgument added in v0.9.2

func NewUnpackagedDirectoryArgument(key string) Argument

type ArgumentType

type ArgumentType int
const (
	ArgumentTypeString ArgumentType = iota
	ArgumentTypeInt64
	ArgumentTypeFloat64
	ArgumentTypeSecret
	ArgumentTypeFile
	ArgumentTypeFS
	// An ArgumentTypeUnpackagedFS is used for filesystems that are invariably consistent regardless of operating system.
	// Developers can get around packaging and unpackaging of large directories using this argument type.
	// Filesystems and directories used with this argument should always exist on every machine. This basically means that they should be available within the source tree.
	// If this argument type is used for directories outside of the source tree, then expect divergeant behavior between operating systems.
	ArgumentTypeUnpackagedFS
)

func (ArgumentType) String

func (a ArgumentType) String() string

type Artifact

type Artifact interface{}

type CacheCondition

type CacheCondition func() bool

a CacheCondition should return true if the cacher should cache the step. In other words, returning false means that the step must run.

type Cacher

type Cacher func(Step)

A Cacher defines behavior for caching data. Some behaviors that can happen when dealing with a cacheable step: * The provided Step, using an expensive process, produces some consistent output, possibly on the filesystem. If nothing changes in between runs, then we can re-use the output in the current step and skip this one.

  • The most common example of this is `npm install` producing the `node_modules` folder, which can be re-used if `package-lock.json` is unchanged.

* The provided Step, using an expensive process, calculates a value. If nothing changes in between runs, then this value can be reused.

type Client

type Client interface {
	// Validate is ran internally before calling Run or Parallel and allows the client to effectively configure per-step requirements
	// For example, Drone steps MUST have an image so the Drone client returns an error in this function when the provided step does not have an image.
	// If the error encountered is not critical but should still be logged, then return a plumbing.ErrorSkipValidation.
	// The error is checked with `errors.Is` so the error can be wrapped with fmt.Errorf.
	Validate(Step) error

	// Done must be ran at the end of the pipeline.
	// This is typically what takes the defined pipeline steps, runs them in the order defined, and produces some kind of output.
	Done(context.Context, Walker) error
}

type Collection

type Collection struct {
	Graph *dag.Graph[Pipeline]
}

Collection defines a directed acyclic Graph that stores a collection of Steps.

func NewCollection

func NewCollection() *Collection

func NewCollectionWithSteps added in v0.9.4

func NewCollectionWithSteps(pipelineName string, steps ...StepList) (*Collection, error)

NewCollectinoWithSteps creates a new Collection with a single pipeline from a list of Steps.

func (*Collection) AddEvents

func (c *Collection) AddEvents(pipelineID int64, events ...Event) error

func (*Collection) AddPipelines

func (c *Collection) AddPipelines(p ...Pipeline) error

AppendPipeline adds a populated sub-pipeline of Steps to the Graph.

func (*Collection) AddSteps

func (c *Collection) AddSteps(pipelineID int64, steps StepList) error

Add adds a new list of Steps which are siblings to a pipeline. Because they are siblings, they must all depend on the same step(s).

func (*Collection) ByID

func (c *Collection) ByID(ctx context.Context, id int64) ([]Step, error)

ByID should return the Step that corresponds with a specific ID

func (*Collection) ByName

func (c *Collection) ByName(ctx context.Context, name string) ([]Step, error)

ByName should return the Step that corresponds with a specific Name

func (*Collection) WalkPipelines

func (c *Collection) WalkPipelines(ctx context.Context, wf PipelineWalkFunc) error

func (*Collection) WalkSteps

func (c *Collection) WalkSteps(ctx context.Context, pipelineID int64, wf StepWalkFunc) error

type CommonOpts

type CommonOpts struct {
	Name    string
	Version string
	Output  io.Writer
	Args    *plumbing.PipelineArgs
	Log     *logrus.Logger
	Tracer  opentracing.Tracer
	State   *State
}

CommonOpts are provided in the Client's Init function, which includes options that are common to all clients, like logging, output, and debug options

type Configurer

type Configurer interface {
	// Value returns the implementation-specific pipeline config.
	Value(Argument) (string, error)
}

Configurer defines how clients can retrieve configuration values for use in pipelines. For example, a `clone` step might require a remote URL and branch, but how that data is retrieved can change depending on the environment. * In Drone, the value is retrieved from an environment variable at runtime. So the only thing this funcion will likely return is the name of the environment variable. * In Docker and CLI modes, the remote URL might be provided as a CLI argument or requested via stdin, or even already available with the `git remote` command.

type EnvVar added in v0.9.2

type EnvVar struct {
	Type EnvVarType
	// contains filtered or unexported fields
}

func NewEnvArgument added in v0.9.2

func NewEnvArgument(arg Argument) EnvVar

NewEnvArgument creates a new EnvVar that will be populated based on an Argument found in the state when the step runs.

func NewEnvString added in v0.9.2

func NewEnvString(val string) EnvVar

NewEnvString creates a new EnvVar that will be populated with a static string value.

func (EnvVar) Argument added in v0.9.2

func (e EnvVar) Argument() Argument

Argument retrieves the argument value set when using the NewEnvArgument function. If the EnvVar's Type property is not "EnvVarString" then it will panic.

func (EnvVar) String added in v0.9.2

func (e EnvVar) String() string

String retrieves the static string value set when using the NewEnvString function. If the EnvVar's Type property is not "EnvVarString" then it will panic.

type EnvVarType added in v0.9.2

type EnvVarType int
const (
	// EnvVarString should be used whenever the value is known and static.
	EnvVarString EnvVarType = iota

	// EnvVarArgument means that the environment variable will be populated by an argument from the state at run-time.
	// Most (all?) CI services will then leave these values out of the configuration and will be injected when the step runs.
	EnvVarArgument
)

type Event

type Event struct {
	Filters  map[string]*FilterValue
	Provides []Argument
}

Event is provided when defining a Scribe pipeline to define the events that cause the pipeline to be ran. Some example events that might cause pipelines to be created: * Manual events with user input, like 'Promotions' in Drone. In this scenario, the user may have the ability to supply any keys/values as arguments, however, pipeline developers in Scribe should be able to specifically define what fields are accepted. See https://docs.drone.io/promote/. * git and SCM-related events like 'Pull Reuqest', 'Commit', 'Tag'. Each one of these events has a unique set of arguments / filters. `Commit` may allow pipeline developers to filter by branch or message. Tags may allow developers to filter by name. * cron events, which may allow the pipeline in the CI service to be ran on a schedule. The Event type stores both the filters and a list of values that it provides to the pipeline. Client implementations of the pipeline (type Client) are expected to handle events that they are capable of handling. 'Handling' events means that the the arguments in the `Provides` key should be available before any first steps are ran. It will not typically be up to pipeline developers to decide what arguments an event provides. The only case where this may happen is if the event is a manual one, where users are able to submit the event with any arbitrary set of keys/values. The 'Filters' key is provided in the pipeline code and should not be populated when pre-defined in the Scribe package.

func GitCommitEvent

func GitCommitEvent(filters GitCommitFilters) Event

func GitTagEvent

func GitTagEvent(filters GitTagFilters) Event

func PullRequestEvent

func PullRequestEvent(filters PullRequestFilters) Event

type FilesystemState

type FilesystemState struct {
	// contains filtered or unexported fields
}

FilesystemState stores state in a JSON file on the filesystem.

func NewFilesystemState

func NewFilesystemState(path string) (*FilesystemState, error)

func (*FilesystemState) Exists added in v0.9.2

func (f *FilesystemState) Exists(arg Argument) (bool, error)

func (*FilesystemState) GetDirectory

func (f *FilesystemState) GetDirectory(arg Argument) (fs.FS, error)

func (*FilesystemState) GetDirectoryString added in v0.9.2

func (f *FilesystemState) GetDirectoryString(arg Argument) (string, error)

GetDirectoryString retrieves the original directory path. This can be particularly useful for things stored within the source filesystem.

func (*FilesystemState) GetFile

func (f *FilesystemState) GetFile(arg Argument) (*os.File, error)

func (*FilesystemState) GetFloat64

func (f *FilesystemState) GetFloat64(arg Argument) (float64, error)

func (*FilesystemState) GetInt64

func (f *FilesystemState) GetInt64(arg Argument) (int64, error)

func (*FilesystemState) GetString

func (f *FilesystemState) GetString(arg Argument) (string, error)

func (*FilesystemState) SetDirectory

func (f *FilesystemState) SetDirectory(arg Argument, value string) error

func (*FilesystemState) SetFile

func (f *FilesystemState) SetFile(arg Argument, value string) error

func (*FilesystemState) SetFileReader added in v0.9.2

func (f *FilesystemState) SetFileReader(arg Argument, value io.Reader) error

func (*FilesystemState) SetFloat64

func (f *FilesystemState) SetFloat64(arg Argument, value float64) error

func (*FilesystemState) SetInt64

func (f *FilesystemState) SetInt64(arg Argument, value int64) error

func (*FilesystemState) SetString

func (f *FilesystemState) SetString(arg Argument, value string) error

type FilterValue

type FilterValue struct {
	Type  FilterValueType
	Value fmt.Stringer
}

func GlobFilter

func GlobFilter(v string) *FilterValue

func RegexpFilter

func RegexpFilter(v *regexp.Regexp) *FilterValue

func StringFilter

func StringFilter(v string) *FilterValue

func (*FilterValue) String

func (f *FilterValue) String() string

type FilterValueType

type FilterValueType int

FilterValueType is the metadata type that identifies the type present event filter.

const (
	FilterValueString FilterValueType = iota
	FilterValueRegex
	FilterValueGlob
)

type GitCommitFilters

type GitCommitFilters struct {
	Branch *FilterValue
}

type GitTagFilters

type GitTagFilters struct {
	Name *FilterValue
}

type Output

type Output interface{}

type Pipeline

type Pipeline struct {
	ID           int64
	Name         string
	Graph        *dag.Graph[StepList]
	Events       []Event
	Type         PipelineType
	Dependencies []Pipeline
}

A Pipeline is really similar to a Step, except that it contains a graph of steps rather than a single action. Just like a Step, it has dependencies, a name, an ID, etc.

func AdjNodesToPipelines

func AdjNodesToPipelines(nodes []*dag.Node[Pipeline]) []Pipeline

AdjNodesToPipelines converts a list of Nodes (with type Pipeline) to a list of Pipelines

func New

func New(name string, id int64) Pipeline

New creates a new Step that represents a pipeline.

func NodesToPipelines

func NodesToPipelines(nodes []dag.Node[Pipeline]) []Pipeline

NodesToPipelines converts a list of Nodes (with type Pipeline) to a list of Pipelines

func (*Pipeline) AddSteps

func (p *Pipeline) AddSteps(id int64, steps StepList) error

AddStep adds the steps as a single node in the pipeline.

type PipelineType

type PipelineType int
const (
	PipelineTypeDefault PipelineType = iota
	PipelineTypeSub
)

type PipelineWalkFunc

type PipelineWalkFunc func(context.Context, ...Pipeline) error

PipelineWalkFunc is implemented by the pipeline 'Clients'. This function is executed for each pipeline. This function follows the same rules for pipelines as the StepWalker func does for pipelines. If multiple pipelines are provided in the steps argument, then those pipelines are intended to be executed in parallel.

type PullRequestFilters

type PullRequestFilters struct{}

type State

type State struct {
	Handler  StateHandler
	Fallback []StateReader
	Log      logrus.FieldLogger
}

func (*State) Exists added in v0.9.2

func (s *State) Exists(arg Argument) (bool, error)

Exists checks the state to see if an argument exists in it. It can return an error in the event of a failure to check the state. An error will not be returned if the state could be read and the value was not in it. If a value for argument was not found, then false and a nil error is returned.

func (*State) GetDirectory

func (s *State) GetDirectory(arg Argument) (fs.FS, error)

GetDirectory attempts to get the directory from the state. If there are Fallback readers and the state returned an error, then it will loop through each one, attempting to retrieve the value from the fallback state reader. If no fallback reader returns the value, then the original error is returned.

func (*State) GetDirectoryString added in v0.9.2

func (s *State) GetDirectoryString(arg Argument) (string, error)

GetDirectory attempts to get the directory from the state. If there are Fallback readers and the state returned an error, then it will loop through each one, attempting to retrieve the value from the fallback state reader. If no fallback reader returns the value, then the original error is returned.

func (*State) GetFile

func (s *State) GetFile(arg Argument) (*os.File, error)

GetFile attempts to get the file from the state. If there are Fallback readers and the state returned an error, then it will loop through each one, attempting to retrieve the value from the fallback state reader. If no fallback reader returns the value, then the original error is returned.

func (*State) GetFloat64

func (s *State) GetFloat64(arg Argument) (float64, error)

GetFloat64 attempts to get the int64 from the state. If there are Fallback readers and the state returned an error, then it will loop through each one, attempting to retrieve the value from the fallback state reader. If no fallback reader returns the value, then the original error is returned.

func (*State) GetInt64

func (s *State) GetInt64(arg Argument) (int64, error)

GetInt64 attempts to get the int64 from the state. If there are Fallback readers and the state returned an error, then it will loop through each one, attempting to retrieve the value from the fallback state reader. If no fallback reader returns the value, then the original error is returned.

func (*State) GetString

func (s *State) GetString(arg Argument) (string, error)

GetString attempts to get the string from the state. If there are Fallback readers and the state returned an error, then it will loop through each one, attempting to retrieve the value from the fallback state reader. If no fallback reader returns the value, then the original error is returned.

func (*State) MustGetDirectory added in v0.9.2

func (s *State) MustGetDirectory(arg Argument) fs.FS

func (*State) MustGetDirectoryString added in v0.9.2

func (s *State) MustGetDirectoryString(arg Argument) string

func (*State) MustGetFile added in v0.9.2

func (s *State) MustGetFile(arg Argument) *os.File

func (*State) MustGetFloat64 added in v0.9.2

func (s *State) MustGetFloat64(arg Argument) float64

func (*State) MustGetInt64 added in v0.9.2

func (s *State) MustGetInt64(arg Argument) int64

func (*State) MustGetString added in v0.9.2

func (s *State) MustGetString(arg Argument) string

func (*State) SetDirectory

func (s *State) SetDirectory(arg Argument, path string) error

SetDirectory attempts to set the directory into the state. The "path" argument should be the path to the directory to be stored.

func (*State) SetFile

func (s *State) SetFile(arg Argument, path string) error

SetFile attempts to set the file into the state. The "path" argument should be the path to the file to be stored.

func (*State) SetFileReader added in v0.9.2

func (s *State) SetFileReader(arg Argument, r io.Reader) error

SetFileReader attempts to set the reader into the state as a file. This is an easy way to go from downloading a file to setting it into the state without having to write it to disk first.

func (*State) SetFloat64

func (s *State) SetFloat64(arg Argument, value float64) error

SetFloat64 attempts to set the float64 into the state.

func (*State) SetInt64

func (s *State) SetInt64(arg Argument, value int64) error

SetInt64 attempts to set the int64 into the state.

func (*State) SetString

func (s *State) SetString(arg Argument, value string) error

SetString attempts to set the string into the state.

type StateHandler

type StateHandler interface {
	StateReader
	StateWriter
}

type StateReader

type StateReader interface {
	Exists(Argument) (bool, error)
	GetString(Argument) (string, error)
	GetInt64(Argument) (int64, error)
	GetFloat64(Argument) (float64, error)
	GetFile(Argument) (*os.File, error)
	GetDirectory(Argument) (fs.FS, error)
	GetDirectoryString(Argument) (string, error)
}

type StateWriter

type StateWriter interface {
	SetString(Argument, string) error
	SetInt64(Argument, int64) error
	SetFloat64(Argument, float64) error
	SetFile(Argument, string) error
	SetFileReader(Argument, io.Reader) error
	SetDirectory(Argument, string) error
}

type StdinReader

type StdinReader struct {
	// contains filtered or unexported fields
}

func NewStdinReader

func NewStdinReader(in io.Reader, out io.Writer) *StdinReader

func (*StdinReader) Exists added in v0.9.2

func (s *StdinReader) Exists(arg Argument) (bool, error)

Since the StdinReader can read any state value, it's better if we assume that if it's being used, then it wasn't found in other reasonable state managers.

func (*StdinReader) Get

func (s *StdinReader) Get(arg Argument) (string, error)

func (*StdinReader) GetDirectory

func (s *StdinReader) GetDirectory(arg Argument) (fs.FS, error)

func (*StdinReader) GetDirectoryString added in v0.9.2

func (s *StdinReader) GetDirectoryString(arg Argument) (string, error)

func (*StdinReader) GetFile

func (s *StdinReader) GetFile(arg Argument) (*os.File, error)

func (*StdinReader) GetFloat64

func (s *StdinReader) GetFloat64(arg Argument) (float64, error)

func (*StdinReader) GetInt64

func (s *StdinReader) GetInt64(arg Argument) (int64, error)

func (*StdinReader) GetString

func (s *StdinReader) GetString(arg Argument) (string, error)

type Step

type Step struct {
	// ID is the unique number that represents this step.
	// This value is used when calling `scribe -step={serial} [pipeline]`
	ID int64

	// Type represents the how the step is intended to operate. 90% of the time, the default type should be a sufficient descriptor of a step.
	// However in some circumstances, clients may want to handle a step differently based on how it's defined.
	// Background steps, for example, have to have their lifecycles handled differently.
	Type StepType

	// Name is a string that represents or describes the step, essentially the identifier.
	// Not all run modes will support using the name.
	Name string

	// Image is an optional value that can be assigned to a step.
	// Typically, in docker environments (or drone with a Docker executor), it defines the docker image that is used to run the step.
	Image string

	// Action defines the action this step performs.
	Action Action

	// Dependencies define other steps that are required to run before this one.
	// As far as we're concerned, Steps can only depend on other steps of the same type.
	Dependencies []Step

	// Arguments are arguments that are must exist in order for this step to run.
	Arguments []Argument

	// Provides are arguments that this step provides for other arguments to use in their "Arguments" list.
	ProvidesArgs []Argument

	Environment StepEnv
}

A Step stores a Action and a name for use in pipelines. A Step can consist of either a single action or represent a list of actions.

func Combine

func Combine(step ...Step) Step

Combine combines the list of steps into one step, combining all of their required and provided arguments, as well as their actions. For string values that can not be combined, like Name and Image, the first step's values are chosen. These can be overridden with further chaining.

func NamedStep

func NamedStep(name string, action Action) Step

NamedStep creates a new step with a name provided

func NewStep

func NewStep(action Action) Step

NewStep creates a new step with an automatically generated name

func NodesToSteps

func NodesToSteps(nodes []dag.Node[Step]) []Step

NodeListToSteps converts a list of Nodes to a list of Steps

func (Step) After

func (s Step) After(step Step) Step

func (Step) IsBackground

func (s Step) IsBackground() bool

func (Step) Provides

func (s Step) Provides(arg ...Argument) Step

func (Step) ResetArguments

func (s Step) ResetArguments() Step

func (Step) WithArguments

func (s Step) WithArguments(args ...Argument) Step

func (Step) WithEnvVar added in v0.9.2

func (s Step) WithEnvVar(key string, val EnvVar) Step

WithEnvVar appends a new EnvVar to the Step's environment, replacing existing EnvVars with the provided key. If an EnvVar is provided with a type of EnvVarArgument, then the argument is also added to this step's required arguments.

func (Step) WithEnvironment added in v0.9.2

func (s Step) WithEnvironment(env StepEnv) Step

WithEnvironment replaces the entire environment for this step. If an EnvVar is provided with a type of EnvVarArgument, then the argument is also added to this step's required arguments.

func (Step) WithImage

func (s Step) WithImage(image string) Step

func (Step) WithInput

func (s Step) WithInput(artifact Artifact) Step

func (Step) WithName

func (s Step) WithName(name string) Step

func (Step) WithOutput

func (s Step) WithOutput(artifact Artifact) Step

type StepEnv added in v0.9.2

type StepEnv map[string]EnvVar

type StepList

type StepList struct {
	ID           int64
	Steps        []Step
	Dependencies []StepList
	Type         StepType
}

A StepList is a list of steps that are ran in parallel. This type is only used for intermittent storage and should not be used in the Scribe client library

func NewStepList

func NewStepList(id int64, steps ...Step) StepList

func NodeListToStepLists

func NodeListToStepLists(nodes []dag.Node[StepList]) []StepList

NodeListToSteps converts a list of Nodes to a list of Steps

func (*StepList) Names

func (s *StepList) Names() []string

func (*StepList) String

func (s *StepList) String() string

type StepType

type StepType int
const (
	StepTypeDefault StepType = iota
	StepTypeBackground
)

type StepWalkFunc

type StepWalkFunc func(context.Context, ...Step) error

WalkFunc is implemented by the pipeline 'Clients'. This function is executed for each step. If multiple steps are provided in the argument, then they were provided in "Parallel". If one step in the list of steps is of type "Background", then they all should be.

type Stringer

type Stringer string

func (Stringer) String

func (s Stringer) String() string

type Walker

type Walker interface {
	WalkSteps(context.Context, int64, StepWalkFunc) error
	WalkPipelines(context.Context, PipelineWalkFunc) error
}

Walker is an interface that collections of steps should satisfy.

Directories

Path Synopsis
clients
cli
drone
Package drone contians the drone client implementation for generating a Drone pipeline config.
Package drone contians the drone client implementation for generating a Drone pipeline config.

Jump to

Keyboard shortcuts

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