utils

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package utils provides utility fns for UDS-CLI

Package utils provides utility fns for UDS-CLI

Package utils provides utility fns for UDS-CLI

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCopyOpts

func CreateCopyOpts(layersToPull []ocispec.Descriptor, concurrency int) oras.CopyOptions

CreateCopyOpts creates the ORAS CopyOpts struct to use when copying OCI artifacts

func CreateSBOMArtifact

func CreateSBOMArtifact(SBOMArtifactPathMap map[string]string) error

CreateSBOMArtifact creates sbom artifacts in the form of a tar archive

func EnsureOCIPrefix

func EnsureOCIPrefix(source string) string

EnsureOCIPrefix ensures oci prefix is part of provided remote source path, and adds it if it's not

func ExtractJSON

func ExtractJSON(j any) func(context.Context, av4.File) error

ExtractJSON extracts and unmarshals a tarballed JSON file into a type

func FetchLayerAndStore

func FetchLayerAndStore(layerDesc ocispec.Descriptor, remoteRepo *oci.OrasRemote, localStore *ocistore.Store) error

FetchLayerAndStore fetches a remote layer and copies it to a local store

func GetIndex

func GetIndex(remote *oci.OrasRemote, ref string) (*ocispec.Index, error)

GetIndex gets the OCI index from a remote repository if the index exists, otherwise returns a

func GetZarfLayers

func GetZarfLayers(remote *oci.OrasRemote, pkg types.Package, pkgRootManifest *oci.ZarfOCIManifest) ([]ocispec.Descriptor, error)

GetZarfLayers grabs the necessary Zarf pkg layers from a remote OCI registry

func IsRemotePkg

func IsRemotePkg(pkg types.Package) bool

IsRemotePkg returns true if the Zarf package is remote

func IsValidTarballPath

func IsValidTarballPath(path string) bool

IsValidTarballPath returns true if the path is a valid tarball path to a bundle tarball

func MergeVariables

func MergeVariables(left map[string]string, right map[string]string) map[string]string

MergeVariables merges the variables from the config file and the CLI

TODO: move this to helpers.MergeAndTransformMap

func MoveExtractedSBOMs

func MoveExtractedSBOMs(src, dst string) error

MoveExtractedSBOMs moves the extracted SBOM HTML and JSON files from src to dst

func SBOMExtractor

func SBOMExtractor(dst string, SBOMArtifactPathMap map[string]string) func(_ context.Context, f archiver.File) error

SBOMExtractor is the extraction fn for extracting HTML and JSON files from an sboms.tar archive

func ToLocalFile

func ToLocalFile(t any, filePath string) error

ToLocalFile takes an arbitrary type, typically a struct, marshals it into JSON and stores it as a local file

func ToOCIRemote

func ToOCIRemote(t any, mediaType string, remote *oci.OrasRemote) (ocispec.Descriptor, error)

ToOCIRemote takes an arbitrary type, typically a struct, marshals it into JSON and store it in a remote OCI store

func ToOCIStore

func ToOCIStore(t any, mediaType string, store *ocistore.Store) (ocispec.Descriptor, error)

ToOCIStore takes an arbitrary type, typically a struct, marshals it into JSON and store it in a local OCI store

func UpdateIndex

func UpdateIndex(index *ocispec.Index, remote *oci.OrasRemote, bundle *types.UDSBundle, newManifestDesc ocispec.Descriptor) error

UpdateIndex updates or creates a new OCI index based on the index arg, then pushes to the remote OCI repo

func UseLogFile

func UseLogFile()

UseLogFile writes output to stderr and a logFile.

Types

This section is empty.

Jump to

Keyboard shortcuts

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