sourceidentity

package
v0.19.1302 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ResolvedFromCommit    = "commit"
	ResolvedFromBranchRun = "branch_run"
	ResolvedFromLookup    = "lookup"
)

How a Git source's commit was chosen. Provenance is recorded for display and is not part of the checksum.

View Source
const Complete = "complete"
View Source
const DefaultTerraformVersion = "1.7.5"
View Source
const InputsOverLimit = "source_inputs_over_limit"
View Source
const MaxInputs = 1000
View Source
const Unknown = "unknown"
View Source
const Version = 1

Variables

This section is empty.

Functions

func Checkout

func Checkout(ctx context.Context, repo *git.Repository, ref string, auth transport.AuthMethod) error

func CleanRoot

func CleanRoot(root string) string

func Equivalent

func Equivalent(before, after *Identity) bool

func Hash

func Hash(value any) string

func InputEntry

func InputEntry(entry string, stat bool) string

InputEntry reduces a Git entry to what a stat observes: the mode, plus the object for symlinks and submodules.

func IsCommit

func IsCommit(ref string) bool

func Matches

func Matches(expected, actual *Identity) bool

func TerraformVersion

func TerraformVersion(version string) string

func ValidInputPath

func ValidInputPath(name string) bool

func ValidateTransition

func ValidateTransition(expected, actual *Identity, allowCapture bool) error

func Verify

func Verify(source *sourcefs.FS, expected *Identity) error

Types

type File

type File struct {
	Path       string `json:"path"`
	SHA256     string `json:"sha256"`
	Executable bool   `json:"executable,omitempty"`
}

type Identity

type Identity struct {
	Version        int      `json:"version"`
	Checksum       string   `json:"checksum"`
	Coverage       string   `json:"coverage"`
	Reasons        []string `json:"reasons,omitempty"`
	ConfigChecksum string   `json:"config_checksum"`
	Kind           string   `json:"kind"`
	Root           string   `json:"root,omitempty"`
	Repository     string   `json:"repository,omitempty"`
	Commit         string   `json:"commit,omitempty"`
	Digest         string   `json:"digest,omitempty"`
	ChartVersion   string   `json:"chart_version,omitempty"`
	Files          []File   `json:"files,omitempty"`
	Captured       bool     `json:"captured"`
	Inputs         []Input  `json:"inputs,omitempty"`
	InputsRecorded bool     `json:"inputs_recorded,omitempty"`

	Ref          string     `json:"ref,omitempty"`
	ResolvedFrom string     `json:"resolved_from,omitempty"`
	ResolvedAt   *time.Time `json:"resolved_at,omitempty"`
}

func Capture

func Capture(source *sourcefs.FS, selected *Identity) (*Identity, error)

func New

func New(kind, configChecksum string) *Identity

func ResolveImage

func ResolveImage(expected *Identity, digest string) (*Identity, error)

func (*Identity) EligibleChecksum

func (i *Identity) EligibleChecksum() string

func (*Identity) MarkUnknown

func (i *Identity) MarkUnknown(reason string)

func (*Identity) OverInputLimit

func (i *Identity) OverInputLimit() (*Identity, error)

OverInputLimit records that the build read more than MaxInputs paths outside Root, so it can never be reused.

func (*Identity) Seal

func (i *Identity) Seal()

func (*Identity) Validate

func (i *Identity) Validate() error

func (*Identity) WithInputs

func (i *Identity) WithInputs(inputs []Input) (*Identity, error)

WithInputs records the entries a build read outside Root.

func (*Identity) WithoutInputs

func (i *Identity) WithoutInputs() *Identity

type Input

type Input struct {
	Path  string `json:"path"`
	Stat  bool   `json:"stat,omitempty"`
	Entry string `json:"entry,omitempty"`
}

Input is a repository path outside Root that the build read (or only statted, when Stat is set), with its Git entry at Commit. Entry is empty when the path is absent; stat inputs keep only the mode unless the entry is a symlink or submodule.

type Reads

type Reads struct {
	Read []string `json:"read,omitempty"`
	Stat []string `json:"stat,omitempty"`
}

func ExternalReads

func ExternalReads(root, digest string, read, stat []string) *Reads

ExternalReads keeps the paths outside root, dropping any path covered by a directory or file whose contents were read. When root's digest is a directory, stats of root's ancestors are dropped too, because that digest already pins each of them as a directory. A symlink digest holds only the link target, not which ancestor is the link, so those stats are kept.

Jump to

Keyboard shortcuts

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