Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FromFile = func(stagePath string) (stg Stage, err error) { var tempStage Stage if err = fromYamlFile(stagePath, &tempStage); err != nil { return } stg.Checksum = tempStage.Checksum stg.Command = tempStage.Command stg.Dependencies = make(map[string]*artifact.Artifact, len(stg.Dependencies)) stg.Outputs = make(map[string]*artifact.Artifact, len(stg.Outputs)) stg.WorkingDir = filepath.Clean(tempStage.WorkingDir) for path, art := range tempStage.Dependencies { if art == nil { art = &artifact.Artifact{} } art.Path = filepath.Clean(path) art.SkipCache = true stg.Dependencies[art.Path] = art } for path, art := range tempStage.Outputs { if art == nil { art = &artifact.Artifact{} } art.Path = filepath.Clean(path) stg.Outputs[art.Path] = art } return stg, stg.validate() }
FromFile loads a Stage from a file. If a lock file for the Stage exists, this function uses any Artifact.Checksums it can from the lock file.
Functions ¶
func FindDirArtifactOwnerForPath ¶
func FindDirArtifactOwnerForPath( relPath string, artifacts map[string]*artifact.Artifact, ) ( *artifact.Artifact, bool, error, )
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 outputs and // dependencies of the Stage should have paths relative to the project root. WorkingDir string `yaml:"working-dir,omitempty"` // Dependencies is a set of Artifacts which the Stage's Command needs to // operate. The Artifacts are keyed by their Path for faster lookup. Dependencies 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 (Stage) CalculateChecksum ¶
CalculateChecksum returns the checksum of the Stage as it would be set in the Checksum field.
func (Stage) CreateCommand ¶
CreateCommand return an exec.Cmd for the Stage.
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.ArtifactWithStatus }
Status holds everything necessary to qualify the state of a Stage.
Click to show internal directories.
Click to hide internal directories.