utils

package
v0.0.0-...-30fe120 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package utils implements common utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRegistryConnection

func CheckRegistryConnection(ctx context.Context, cred *auth.Credential, regName string, printer *output.Printer) error

CheckRegistryConnection checks whether the registry implement Docker Registry API V2 or OCI Distribution Specification. It also checks authentication if credentials are not empty.

func ExtractTarGz

func ExtractTarGz(gzipStream io.Reader, destDir string) error

ExtractTarGz extracts a *.tar.gz compressed archive and moves its content to destDir.

func GetRegistryFromRef

func GetRegistryFromRef(ref string) (string, error)

GetRegistryFromRef extracts the registry from a ref string.

func Indexes

func Indexes(indexConfig *index.Config, path string) (*index.MergedIndexes, error)

Indexes returns the merge of all configured indexes.

func ParseReference

func ParseReference(mergedIndexes *index.MergedIndexes, name string) (string, error)

ParseReference is a helper function that parse with the followig logic:

  1. if name is the name of an artifact, it will use the merged index to compute its reference. The tag latest is always appended. e.g "cloudtrail" -> "ghcr.io/falcosecurity/plugins/cloudtrail:latest" if instead a tag or a digest is specified, the name will be used to look up into mergedIndexes, then the tag or digest will be appended. e.g "cloudtrail:0.5.1" -> "ghcr.io/falcosecurity/plugins/cloudtrail:0.5.1" e.g "cloudtrail@sha256:123abc..." -> "ghcr.io/falcosecurity/plugins/cloudtrail@sha256:123abc...

  2. if name is a reference without tag or digest, tag latest is appended. e.g. "ghcr.io/falcosecurity/plugins/cloudtrail" -> "ghcr.io/falcosecurity/plugins/cloudtrail:latest"

  3. if name is a complete reference, it will be returned as is.

Types

This section is empty.

Jump to

Keyboard shortcuts

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