Documentation ¶
Index ¶
- Constants
- Variables
- func CreateErrAmbiguousTargets(tasks []string, target string) error
- type ArtifactInfo
- type ArtifactMetadata
- type Map
- func (tm Map) CollectNixDependenciesForTasks(whitelist []string) ([]nix.Dependency, error)
- func (tm Map) CollectTasksInPipeline(taskName string) ([]string, error)
- func (tm Map) FilterInputs() (err error)
- func (tm Map) FilterInputsSequential() (err error)
- func (tm Map) IgnoreChildTargets(dir string) (err error)
- func (tm Map) KeysSortedAlpabethically() (keys []string)
- func (tm Map) Sanitize() (err error)
- func (tm Map) String() string
- func (tm Map) VerifyDuplicateTargets() error
- func (tm Map) Walk(root string, parentLevel string, ...) error
- type RebuildOptions
- type RebuildType
- type TargetEntry
- type Task
- func (t *Task) ArtifactCreate(artifactName hash.In) (err error)
- func (t *Task) ArtifactExists(artifactName hash.In) bool
- func (t *Task) ArtifactExtract(artifactName hash.In, invalidFiles map[string][]target.Reason) (success bool, err error)
- func (t *Task) ArtifactInspect(artifactNames ...hash.In) (ai ArtifactInfo, err error)
- func (t *Task) Clean(verbose ...bool) error
- func (t *Task) CleanTargetsWithReason(invalidFiles map[string][]target.Reason, verbose ...bool) error
- func (t *Task) ColoredName() string
- func (t *Task) Dependencies() []nix.Dependency
- func (t *Task) DidTaskChange() (_ bool, err error)
- func (t *Task) Dir() string
- func (t *Task) Env() []string
- func (t *Task) FilterInputs(wd string) (err error)
- func (t *Task) FilteredInputs(projectRoot string) (_ []string, err error)
- func (t *Task) GetArtifactMetadata(artifactName string) (_ *ArtifactMetadata, err error)
- func (t *Task) HashIn() (taskHash hash.In, err error)
- func (t *Task) HashInAlways() (taskHash hash.In, err error)
- func (t *Task) Inputs() []string
- func (t *Task) IsDecoration() bool
- func (t *Task) IsValidDecoration() bool
- func (t *Task) LogSkippedInput() []string
- func (t *Task) Name() string
- func (t *Task) Nixpkgs() string
- func (t *Task) Project() string
- func (t *Task) ReadBuildInfo() (bi *buildinfo.I, err error)
- func (t *Task) Rebuild() RebuildType
- func (t *Task) Run(ctx context.Context, namePad int) (err error)
- func (t *Task) SetColor(color aurora.Color)
- func (t *Task) SetDependencies(dependencies []nix.Dependency)
- func (t *Task) SetDir(dir string)
- func (t *Task) SetEnv(env []string)
- func (t *Task) SetEnvID(envID envutil.Hash)
- func (t *Task) SetInputs(inputs []string)
- func (t *Task) SetName(name string)
- func (t *Task) SetNixpkgs(nixpkgs string)
- func (t *Task) SetProject(proj string)
- func (t *Task) SetRebuildStrategy(rebuild RebuildType)
- func (t *Task) ShortName() string
- func (t *Task) Target() (empty target.Target, _ error)
- func (t *Task) TargetExists() bool
- func (t *Task) UnmarshalYAML(value *yaml.Node) (err error)
- func (t *Task) Verify() error
- func (t *Task) VerifyAfter() error
- func (t *Task) VerifyBefore() error
- func (t *Task) WithBuildinfoStore(s buildinfostore.Store) *Task
- func (t *Task) WithDockerRegistryClient(c dockermobyutil.RegistryClient) *Task
- func (t *Task) WithEnvStore(s envutil.Store) *Task
- func (t *Task) WithLocalstore(s store.Store) *Task
- func (t *Task) WithRemotestore(s store.Store) *Task
- func (t *Task) WriteBuildinfo(buildinfo *buildinfo.I) (err error)
- type TaskOption
Constants ¶
const (
TaskPathSeparator = '/'
)
Variables ¶
var ( ErrBobfileNotFound = fmt.Errorf("could not find a bobfile") ErrHashesFileDoesNotExist = fmt.Errorf("hashes file does not exist") ErrTaskHashDoesNotExist = fmt.Errorf("task hash does not exist") ErrHashInDoesNotExist = fmt.Errorf("input-hash does not exist") ErrInvalidInput = fmt.Errorf("invalid input") ErrBuildinfostoreIsNil = fmt.Errorf("buildinfostore is nil") ErrInvalidTargetDefinition = fmt.Errorf("invalid target definition, can't find 'path' or 'image' directive") ErrAmbigousTargetDefinition = fmt.Errorf("ambigous target definition, can't have 'path' and 'image' directive on same target") ErrAmbigousTargets = fmt.Errorf("ambigous targets detected") )
var ErrArtifactDoesNotExist = fmt.Errorf("artifact does not exist")
var ErrInvalidTarHeaderType = fmt.Errorf("invalid tar header type")
Functions ¶
Types ¶
type ArtifactInfo ¶
type ArtifactInfo interface { Metadata() *ArtifactMetadata String() string Types() []targettype.T }
func ArtifactInspectFromReader ¶
func ArtifactInspectFromReader(reader io.ReadCloser) (_ ArtifactInfo, err error)
ArtifactInspectFromPath opens a artifact from a io reader and returns a string containing compact information about a target.
type ArtifactMetadata ¶
type ArtifactMetadata struct { // Project is the project in which the task is defined Project string `yaml:"project,omitempty"` // Taskname this artifact was build for Taskname string `yaml:"taskname,omitempty"` // InputHash and unique identifier InputHash string `yaml:"input_hash,omitempty"` // CreatedAt timestamp the artifact was created CreatedAt time.Time `yaml:"created_at,omitempty"` }
func NewArtifactMetadata ¶
func NewArtifactMetadata() *ArtifactMetadata
type Map ¶
func (Map) CollectNixDependenciesForTasks ¶
func (tm Map) CollectNixDependenciesForTasks(whitelist []string) ([]nix.Dependency, error)
CollectNixDependenciesForTasks will collect all nix dependencies for task taskName in nixDependencies slice
func (Map) CollectTasksInPipeline ¶
CollectTasksInPipeline will collect all task names in the pipeline for task taskName in the tasksInPipeline slice
func (Map) FilterInputsSequential ¶
FilterInputsSequential is the sequential version of FilterInputs. Can be handy for debugging input errors.
func (Map) IgnoreChildTargets ¶
IgnoreChildTargets fills the `InputAdditionalIgnores` field of each task with the targets of each tasks children. `dir` must be the root of the aggregate, and it is used to ignore resolved targets relative to this project
func (Map) KeysSortedAlpabethically ¶
func (Map) Sanitize ¶
Sanitize task map and write filtered & sanitized properties from dirty members to plain (e.g. dirtyInputs -> filter&sanitize -> inputs)
func (Map) VerifyDuplicateTargets ¶
VerifyDuplicateTargets checks if multiple build tasks point to the same target.
type RebuildOptions ¶
type RebuildType ¶
type RebuildType string
const ( RebuildAlways RebuildType = "always" RebuildOnChange RebuildType = "on-change" )
type TargetEntry ¶
type TargetEntry interface{}
type Task ¶
type Task struct { // InputDirty is the representation read from a bobfile. InputDirty string `yaml:"input,omitempty"` // InputAdditionalIgnores is a list of ignores // usually the child targets. InputAdditionalIgnores []string `yaml:"input_additional_ignores,omitempty"` CmdDirty string `yaml:"cmd,omitempty"` // DependsOn are task which must succeed before this task // can run. DependsOn []string `yaml:"dependsOn,omitempty"` // dependsOnIDs task id's used for optimization. // Not exposed in a Bobfile. DependsOnIDs []int `yaml:"-"` // Target defines the output of a task. TargetDirty TargetEntry `yaml:"target,omitempty"` // defines the rebuild strategy RebuildDirty string `yaml:"rebuild,omitempty"` // taskID is a integer provided to // avoid referencing tasks by name // (string comparison, map access) TaskID int // DependenciesDirty read from the bobfile DependenciesDirty []string `yaml:"dependencies,omitempty"` // contains filtered or unexported fields }
Hint: When adding a new *Dirty field assure to update IsValidDecoration().
func Make ¶
func Make(opts ...TaskOption) Task
func (*Task) ArtifactCreate ¶
ArtifactCreate create an archive for one or multiple targets
func (*Task) ArtifactExists ¶
ArtifactExists return true when the artifact exists in localstore
func (*Task) ArtifactExtract ¶
func (t *Task) ArtifactExtract(artifactName hash.In, invalidFiles map[string][]target.Reason) (success bool, err error)
ArtifactExtract extract an artifact from the localstore if it exists. Return true on a successful extract operation.
func (*Task) ArtifactInspect ¶
func (t *Task) ArtifactInspect(artifactNames ...hash.In) (ai ArtifactInfo, err error)
func (*Task) CleanTargetsWithReason ¶
func (t *Task) CleanTargetsWithReason(invalidFiles map[string][]target.Reason, verbose ...bool) error
CleanTargetsWithReason removes files assosiated to a target but considering the reason for a deletion. This assures that we can be sure a target was correctly created and has not been there before the task ran.
func (*Task) ColoredName ¶
func (*Task) Dependencies ¶
func (t *Task) Dependencies() []nix.Dependency
func (*Task) DidTaskChange ¶
didTaskChange returns true if the `In` hash does not exist in the buildinfo storage. This indicates that there has not been a previous build for this combination of inputs.
func (*Task) FilterInputs ¶
func (*Task) FilteredInputs ¶
filteredInputs returns inputs filtered by ignores and file targets. Calls sanitize on the result.
func (*Task) GetArtifactMetadata ¶
func (t *Task) GetArtifactMetadata(artifactName string) (_ *ArtifactMetadata, err error)
GetArtifactMetadata creates a new artifact instance to retrive Metadata separately and returns ArtifactMetadata, close the artifacts before returning
func (*Task) HashInAlways ¶
HashInAlways computes the input hash without using a cached value
func (*Task) IsDecoration ¶
IsDecoration check if the task is a decorated task
func (*Task) IsValidDecoration ¶
IsValidDecoration checks if the task is a valid decoration. tasks containing a `dependsOn` node only are considered as valid decoration.
Make sure to update IsValidDecoration() very time a new *Dirty field is added to the task.
func (*Task) LogSkippedInput ¶
LogSkippedInput skipped input files from the task. prints nothing if there is not skipped input.
func (*Task) Project ¶
Project returns the projectname. In case of a non existing projectname the tasks local directory is returned.
func (*Task) ReadBuildInfo ¶
ReadBuildInfo indexed by the input hash from the store
func (*Task) Rebuild ¶
func (t *Task) Rebuild() RebuildType
func (*Task) SetDependencies ¶
func (t *Task) SetDependencies(dependencies []nix.Dependency)
func (*Task) SetNixpkgs ¶
func (*Task) SetProject ¶
func (*Task) SetRebuildStrategy ¶
func (t *Task) SetRebuildStrategy(rebuild RebuildType)
Set the rebuild strategy for the task defaults to `on-change`.
func (*Task) Target ¶
Target takes care of populating the targets members correctly. It returns a nil in case of a non-existing target and a nil error.
func (*Task) TargetExists ¶
func (*Task) UnmarshalYAML ¶
func (*Task) VerifyAfter ¶
VerifyAfter a bobfile after task runner.
func (*Task) VerifyBefore ¶
VerifyBefore a bobfile before task runner.
func (*Task) WithBuildinfoStore ¶
func (t *Task) WithBuildinfoStore(s buildinfostore.Store) *Task
func (*Task) WithDockerRegistryClient ¶
func (t *Task) WithDockerRegistryClient(c dockermobyutil.RegistryClient) *Task
type TaskOption ¶
type TaskOption func(t *Task)
func WithEnvironment ¶
func WithEnvironment(envs []string) TaskOption