Documentation
¶
Overview ¶
Package zarfpackage reads a built zarf package (https://github.com/zarf-dev/zarf) as a source of images and files for a package build.
Both halves of a zarf package record where their content came from, which is what makes resolving a distro definition against one a map lookup rather than a heuristic:
- images/ is a plain OCI image layout whose index entries carry org.opencontainers.image.ref.name, set to the reference zarf pulled the image under before any registry override was applied.
- zarf.yaml keeps each component file's source exactly as the package author wrote it, and the bytes sit at a path derived from the file's position in the component. zarf rewrites files[].source only when building a skeleton, which is not a package anybody deploys.
Those are the same strings a distro definition writes in imageConfig.images and File.Source.
Index ¶
- type Package
- func (p *Package) Close() error
- func (p *Package) Describe() string
- func (p *Package) Fetch(ctx context.Context, src, dst string) (err error)
- func (p *Package) File(src string) (string, bool)
- func (p *Package) HasImage(ref string) bool
- func (p *Package) Source() string
- func (p *Package) Target() oras.ReadOnlyTarget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package is an opened zarf package. Close removes what Open unpacked, so every Package must be closed.
func Open ¶
Open reads the zarf package at path, which may be a built package archive or a directory it has already been extracted into. An archive is unpacked into a temporary directory owned by the returned Package.
func OpenDir ¶
OpenDir reads an already-unpacked zarf package at dir, naming it in messages and recorded provenance as source. The caller keeps ownership of dir: the returned Package's Close does not remove it.
This is the entry point for a caller that has unpacked a bundle itself in order to work out which format it is -- see openContentStore in pkg/distro.
func (*Package) Close ¶
Close removes anything Open unpacked. A package directory is left untouched.
func (*Package) Fetch ¶
Fetch writes the component file declared as coming from src to dst, creating it.
func (*Package) File ¶
File reports whether the package holds a component file declared as coming from src -- a URL or a path as it appeared in a distro definition -- and the name it is restored under.
func (*Package) HasImage ¶
HasImage reports whether the package holds the image ref, spelled as a distro definition spells it.
func (*Package) Source ¶
Source is the path the package was opened from, for messages and provenance.
func (*Package) Target ¶
func (p *Package) Target() oras.ReadOnlyTarget
Target presents the package's images as an oras target that resolves the references a distro definition uses.
The layout's own tag index cannot be relied on: zarf tags each image under the reference it pulled it by, but a package of files alone has no layout at all, and nothing guarantees the tag survived a registry override. This maps the full reference back through the index annotation instead.