Documentation ¶
Overview ¶
Package utils implements common utility functions.
Index ¶
- func CheckRegistryConnection(ctx context.Context, cred *auth.Credential, regName string, ...) error
- func ExtractTarGz(gzipStream io.Reader, destDir string) error
- func GetRegistryFromRef(ref string) (string, error)
- func Indexes(indexConfig *index.Config, path string) (*index.MergedIndexes, error)
- func ParseReference(mergedIndexes *index.MergedIndexes, name string) (string, error)
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 ¶
ExtractTarGz extracts a *.tar.gz compressed archive and moves its content to destDir.
func GetRegistryFromRef ¶
GetRegistryFromRef extracts the registry from a ref string.
func ParseReference ¶
func ParseReference(mergedIndexes *index.MergedIndexes, name string) (string, error)
ParseReference is a helper function that parse with the followig logic:
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...
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"
if name is a complete reference, it will be returned as is.
Types ¶
This section is empty.