stage

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindDirArtifactOwnerForPath

func FindDirArtifactOwnerForPath(
	relPath string,
	artifacts map[string]*artifact.Artifact,
) (*artifact.Artifact, bool)

FindDirArtifactOwnerForPath searches the given map for a directory Artifact that should own relPath. relPath should share a base with the Artifacts in the map (hence the name).

Types

type Stage

type Stage struct {
	// Checksum is the checksum of the Stage definition excluding Artifact
	// checksums. This checksum is used to determine when a Stage definition
	// has been modified by the user.
	Checksum string `yaml:",omitempty"`
	// Command is the string to be evaluated and executed by a shell.
	Command string `yaml:",omitempty"`
	// WorkingDir is the directory in which the Stage's command is executed. It
	// is a directory path relative to the Dud root directory. An
	// empty value means the Stage's working directory _is_ the Dud root
	// directory. WorkingDir only affects the Stage's command; all inputs and
	// outputs of the Stage should have paths relative to the project root.
	WorkingDir string `yaml:"working-dir,omitempty"`
	// Inputs is a set of Artifacts which the Stage's Command needs to
	// operate. The Artifacts are keyed by their Path for faster lookup.
	Inputs map[string]*artifact.Artifact `yaml:",omitempty"`
	// Outputs is a set of Artifacts which are owned by the Stage. The
	// Artifacts are keyed by their Path for faster lookup.
	Outputs map[string]*artifact.Artifact
}

A Stage holds all information required to reproduce data. It is the primary building block of Dud pipelines.

func FromFile

func FromFile(stagePath string) (stg Stage, err error)

FromFile loads a Stage from a file.

func (Stage) CalculateChecksum

func (stg Stage) CalculateChecksum() (string, error)

CalculateChecksum returns the checksum of the Stage as it would be set in the Checksum field.

func (Stage) CreateCommand

func (stg Stage) CreateCommand() *exec.Cmd

CreateCommand return an exec.Cmd for the Stage.

func (*Stage) Serialize

func (stg *Stage) Serialize(writer io.Writer) error

Serialize writes a Stage to the given writer.

func (*Stage) ToFile added in v0.2.0

func (stg *Stage) ToFile(path string) error

ToFile writes a Stage to the given file path.

func (Stage) Validate added in v0.1.0

func (stg Stage) Validate(stagePath string) error

Validate returns an error describing a problem with the given Stage. If there are no problems with the Stage definition this method returns nil. If stagePath is not empty, Artifacts matching stagePath will cause an error; stages cannot track or reference themselves.

type Status

type Status struct {
	// HasChecksum is true if the Stage had a non-empty Checksum field.
	HasChecksum bool
	// ChecksumMatches is true if the checksum of the Stage's definition
	// matches its Checksum field.
	ChecksumMatches bool
	ArtifactStatus  map[string]artifact.Status
}

Status holds everything necessary to qualify the state of a Stage.

func NewStatus

func NewStatus() Status

NewStatus initializes a new Status object.

Jump to

Keyboard shortcuts

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