Documentation
¶
Overview ¶
Package assemble builds a Cargoship package on disk
Index ¶
- func AssembleDistro(ctx context.Context, d distro.Distro, distroPath string, opts AssembleOptions) (*layout.DistroLayout, error)
- type AssembleOptions
- type CompositeStore
- func (c *CompositeStore) Describe() string
- func (c *CompositeStore) Fetch(ctx context.Context, req contentstore.FileRequest, dst string) error
- func (c *CompositeStore) File(req contentstore.FileRequest) (string, bool, error)
- func (c *CompositeStore) HasImage(ref string) bool
- func (c *CompositeStore) Source() string
- func (c *CompositeStore) Target() oras.ReadOnlyTarget
- type ContentStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssembleDistro ¶
func AssembleDistro(ctx context.Context, d distro.Distro, distroPath string, opts AssembleOptions) (*layout.DistroLayout, error)
AssembleDistro creates the actual tarballs
Types ¶
type AssembleOptions ¶
type AssembleOptions struct {
RegistryOverrides []images.RegistryOverride
// FileOverrides redirect the file downloads a distro definition declares to an internal
// mirror or to a directory of pre-staged assets, the way RegistryOverrides redirects image
// pulls. See pkg/fileoverride.
FileOverrides []fileoverride.Override
// ContentStore is an opened local content bundle that images and files are resolved from
// before the network. It is nil when no store was given.
ContentStore ContentStore
OCIConcurrency int
CachePath string
SkipSBOM bool
// Reproducible pins Build.Timestamp to config.Timestamp instead of the
// current time, and is recorded on Build.Reproducible, so identical package
// inputs produce byte-identical output.
Reproducible bool
// SigningKeyPath and SigningKeyPassword sign the package as part of assembly when
// set. Empty values are a no-op -- see DistroLayout.SignPackage.
SigningKeyPath string
SigningKeyPassword string
types.RemoteOptions
}
AssembleOptions options
type CompositeStore ¶ added in v0.40.0
type CompositeStore struct {
// contains filtered or unexported fields
}
CompositeStore resolves content from several bundles as though they were one.
A zarf package carries a single metadata.architecture by construction, so a build targeting two architectures needs one package per architecture. Those two are not alternatives to each other - each holds half of what the build wants - which is what makes this a merge rather than a fallback chain.
The two halves merge differently, because the two kinds of content are shaped differently:
- A **file** entry already names one architecture, so asking each bundle in turn for the entry's own request merges them for free: a bundle that does not hold that architecture reports a miss and the next one answers.
- An **image** reference covers every architecture at once, so asking each bundle in turn would let the first to hold the reference answer for all of them - and the architectures it lacks would fall back to the registry even though another bundle holds them. The image half therefore presents one merged view per reference. See compositeTarget.
func (*CompositeStore) Describe ¶ added in v0.40.0
func (c *CompositeStore) Describe() string
Describe names the bundles in log lines.
func (*CompositeStore) Fetch ¶ added in v0.40.0
func (c *CompositeStore) Fetch(ctx context.Context, req contentstore.FileRequest, dst string) error
Fetch writes the file to dst, from whichever bundle holds it.
func (*CompositeStore) File ¶ added in v0.40.0
func (c *CompositeStore) File(req contentstore.FileRequest) (string, bool, error)
File asks each bundle for the entry in turn and takes the first answer.
An error stops the walk rather than moving on: a bundle reporting that an entry is ambiguous -- it holds the reference for several architectures and the entry names none -- has found a defect in the definition, and trying the next bundle would bury it.
func (*CompositeStore) HasImage ¶ added in v0.40.0
func (c *CompositeStore) HasImage(ref string) bool
HasImage reports whether any bundle holds the reference.
func (*CompositeStore) Source ¶ added in v0.40.0
func (c *CompositeStore) Source() string
Source names the bundles as the operator spelled them.
func (*CompositeStore) Target ¶ added in v0.40.0
func (c *CompositeStore) Target() oras.ReadOnlyTarget
Target presents every bundle as one read-only target.
type ContentStore ¶ added in v0.39.0
type ContentStore interface {
images.ImageSource
// File reports whether the bundle holds the file the definition's entry asks for, and
// the name it is restored under. It errors when the bundle holds the reference for
// several architectures and the request names none -- see contentstore.FileRequest.
File(req contentstore.FileRequest) (name string, ok bool, err error)
// Fetch writes that file to dst.
Fetch(ctx context.Context, req contentstore.FileRequest, dst string) error
// Source names the bundle as the operator spelled it, for messages and provenance.
Source() string
}
ContentStore is a local, already-populated bundle of images and files that a build resolves against before reaching the network: a hauler store, a zarf package.
The image half is images.ImageSource unchanged, so pkg/images needs to know nothing about any particular bundle. The file half is declared here, at the consumer, and deliberately hands back a name and bytes rather than an OCI descriptor -- a hauler store holds a file as a titled layer, a zarf package holds it as a member of a component tarball, and only one of those has a descriptor to give.
A reader must never be placed in this field as a typed nil pointer, which is not itself nil and would send every lookup to a bundle that is not there. See openContentStore in pkg/distro.
func NewCompositeStore ¶ added in v0.40.0
func NewCompositeStore(stores ...ContentStore) ContentStore
NewCompositeStore returns a store reading from each of stores, in order. It returns the single store unchanged when given one, so the common case carries no merging machinery.