inventory

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MPL-2.0 Imports: 26 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 FluxMirrorAPIVersion = "mirror.plugin.fluxcd.io/v1beta2"

FluxMirrorAPIVersion is the apiVersion of the Flux Mirror config that FluxMirror writes.

View Source
const InventoryVersion = "v1alpha1"

InventoryVersion is the schema version of an Inventory document.

Variables

This section is empty.

Functions

func BundleBOMWriter

func BundleBOMWriter(builder artifact.Artifact, digests DigestLookup) artifact.BOMWriter

BundleBOMWriter returns the BOM writer of windsor bundle. The writer lists the artifact tags of the bundle, each oci:// source of the bundled blueprint, and the components of each source. It pulls each source that is not in the cache through builder, once for all calls, and fails when a pull fails. Each tag with an exact version and no digest gets its digest from digests, and a failed lookup fails the writer. A nil digests reads no digest.

func CycloneDX

func CycloneDX(tree SourceTree, name, version string) ([]byte, error)

CycloneDX returns tree as a CycloneDX 1.6 BOM in JSON. An image is a container component, a chart is an application component, and a source is a data component. The BOM has one component for each package URL, and its dependencies graph names the components that each source pulls. When name is not empty, the metadata names the blueprint, with name as its bom-ref, and the blueprint depends on its own artifacts and sources.

func ListLines

func ListLines(inv Inventory) string

ListLines returns one destination<TAB>upstream line for each artifact in inv. An artifact with no destination has an empty first field.

Types

type BaseLister

type BaseLister struct {
	// contains filtered or unexported fields
}

BaseLister is the default Lister.

func NewLister

func NewLister(rt *runtime.Runtime, artifactBuilder artifact.Artifact) *BaseLister

NewLister creates a BaseLister. It panics if rt or artifactBuilder is nil.

func (*BaseLister) List

func (l *BaseLister) List(blueprint *blueprintv1alpha1.Blueprint, opts Options) (*Result, error)

List returns the artifacts of blueprint: each oci:// blueprint source, and each chart and image that an artifact tag names in the files that blueprint uses, in the project and in the cache of each oci:// source. With opts.All, it reads whole sources. Each entry gets a destination, and the entries are unique and sorted. The tree of the result groups the tags of each source under that source.

type DigestLookup

type DigestLookup interface {
	Digest(e Entry) (string, error)
}

DigestLookup returns the digest that the tag of an artifact names in its registry now.

type Entry

type Entry struct {
	Kind        Kind      `yaml:"kind"`
	Transport   Transport `yaml:"transport"`
	Reference   string    `yaml:"reference"`
	Name        string    `yaml:"name,omitempty"`
	Version     string    `yaml:"version,omitempty"`
	Digest      string    `yaml:"digest,omitempty"`
	Destination string    `yaml:"destination,omitempty"`
	NoReferrers bool      `yaml:"noReferrers,omitempty"`
	Source      Source    `yaml:"source"`
}

Entry is one external artifact. Reference is the repository without a scheme or tag for OCI, and the repository URL for HTTP and Git. NoReferrers is true when an artifact tag has referrers=false.

func (Entry) Upstream

func (e Entry) Upstream() string

Upstream returns the pull reference of e. An OCI chart has the oci:// scheme, an HTTP or Git chart is its repository URL followed by /<name>:<version>, and an image or blueprint has no scheme.

type FacetTrace

type FacetTrace interface {
	UnusedFacetValue(facetPath string, line int) (bool, string)
}

FacetTrace tells which values of a facet the composed blueprint uses. UnusedFacetValue returns true only when the trace proves that the blueprint does not use the value on the line. It returns a note when the trace cannot resolve the value.

type FluxMirrorArtifact

type FluxMirrorArtifact struct {
	Source           string             `yaml:"source"`
	Destination      string             `yaml:"destination"`
	Selector         FluxMirrorSelector `yaml:"selector"`
	IncludeReferrers bool               `yaml:"includeReferrers"`
}

FluxMirrorArtifact copies the tags that its selector names from one OCI repository to another.

type FluxMirrorChart

type FluxMirrorChart struct {
	Name        string `yaml:"name"`
	Source      string `yaml:"source"`
	Destination string `yaml:"destination"`
	Version     string `yaml:"version"`
}

