Documentation ¶
Overview ¶
Package pipeline contains the meta types and interfaces that define a Scribe pipeline.
Index ¶
- Variables
- func ArgumentTypesEqual(arg Argument, argTypes ...ArgumentType) bool
- func PipelineNames(s []Pipeline) []string
- func StepIDs(steps []Step) []int64
- func StepNames(s []Step) []string
- type Action
- type ActionOpts
- type ArgMapReader
- func (s *ArgMapReader) Exists(arg Argument) (bool, error)
- func (s *ArgMapReader) GetDirectory(arg Argument) (fs.FS, error)
- func (s *ArgMapReader) GetDirectoryString(arg Argument) (string, error)
- func (s *ArgMapReader) GetFile(arg Argument) (*os.File, error)
- func (s *ArgMapReader) GetFloat64(arg Argument) (float64, error)
- func (s *ArgMapReader) GetInt64(arg Argument) (int64, error)
- func (s *ArgMapReader) GetString(arg Argument) (string, error)
- type Argument
- func NewDirectoryArgument(key string) Argument
- func NewFileArgument(key string) Argument
- func NewFloat64Argument(key string) Argument
- func NewInt64Argument(key string) Argument
- func NewSecretArgument(key string) Argument
- func NewStringArgument(key string) Argument
- func NewUnpackagedDirectoryArgument(key string) Argument
- type ArgumentType
- type Artifact
- type CacheCondition
- type Cacher
- type Client
- type Collection
- func (c *Collection) AddEvents(pipelineID int64, events ...Event) error
- func (c *Collection) AddPipelines(p ...Pipeline) error
- func (c *Collection) AddSteps(pipelineID int64, steps StepList) error
- func (c *Collection) ByID(ctx context.Context, id int64) ([]Step, error)
- func (c *Collection) ByName(ctx context.Context, name string) ([]Step, error)
- func (c *Collection) WalkPipelines(ctx context.Context, wf PipelineWalkFunc) error
- func (c *Collection) WalkSteps(ctx context.Context, pipelineID int64, wf StepWalkFunc) error
- type CommonOpts
- type Configurer
- type EnvVar
- type EnvVarType
- type Event
- type FilesystemState
- func (f *FilesystemState) Exists(arg Argument) (bool, error)
- func (f *FilesystemState) GetDirectory(arg Argument) (fs.FS, error)
- func (f *FilesystemState) GetDirectoryString(arg Argument) (string, error)
- func (f *FilesystemState) GetFile(arg Argument) (*os.File, error)
- func (f *FilesystemState) GetFloat64(arg Argument) (float64, error)
- func (f *FilesystemState) GetInt64(arg Argument) (int64, error)
- func (f *FilesystemState) GetString(arg Argument) (string, error)
- func (f *FilesystemState) SetDirectory(arg Argument, value string) error
- func (f *FilesystemState) SetFile(arg Argument, value string) error
- func (f *FilesystemState) SetFileReader(arg Argument, value io.Reader) error
- func (f *FilesystemState) SetFloat64(arg Argument, value float64) error
- func (f *FilesystemState) SetInt64(arg Argument, value int64) error
- func (f *FilesystemState) SetString(arg Argument, value string) error
- type FilterValue
- type FilterValueType
- type GitCommitFilters
- type GitTagFilters
- type Output
- type Pipeline
- type PipelineType
- type PipelineWalkFunc
- type PullRequestFilters
- type State
- func (s *State) Exists(arg Argument) (bool, error)
- func (s *State) GetDirectory(arg Argument) (fs.FS, error)
- func (s *State) GetDirectoryString(arg Argument) (string, error)
- func (s *State) GetFile(arg Argument) (*os.File, error)
- func (s *State) GetFloat64(arg Argument) (float64, error)
- func (s *State) GetInt64(arg Argument) (int64, error)
- func (s *State) GetString(arg Argument) (string, error)
- func (s *State) MustGetDirectory(arg Argument) fs.FS
- func (s *State) MustGetDirectoryString(arg Argument) string
- func (s *State) MustGetFile(arg Argument) *os.File
- func (s *State) MustGetFloat64(arg Argument) float64
- func (s *State) MustGetInt64(arg Argument) int64
- func (s *State) MustGetString(arg Argument) string
- func (s *State) SetDirectory(arg Argument, path string) error
- func (s *State) SetFile(arg Argument, path string) error
- func (s *State) SetFileReader(arg Argument, r io.Reader) error
- func (s *State) SetFloat64(arg Argument, value float64) error
- func (s *State) SetInt64(arg Argument, value int64) error
- func (s *State) SetString(arg Argument, value string) error
- type StateHandler
- type StateHandlerLogWrapper
- type StateReader
- type StateReaderLogWrapper
- func (s *StateReaderLogWrapper) Exists(arg Argument) (bool, error)
- func (s *StateReaderLogWrapper) GetDirectory(arg Argument) (fs.FS, error)
- func (s *StateReaderLogWrapper) GetDirectoryString(arg Argument) (string, error)
- func (s *StateReaderLogWrapper) GetFile(arg Argument) (*os.File, error)
- func (s *StateReaderLogWrapper) GetFloat64(arg Argument) (float64, error)
- func (s *StateReaderLogWrapper) GetInt64(arg Argument) (int64, error)
- func (s *StateReaderLogWrapper) GetString(arg Argument) (string, error)
- type StateWriter
- type StateWriterLogWrapper
- func (s *StateWriterLogWrapper) SetDirectory(arg Argument, val string) error
- func (s *StateWriterLogWrapper) SetFile(arg Argument, val string) error
- func (s *StateWriterLogWrapper) SetFileReader(arg Argument, val io.Reader) error
- func (s *StateWriterLogWrapper) SetFloat64(arg Argument, val float64) error
- func (s *StateWriterLogWrapper) SetInt64(arg Argument, val int64) error
- func (s *StateWriterLogWrapper) SetString(arg Argument, val string) error
- type StdinReader
- func (s *StdinReader) Exists(arg Argument) (bool, error)
- func (s *StdinReader) Get(arg Argument) (string, error)
- func (s *StdinReader) GetDirectory(arg Argument) (fs.FS, error)
- func (s *StdinReader) GetDirectoryString(arg Argument) (string, error)
- func (s *StdinReader) GetFile(arg Argument) (*os.File, error)
- func (s *StdinReader) GetFloat64(arg Argument) (float64, error)
- func (s *StdinReader) GetInt64(arg Argument) (int64, error)
- func (s *StdinReader) GetString(arg Argument) (string, error)
- type Step
- func (s Step) After(step Step) Step
- func (s Step) IsBackground() bool
- func (s Step) Provides(arg ...Argument) Step
- func (s Step) ResetArguments() Step
- func (s Step) WithArguments(args ...Argument) Step
- func (s Step) WithEnvVar(key string, val EnvVar) Step
- func (s Step) WithEnvironment(env StepEnv) Step
- func (s Step) WithImage(image string) Step
- func (s Step) WithInput(artifact Artifact) Step
- func (s Step) WithName(name string) Step
- func (s Step) WithOutput(artifact Artifact) Step
- type StepEnv
- type StepList
- type StepType
- type StepWalkFunc
- type Stringer
- type Walker
Constants ¶
This section is empty.
Variables ¶
var ( // 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") ArgumentDockerSocketFS = NewUnpackagedDirectoryArgument("docker-socket") // CI service arguments ArgumentBuildID = NewStringArgument("build-id") )
These arguments are the pre-defined ones and are mostly used in events.
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") )
var (
ErrorNoSteps = errors.New("no steps were provided")
)
var ErrorStepNotFound = errors.New("step not found")
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 ¶
Types ¶
type Action ¶
type Action func(context.Context, ActionOpts) error
Action is the function signature that a step provides when it does something.
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) GetFloat64 ¶
func (s *ArgMapReader) GetFloat64(arg Argument) (float64, 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 NewFileArgument ¶
func NewFloat64Argument ¶
func NewInt64Argument ¶
func NewSecretArgument ¶
func NewStringArgument ¶
func NewUnpackagedDirectoryArgument ¶ added in v0.9.2
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 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 ¶
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) 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
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
NewEnvString creates a new EnvVar that will be populated with a static string value.
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) GetFloat64 ¶
func (f *FilesystemState) GetFloat64(arg Argument) (float64, 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
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 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 ¶
AdjNodesToPipelines converts a list of Nodes (with type Pipeline) to a list of Pipelines
func NodesToPipelines ¶
NodesToPipelines converts a list of Nodes (with type Pipeline) to a list of Pipelines
type PipelineType ¶
type PipelineType int
const ( PipelineTypeDefault PipelineType = iota PipelineTypeSub )
type PipelineWalkFunc ¶
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
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 ¶
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
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 ¶
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 ¶
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 ¶
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 ¶
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 (*State) MustGetDirectoryString ¶ added in v0.9.2
func (*State) MustGetFloat64 ¶ added in v0.9.2
func (*State) MustGetInt64 ¶ added in v0.9.2
func (*State) MustGetString ¶ added in v0.9.2
func (*State) SetDirectory ¶
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 ¶
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
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 ¶
SetFloat64 attempts to set the float64 into the state.
type StateHandler ¶
type StateHandler interface { StateReader StateWriter }
type StateHandlerLogWrapper ¶ added in v0.9.9
type StateHandlerLogWrapper struct { *StateReaderLogWrapper *StateWriterLogWrapper }
func StateHandlerWithLogs ¶ added in v0.9.9
func StateHandlerWithLogs(log logrus.FieldLogger, state StateHandler) *StateHandlerLogWrapper
type StateReader ¶
type StateReaderLogWrapper ¶ added in v0.9.9
type StateReaderLogWrapper struct { StateReader Log logrus.FieldLogger }
func StateReaderWithLogs ¶ added in v0.9.9
func StateReaderWithLogs(log logrus.FieldLogger, state StateReader) *StateReaderLogWrapper
func (*StateReaderLogWrapper) Exists ¶ added in v0.9.9
func (s *StateReaderLogWrapper) Exists(arg Argument) (bool, error)
func (*StateReaderLogWrapper) GetDirectory ¶ added in v0.9.9
func (s *StateReaderLogWrapper) GetDirectory(arg Argument) (fs.FS, error)
func (*StateReaderLogWrapper) GetDirectoryString ¶ added in v0.9.9
func (s *StateReaderLogWrapper) GetDirectoryString(arg Argument) (string, error)
func (*StateReaderLogWrapper) GetFile ¶ added in v0.9.9
func (s *StateReaderLogWrapper) GetFile(arg Argument) (*os.File, error)
func (*StateReaderLogWrapper) GetFloat64 ¶ added in v0.9.9
func (s *StateReaderLogWrapper) GetFloat64(arg Argument) (float64, error)
type StateWriter ¶
type StateWriterLogWrapper ¶ added in v0.9.9
type StateWriterLogWrapper struct { StateWriter Log logrus.FieldLogger }
func StateWriterWithLogs ¶ added in v0.9.9
func StateWriterWithLogs(log logrus.FieldLogger, state StateWriter) *StateWriterLogWrapper
func (*StateWriterLogWrapper) SetDirectory ¶ added in v0.9.9
func (s *StateWriterLogWrapper) SetDirectory(arg Argument, val string) error
func (*StateWriterLogWrapper) SetFile ¶ added in v0.9.9
func (s *StateWriterLogWrapper) SetFile(arg Argument, val string) error
func (*StateWriterLogWrapper) SetFileReader ¶ added in v0.9.9
func (s *StateWriterLogWrapper) SetFileReader(arg Argument, val io.Reader) error
func (*StateWriterLogWrapper) SetFloat64 ¶ added in v0.9.9
func (s *StateWriterLogWrapper) SetFloat64(arg Argument, val float64) 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) 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) GetFloat64 ¶
func (s *StdinReader) GetFloat64(arg Argument) (float64, 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 ¶
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 NodesToSteps ¶
NodeListToSteps converts a list of Nodes to a list of Steps
func (Step) IsBackground ¶
func (Step) ResetArguments ¶
func (Step) WithArguments ¶
func (Step) WithEnvVar ¶ added in v0.9.2
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
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) WithOutput ¶
type StepList ¶
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 NodeListToStepLists ¶
NodeListToSteps converts a list of Nodes to a list of Steps
type StepWalkFunc ¶
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.