Documentation
¶
Index ¶
- Variables
- func ShouldIgnore(path string) bool
- type Option
- type Reason
- type T
- func (t *T) AsInvalidFiles(reason Reason) map[string][]Reason
- func (t *T) BuildInfo() (bi *buildinfo.Targets, err error)
- func (t *T) DockerImages() []string
- func (t *T) FilesystemEntries() []string
- func (t *T) FilesystemEntriesRaw() []string
- func (t *T) FilesystemEntriesRawPlain() []string
- func (t *T) Resolve() error
- func (t *T) Verify() bool
- func (t *T) VerifyShallow() VerifyResult
- func (t *T) WithDockerRegistryClient(c dockermobyutil.RegistryClient)
- func (t *T) WithExpected(expected *buildinfo.Targets)
- type Target
- type VerifyResult
Constants ¶
This section is empty.
Variables ¶
var (
ErrTargetDoesNotExist = fmt.Errorf("target does not exist")
)
var IgnoredTargets = []string{"node_modules/.cache"}
Functions ¶
func ShouldIgnore ¶
ShouldIgnore checks if file path should be ignored when creating/extracting artifact or creating the buildinfo
Types ¶
type Reason ¶
type Reason string
Reason contains the reason why a file/directory makes the target invalid
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (*T) AsInvalidFiles ¶
AsInvalidFiles returns all FilesystemEntriesRaw as invalid with the specified reason
func (*T) BuildInfo ¶
BuildInfo reads file info and computes the target hash for filesystem and docker targets.
func (*T) DockerImages ¶
func (*T) FilesystemEntries ¶
FilesystemEntries in relation to the umrella bobfile
func (*T) FilesystemEntriesRaw ¶
FilesystemEntriesRaw returns the filesystem entries relative to the umbrella bobfile.
func (*T) FilesystemEntriesRawPlain ¶
func (*T) Resolve ¶
Resolve filesystem entries based on filesystemEntriesRaw. Becomes a noop after the first call.
func (*T) Verify ¶
Verify existence and integrity of targets against an expected buildinfo. In case the expected buildinfo does not exist Verify checks against filesystemEntriesRaw.
Verify returns true when no targets are defined. Verify returns when there is nothing to compare against.
func (*T) VerifyShallow ¶
func (t *T) VerifyShallow() VerifyResult
VerifyShallow compare targets against an existing buildinfo. It will only check if the size of the files changed. Docker targets are verified similarly as in plain verify as there is no performance penalty. In case the expected buildinfo does not exist Verify checks against filesystemEntriesRaw.
func (*T) WithDockerRegistryClient ¶
func (t *T) WithDockerRegistryClient(c dockermobyutil.RegistryClient)
func (*T) WithExpected ¶
type Target ¶
type Target interface { BuildInfo() (*buildinfo.Targets, error) Verify() bool VerifyShallow() VerifyResult Resolve() error FilesystemEntries() []string FilesystemEntriesRaw() []string FilesystemEntriesRawPlain() []string WithExpected(*buildinfo.Targets) DockerImages() []string // AsInvalidFiles returns all FilesystemEntriesRaw as invalid with the specified reason AsInvalidFiles(reason Reason) map[string][]Reason }
type VerifyResult ¶
type VerifyResult struct { // TargetIsValid shows if target is valid or not TargetIsValid bool // InvalidFiles maps filePath to reasons why it's invalid InvalidFiles map[string][]Reason }
VerifyResult is the result of a target verify call. It tells if the target is valid and if not InvalidFiles will contain the list of invalid files along with their reason. A file can be invalid for multiple reasons. ex. a changed file is invalid because of size and content hash. The map of invalid files can be used to extract only invalidated files from an artifact.
func NewVerifyResult ¶
func NewVerifyResult() VerifyResult
NewVerifyResult initializes a new VerifyResult
func (VerifyResult) AddInvalidReason ¶
func (v VerifyResult) AddInvalidReason(filePath string, reason Reason)
AddInvalidReason adds a reason for invalidation to a certain filePath