Documentation ¶
Overview ¶
Copyright (c) 2023, Sylabs Inc. All rights reserved. This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file distributed with the sources of this project regarding your rights to use or distribute this software.
Index ¶
- Variables
- func DownloadImage(ctx context.Context, c *scslibrary.Client, imagePath, arch string, ...) error
- func DownloadImageNoProgress(ctx context.Context, c *scslibrary.Client, imagePath, arch string, ...) error
- func GetIdentity(config *scslibrary.Config) (user, email string, err error)
- func GetOCIToken(config *scslibrary.Config) (string, error)
- func NormalizeLibraryRef(ref string) (*scslibrary.Ref, error)
- func Pull(ctx context.Context, imgCache *cache.Handle, pullFrom *scslibrary.Ref, ...) (imagePath string, err error)
- func PullToFile(ctx context.Context, imgCache *cache.Handle, pullTo string, ...) (imagePath string, err error)
- func Push(ctx context.Context, sourceFile string, destRef *scslibrary.Ref, ...) (uploadResponse *scslibrary.UploadImageComplete, err error)
- func SearchLibrary(ctx context.Context, c *scslibrary.Client, value, arch string, signed bool) error
- type PullOptions
- type PushOptions
Constants ¶
This section is empty.
Variables ¶
var ErrLibraryPullUnsigned = errors.New("failed to verify container")
ErrLibraryPullUnsigned indicates that the interactive portion of the pull was aborted.
Functions ¶
func DownloadImage ¶
func DownloadImage(ctx context.Context, c *scslibrary.Client, imagePath, arch string, libraryRef *scslibrary.Ref, pb scslibrary.ProgressBar) error
DownloadImage is a helper function to wrap library image download operation
func DownloadImageNoProgress ¶
func DownloadImageNoProgress(ctx context.Context, c *scslibrary.Client, imagePath, arch string, libraryRef *scslibrary.Ref) error
DownloadImageNoProgress downloads an image from the library without displaying a progress bar while doing so
func GetIdentity ¶
func GetIdentity(config *scslibrary.Config) (user, email string, err error)
GetIdentity returns the username and email for the logged in user.
func GetOCIToken ¶
func GetOCIToken(config *scslibrary.Config) (string, error)
GetOCIToken retrieves the OCI registry token for the logged in user.
func NormalizeLibraryRef ¶
func NormalizeLibraryRef(ref string) (*scslibrary.Ref, error)
NormalizeLibraryRef parses library ref and sets default tag, if necessary.
func Pull ¶
func Pull(ctx context.Context, imgCache *cache.Handle, pullFrom *scslibrary.Ref, opts PullOptions) (imagePath string, err error)
Pull will pull a library image to the cache or direct to a temporary file if cache is disabled
func PullToFile ¶
func PullToFile(ctx context.Context, imgCache *cache.Handle, pullTo string, pullFrom *scslibrary.Ref, opts PullOptions) (imagePath string, err error)
PullToFile will pull a library image to the specified location, through the cache, or directly if cache is disabled
func Push ¶
func Push(ctx context.Context, sourceFile string, destRef *scslibrary.Ref, opts PushOptions) (uploadResponse *scslibrary.UploadImageComplete, err error)
Push will upload an image file to the library. Returns the upload completion response on success, if available, containing container path and quota usage for v1 libraries.
func SearchLibrary ¶
func SearchLibrary(ctx context.Context, c *scslibrary.Client, value, arch string, signed bool) error
SearchLibrary searches the library and outputs results to stdout
Types ¶
type PullOptions ¶
type PullOptions struct { // Endpoint is the active remote endpoint, against which the OCI registry // backing the library can be discovered. Endpoint *endpoint.Config // LibraryConfig configures operations against the library using its native // API, via sylabs/scs-library-client. LibraryConfig *scslibrary.Config // KeyClientOpts specifies options for the keyclient that will be used to // verify signatures after pulling an image. KeyClientOpts []keyclient.Option // TmpDir is the path to a directory used for temporary files. TmpDir string // RequireOciSif should be set true to require that the image pulled is an OCI-SIF. // If false a native SIF pull will be attempted, followed by an OCI(-SIF) pull on failure. RequireOciSif bool // When pulling an OCI-SIF, keep multiple layers if true, squash to single layer otherwise. KeepLayers bool // Platform specifies the platform of the image to retrieve. Platform gccrv1.Platform }
PullOptions provides options/configuration that determine the behavior of a pull from a library.
type PushOptions ¶
type PushOptions struct { // Description sets the optional description for an image pushed via the // library's own API. Description string // Endpoint is the active remote endpoint, against which the OCI registry // backing the library can be discovered. Endpoint *endpoint.Config // LibraryConfig configures operations against the library using its native // API, via sylabs/scs-library-client. LibraryConfig *scslibrary.Config // LayerFormat sets the layer format to use when pushing OCI(-SIF) images only. LayerFormat string // TmpDir is a temporary directory to be used for an temporary files created // during the push. TmpDir string }
PushOptions provides options/configuration that determine the behavior of a push to the library.