oras

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SifLayerMediaTypeV1 is the mediaType for the "layer" which contains the actual SIF file
	SifLayerMediaTypeV1 = "application/vnd.sylabs.sif.layer.v1.sif"

	// SifLayerMediaTypeProto is the mediaType from prototyping and Singularity
	// <3.7 which unfortunately includes a typo and doesn't have a version suffix
	// See: https://github.com/hpcng/singularity/issues/4437
	SifLayerMediaTypeProto = "appliciation/vnd.sylabs.sif.layer.tar"
)
View Source
const (

	// SifConfigMediaTypeV1 is the config descriptor mediaType for a SIF image.
	SifConfigMediaTypeV1 = "application/vnd.sylabs.sif.config.v1+json"
)

Variables

This section is empty.

Functions

func AuthOptn added in v1.3.0

func AuthOptn(ociAuth *ocitypes.DockerAuthConfig) remote.Option

func DownloadImage

func DownloadImage(ctx context.Context, path, ref string, ociAuth *ocitypes.DockerAuthConfig, noHTTPS bool, pb *client.DownloadProgressBar) error

DownloadImage downloads a SIF image specified by an oci reference to a file using the included credentials

func ImageHash

func ImageHash(filePath string) (v1.Hash, error)

ImageDigest returns the digest for a file

func Pull

func Pull(ctx context.Context, imgCache *cache.Handle, pullFrom, tmpDir string, ociAuth *ocitypes.DockerAuthConfig, noHTTPS bool) (imagePath string, err error)

Pull will pull an oras 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, pullFrom, tmpDir string, ociAuth *ocitypes.DockerAuthConfig, noHTTPS bool) (imagePath string, err error)

PullToFile will pull an oras image to the specified location, through the cache, or directly if cache is disabled

func RefHash added in v1.3.0

func RefHash(ctx context.Context, ref string, ociAuth *ocitypes.DockerAuthConfig, noHTTPS bool) (v1.Hash, error)

RefHash returns the digest of the SIF layer of the OCI manifest for supplied ref

func UploadImage

func UploadImage(ctx context.Context, path, ref string, ociAuth *ocitypes.DockerAuthConfig, noHTTPS bool) error

UploadImage uploads the image specified by path and pushes it to the provided oci reference, it will use credentials if supplied

Types

type SifImage added in v1.3.0

type SifImage struct {
	// contains filtered or unexported fields
}

SifImage implements a go-containerregistry v1.Image representing an ORAS / OCI artifact of a single SIF image.

func NewImageFromSIF added in v1.3.0

func NewImageFromSIF(file string, layerMediaType types.MediaType) (*SifImage, error)

func (*SifImage) ConfigFile added in v1.3.0

func (si *SifImage) ConfigFile() (*v1.ConfigFile, error)

ConfigFile returns the hash of the image's config file, also known as the Image ID.

func (*SifImage) ConfigName added in v1.3.0

func (si *SifImage) ConfigName() (v1.Hash, error)

ConfigName returns the hash of the image's config file, also known as the Image ID.

func (*SifImage) Digest added in v1.3.0

func (si *SifImage) Digest() (v1.Hash, error)

Digest returns the sha256 of this image's manifest.

func (*SifImage) LayerByDiffID added in v1.3.0

func (si *SifImage) LayerByDiffID(hash v1.Hash) (v1.Layer, error)

LayerByDiffID is an analog to LayerByDigest, looking up by "diff id" (the uncompressed hash).

func (*SifImage) LayerByDigest added in v1.3.0

func (si *SifImage) LayerByDigest(hash v1.Hash) (v1.Layer, error)

LayerByDigest returns a Layer for interacting with a particular layer of the image, looking it up by "digest" (the compressed hash).

func (*SifImage) Layers added in v1.3.0

func (si *SifImage) Layers() ([]v1.Layer, error)

Layers returns the ordered collection of filesystem layers that comprise this image. The order of the list is oldest/base layer first, and most-recent/top layer last.

func (*SifImage) Manifest added in v1.3.0

func (si *SifImage) Manifest() (*v1.Manifest, error)

Manifest returns this image's Manifest object.

func (*SifImage) MediaType added in v1.3.0

func (si *SifImage) MediaType() (types.MediaType, error)

MediaType of this image's manifest.

func (*SifImage) RawConfigFile added in v1.3.0

func (si *SifImage) RawConfigFile() ([]byte, error)

RawConfigFile returns the serialized bytes of ConfigFile().

func (*SifImage) RawManifest added in v1.3.0

func (si *SifImage) RawManifest() ([]byte, error)

RawManifest returns the serialized bytes of Manifest()

func (*SifImage) Size added in v1.3.0

func (si *SifImage) Size() (int64, error)

Size returns the size of the manifest.

type SifLayer added in v1.3.0

type SifLayer struct {
	// contains filtered or unexported fields
}

SifLayer implements a go-containerregistry v1.Layer backed by a SIF file, for ORAS / OCI artifact usage.

func NewLayerFromSIF added in v1.3.0

func NewLayerFromSIF(file string, mt types.MediaType) (*SifLayer, error)

NewLayerFromSIF creates a new layer, backed by file, with mt as the MediaType. The MediaType should always be set SifLayerMediaTypeV1 in production. It is configurable so that we can implement tests which use the old prototype media value.

func (*SifLayer) Compressed added in v1.3.0

func (sl *SifLayer) Compressed() (io.ReadCloser, error)

func (*SifLayer) DiffID added in v1.3.0

func (sl *SifLayer) DiffID() (v1.Hash, error)

func (*SifLayer) Digest added in v1.3.0

func (sl *SifLayer) Digest() (v1.Hash, error)

func (*SifLayer) MediaType added in v1.3.0

func (sl *SifLayer) MediaType() (types.MediaType, error)

func (*SifLayer) Size added in v1.3.0

func (sl *SifLayer) Size() (int64, error)

func (*SifLayer) Uncompressed added in v1.3.0

func (sl *SifLayer) Uncompressed() (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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