FluxMirrorChart copies one chart version from an HTTP Helm repository to an OCI registry.

type FluxMirrorConfig

type FluxMirrorConfig struct {
	APIVersion string               `yaml:"apiVersion"`
	Kind       string               `yaml:"kind"`
	Charts     []FluxMirrorChart    `yaml:"charts,omitempty"`
	Artifacts  []FluxMirrorArtifact `yaml:"artifacts,omitempty"`
}

FluxMirrorConfig is a Flux Mirror config.

func FluxMirror

func FluxMirror(inv Inventory, chartsTo string) (FluxMirrorConfig, []string, error)

FluxMirror returns the Flux Mirror config of inv and a note for each artifact it leaves out. It writes an HTTP chart as a charts entry with an exact version, and an OCI chart, an image, or a blueprint as an artifacts entry whose selector.tags holds its one tag. The entry includes referrers unless the artifact has NoReferrers. It leaves out an artifact with no destination or no tag, and a chart whose upstream is already in chartsTo. It needs chartsTo when inv has a chart.

type FluxMirrorSelector

type FluxMirrorSelector struct {
	Tags []string `yaml:"tags"`
}

FluxMirrorSelector selects an exact list of tags.

type Inventory

type Inventory struct {
	Version   string  `yaml:"version"`
	Context   string  `yaml:"context,omitempty"`
	Artifacts []Entry `yaml:"artifacts"`
}

Inventory is the document that windsor show artifacts prints with -o yaml.

type Kind

type Kind string

Kind classifies an artifact by the object that declares it.

const (
	// KindChart is a Helm chart that a chart source names.
	KindChart Kind = "chart"

	// KindImage is a container image that a pod template names.
	KindImage Kind = "image"

	// KindBlueprint is a blueprint artifact that an oci:// blueprint source names.
	KindBlueprint Kind = "blueprint"
)

type Lister

type Lister interface {
	List(blueprint *blueprintv1alpha1.Blueprint, opts Options) (*Result, error)
}

Lister lists the external artifacts of a composed blueprint.

type Options

type Options struct {
	ChartsTo string
	All      bool
	Trace    FacetTrace
}

Options holds the settings of one List call. All selects the artifact tags of whole sources, also of the files that the blueprint does not use. Trace removes the artifact tags of facet values that the blueprint does not use. It is optional.

type RegistryDigests

type RegistryDigests struct {
	// contains filtered or unexported fields
}

RegistryDigests is the default DigestLookup.

func NewRegistryDigests

func NewRegistryDigests() *RegistryDigests

NewRegistryDigests creates a RegistryDigests.

func (*RegistryDigests) Digest

func (d *RegistryDigests) Digest(e Entry) (string, error)

Digest returns the sha256 digest of e. An OCI image or chart gets the digest of its manifest or index. An HTTP chart gets the digest of its archive from the repository index, or the sha256 of the archive when the index gives none. It returns an error for an artifact that it cannot read, and for a Git chart.

type Result

type Result struct {
	Inventory Inventory
	Tree      SourceTree
	Notes     []string
}

Result is the inventory, its source tree, and the notes that List writes for the operator.

type Source

type Source struct {
	Kustomization string `yaml:"kustomization,omitempty"`
	Object        string `yaml:"object,omitempty"`
	File          string `yaml:"file,omitempty"`
}

Source records where the context declares an artifact.

type SourceTree

type SourceTree struct {
	Name      string
	Entry     Entry
	Artifacts []Entry
	Sources   []SourceTree
	// contains filtered or unexported fields
}

SourceTree is the artifacts of one blueprint source and the trees of the oci:// sources that it names. The root of a tree is the blueprint itself, with no name and no entry.

type Transport

type Transport string

Transport tells how a client fetches an artifact from its upstream.

const (
	// TransportOCI is an OCI registry.
	TransportOCI Transport = "oci"

	// TransportHTTP is a Helm repository that serves an index.yaml over HTTP.
	TransportHTTP Transport = "http"

	// TransportGit is a Git repository.
	TransportGit Transport = "git"
)

Jump to

Keyboard shortcuts

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