carvelhelpers

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package carvelhelpers implements wrapper functions to use carvel tooling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CarvelPackageProcessor

func CarvelPackageProcessor(pkgDir, _ string, valuesFiles ...string) ([]byte, error)

CarvelPackageProcessor processes a carvel package and returns a configuration YAML file

func DownloadImageAndSaveFilesToDir

func DownloadImageAndSaveFilesToDir(imageWithTag, destinationDir string) error

DownloadImageAndSaveFilesToDir reads a plain OCI image and saves its files to the specified location.

func GetFilesMapFromImage

func GetFilesMapFromImage(imageWithTag string) (map[string][]byte, error)

GetFilesMapFromImage returns map of files metadata It takes os environment variables for custom repository and proxy configuration into account while downloading image from repository

func GetImageDigest added in v0.0.11

func GetImageDigest(imageWithTag string) (string, string, error)

GetImageDigest gets digest of the image

func ProcessCarvelPackage

func ProcessCarvelPackage(image string, valuesFiles ...string) ([]byte, error)

ProcessCarvelPackage processes a carvel package and returns a configuration YAML Downloads package to temporary directory and processes the package by implementing equivalent functionality as the command: `ytt -f <path> [-f <values-files>] | kbld -f -`

func ProcessYTTPackage

func ProcessYTTPackage(configDirs ...string) ([]byte, error)

ProcessYTTPackage processes configuration directory with ytt tool Implements similar functionality as `ytt -f <config-dir>`

func ResolveImagesInPackage

func ResolveImagesInPackage(files []string) ([]byte, error)

ResolveImagesInPackage resolves the images using kbld tool Implements similar functionality as `kbld -f <file1> -f <file2>`

Types

type ImageOperationOptions added in v0.90.0

type ImageOperationOptions struct{}

ImageOperationOptions implements the ImageOperationsImpl interface by using `imgpkg` library

func (*ImageOperationOptions) CopyImageFromTar added in v0.90.0

func (i *ImageOperationOptions) CopyImageFromTar(sourceTarFile, destImageRepo string) error

CopyImageFromTar publishes the image to destination repository from specified tar file This is equivalent to `imgpkg copy --tar <file> --to-repo <dest-repo>` command

func (*ImageOperationOptions) CopyImageToTar added in v0.90.0

func (i *ImageOperationOptions) CopyImageToTar(sourceImageName, destTarFile string) error

CopyImageToTar downloads the image as tar file This is equivalent to `imgpkg copy --image <image> --to-tar <tar-file-path>` command

func (*ImageOperationOptions) DownloadImageAndSaveFilesToDir added in v0.90.0

func (i *ImageOperationOptions) DownloadImageAndSaveFilesToDir(imageWithTag, destinationDir string) error

DownloadImageAndSaveFilesToDir reads a plain OCI image and saves its files to the specified location.

func (*ImageOperationOptions) GetFileDigestFromImage added in v1.0.0

func (i *ImageOperationOptions) GetFileDigestFromImage(imageWithTag, fileName string) (string, error)

GetFileDigestFromImage invokes `DownloadImageAndSaveFilesToDir` to fetch the image and returns the digest of the specified file

func (*ImageOperationOptions) GetFilesMapFromImage added in v0.90.0

func (i *ImageOperationOptions) GetFilesMapFromImage(imageWithTag string) (map[string][]byte, error)

GetFilesMapFromImage returns map of files metadata It takes os environment variables for custom repository and proxy configuration into account while downloading image from repository

func (*ImageOperationOptions) GetImageDigest added in v0.90.0

func (i *ImageOperationOptions) GetImageDigest(imageWithTag string) (string, string, error)

GetImageDigest gets digest of the image

func (*ImageOperationOptions) PushImage added in v0.90.0

func (i *ImageOperationOptions) PushImage(imageWithTag string, filePaths []string) error

PushImage publishes the image to the specified location

func (*ImageOperationOptions) ResolveImage added in v1.0.0

func (i *ImageOperationOptions) ResolveImage(imageWithTag string) error

ResolveImage invokes `imgpkg tag resolve -i <image>` command

type ImageOperationsImpl added in v0.90.0

type ImageOperationsImpl interface {
	// CopyImageToTar downloads the image as tar file
	// This is equivalent to `imgpkg copy --image <image> --to-tar <tar-file-path>` command
	CopyImageToTar(sourceImageName, destTarFile string) error
	// CopyImageFromTar publishes the image to destination repository from specified tar file
	// This is equivalent to `imgpkg copy --tar <file> --to-repo <dest-repo>` command
	CopyImageFromTar(sourceTarFile, destImageRepo string) error
	// DownloadImageAndSaveFilesToDir reads a plain OCI image and saves its
	// files to the specified location.
	DownloadImageAndSaveFilesToDir(imageWithTag, destinationDir string) error
	// GetFilesMapFromImage returns map of files metadata
	// It takes os environment variables for custom repository and proxy
	// configuration into account while downloading image from repository
	GetFilesMapFromImage(imageWithTag string) (map[string][]byte, error)
	// GetImageDigest gets digest of the image
	GetImageDigest(imageWithTag string) (string, string, error)
	// PushImage publishes the image to the specified location
	// This is equivalent to `imgpkg push -i <image> -f <filepath>`
	PushImage(imageWithTag string, filePaths []string) error
	// ResolveImage invokes `imgpkg tag resolve -i <image>` command
	ResolveImage(imageWithTag string) error
	// GetFileDigestFromImage invokes `DownloadImageAndSaveFilesToDir` to fetch the image and returns the digest of the specified file
	GetFileDigestFromImage(imageWithTag, fileName string) (string, error)
}

ImageOperationsImpl defines the helper functions for downloading, copying and processing oci images

func NewImageOperationsImpl added in v0.90.0

func NewImageOperationsImpl() ImageOperationsImpl

NewImageOperationsImpl creates new ImgpkgWrapper instance

type NoopUI

type NoopUI struct{}

NoopUI implement noop interface for logging used with carvel tooling

func (NoopUI) DebugWriter

func (ui NoopUI) DebugWriter() io.Writer

DebugWriter noop debug writer

func (NoopUI) Debugf

func (ui NoopUI) Debugf(_ string, _ ...interface{})

Debugf noop debug

func (NoopUI) Printf

func (ui NoopUI) Printf(_ string, _ ...interface{})

Printf noop print

func (NoopUI) Warnf

func (ui NoopUI) Warnf(_ string, _ ...interface{})

Warnf noop warn

Jump to

Keyboard shortcuts

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