Documentation ¶
Overview ¶
Package oci contains functions for interacting with Zarf packages stored in OCI registries.
Package oci contains functions for interacting with Zarf packages stored in OCI registries.
Package oci contains functions for interacting with Zarf packages stored in OCI registries.
Package oci contains functions for interacting with Zarf packages stored in OCI registries.
Package oci contains functions for interacting with Zarf packages stored in OCI registries.
Index ¶
- Constants
- Variables
- func ReferenceFromMetadata(registryLocation string, metadata *types.ZarfMetadata, suffix string) (*registry.Reference, error)
- type ConfigPartial
- type OrasRemote
- func (o *OrasRemote) FetchImagesIndex(manifest *ZarfOCIManifest) (index *ocispec.Index, err error)
- func (o *OrasRemote) FetchLayer(desc ocispec.Descriptor) (bytes []byte, err error)
- func (o *OrasRemote) FetchManifest(desc ocispec.Descriptor) (manifest *ZarfOCIManifest, err error)
- func (o *OrasRemote) FetchRoot() (*ZarfOCIManifest, error)
- func (o *OrasRemote) FetchZarfYAML(manifest *ZarfOCIManifest) (pkg types.ZarfPackage, err error)
- func (o *OrasRemote) LayersFromPaths(requestedPaths []string) (layers []ocispec.Descriptor, err error)
- func (o *OrasRemote) LayersFromRequestedComponents(requestedComponents []string) (layers []ocispec.Descriptor, err error)
- func (o *OrasRemote) PublishPackage(pkg *types.ZarfPackage, sourceDir string, concurrency int) error
- func (o *OrasRemote) PullLayer(desc ocispec.Descriptor, destinationDir string) error
- func (o *OrasRemote) PullPackage(destinationDir string, concurrency int, layersToPull ...ocispec.Descriptor) (partialPaths []string, err error)
- func (o *OrasRemote) PullPackageMetadata(destinationDir string) (err error)
- func (o *OrasRemote) PushLayer(b []byte, mediaType string) (*ocispec.Descriptor, error)
- func (o *OrasRemote) WithRepository(ref registry.Reference) error
- type ZarfOCIManifest
Constants ¶
const ( // ZarfLayerMediaTypeBlob is the media type for all Zarf layers due to the range of possible content ZarfLayerMediaTypeBlob = "application/vnd.zarf.layer.v1.blob" // SkeletonSuffix is the reference suffix used for skeleton packages SkeletonSuffix = "skeleton" )
Variables ¶
var ( // AlwaysPull is a list of paths that will always be pulled from the remote repository. AlwaysPull = []string{config.ZarfYAML, config.ZarfChecksumsTxt, config.ZarfYAMLSignature} )
Functions ¶
func ReferenceFromMetadata ¶
func ReferenceFromMetadata(registryLocation string, metadata *types.ZarfMetadata, suffix string) (*registry.Reference, error)
ReferenceFromMetadata returns a reference for the given metadata.
prepending the provided prefix
appending the provided suffix to the version
Types ¶
type ConfigPartial ¶
type ConfigPartial struct { Architecture string `json:"architecture"` OCIVersion string `json:"ociVersion"` Annotations map[string]string `json:"annotations,omitempty"` }
ConfigPartial is a partial OCI config that is used to create the manifest config.
Unless specified, an empty manifest config will be used: `{}` which causes an error on Google Artifact Registry
to negate this, we create a simple manifest config with some build metadata
the contents of this file are not used by Zarf
type OrasRemote ¶
type OrasRemote struct { Transport *utils.Transport CopyOpts oras.CopyOptions // contains filtered or unexported fields }
OrasRemote is a wrapper around the Oras remote repository that includes a progress bar for interactive feedback.
func NewOrasRemote ¶
func NewOrasRemote(url string) (*OrasRemote, error)
NewOrasRemote returns an oras remote repository client and context for the given url.
Registry auth is handled by the Docker CLI's credential store and checked before returning the client
func (*OrasRemote) FetchImagesIndex ¶
func (o *OrasRemote) FetchImagesIndex(manifest *ZarfOCIManifest) (index *ocispec.Index, err error)
FetchImagesIndex fetches the images/index.json file from the remote repository.
func (*OrasRemote) FetchLayer ¶
func (o *OrasRemote) FetchLayer(desc ocispec.Descriptor) (bytes []byte, err error)
FetchLayer fetches the layer with the given descriptor from the remote repository.
func (*OrasRemote) FetchManifest ¶
func (o *OrasRemote) FetchManifest(desc ocispec.Descriptor) (manifest *ZarfOCIManifest, err error)
FetchManifest fetches the manifest with the given descriptor from the remote repository.
func (*OrasRemote) FetchRoot ¶
func (o *OrasRemote) FetchRoot() (*ZarfOCIManifest, error)
FetchRoot fetches the root manifest from the remote repository.
func (*OrasRemote) FetchZarfYAML ¶
func (o *OrasRemote) FetchZarfYAML(manifest *ZarfOCIManifest) (pkg types.ZarfPackage, err error)
FetchZarfYAML fetches the zarf.yaml file from the remote repository.
func (*OrasRemote) LayersFromPaths ¶
func (o *OrasRemote) LayersFromPaths(requestedPaths []string) (layers []ocispec.Descriptor, err error)
LayersFromPaths returns the descriptors for the given paths from the root manifest.
func (*OrasRemote) LayersFromRequestedComponents ¶
func (o *OrasRemote) LayersFromRequestedComponents(requestedComponents []string) (layers []ocispec.Descriptor, err error)
LayersFromRequestedComponents returns the descriptors for the given components from the root manifest.
It also retrieves the descriptors for all image layers that are required by the components.
It also respects the `required` flag on components, and will retrieve all necessary layers for required components.
func (*OrasRemote) PublishPackage ¶
func (o *OrasRemote) PublishPackage(pkg *types.ZarfPackage, sourceDir string, concurrency int) error
PublishPackage publishes the package to the remote repository.
func (*OrasRemote) PullLayer ¶
func (o *OrasRemote) PullLayer(desc ocispec.Descriptor, destinationDir string) error
PullLayer pulls a layer from the remote repository and saves it to `destinationDir/annotationTitle`.
func (*OrasRemote) PullPackage ¶
func (o *OrasRemote) PullPackage(destinationDir string, concurrency int, layersToPull ...ocispec.Descriptor) (partialPaths []string, err error)
PullPackage pulls the package from the remote repository and saves it to the given path.
layersToPull is an optional parameter that allows the caller to specify which layers to pull.
The following layers will ALWAYS be pulled if they exist:
- zarf.yaml
- checksums.txt
- zarf.yaml.sig
func (*OrasRemote) PullPackageMetadata ¶
func (o *OrasRemote) PullPackageMetadata(destinationDir string) (err error)
PullPackageMetadata pulls the package metadata from the remote repository and saves it to `destinationDir`.
func (*OrasRemote) PushLayer ¶ added in v0.28.2
func (o *OrasRemote) PushLayer(b []byte, mediaType string) (*ocispec.Descriptor, error)
PushLayer pushes the given layer (bytes) to the remote repository.
func (*OrasRemote) WithRepository ¶
func (o *OrasRemote) WithRepository(ref registry.Reference) error
WithRepository sets the repository for the remote as well as the auth client.
type ZarfOCIManifest ¶
ZarfOCIManifest is a wrapper around the OCI manifest
it includes the path to the index.json, oci-layout, and image blobs. as well as a few helper functions for locating layers and calculating the size of the layers.
func NewZarfOCIManifest ¶
func NewZarfOCIManifest(manifest *ocispec.Manifest) *ZarfOCIManifest
NewZarfOCIManifest returns a new ZarfOCIManifest.
func (*ZarfOCIManifest) Locate ¶
func (m *ZarfOCIManifest) Locate(path string) ocispec.Descriptor
Locate returns the descriptor for the layer with the given path.
func (*ZarfOCIManifest) SumLayersSize ¶
func (m *ZarfOCIManifest) SumLayersSize() int64
SumLayersSize returns the sum of the size of all the layers in the manifest.