common

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package common ...

Index

Constants

View Source
const (
	// See https://github.com/opencontainers/image-spec/blob/main/annotations.md#back-compatibility-with-label-schema
	AnnotationLabels             = "org.label-schema.labels"
	LabelAnnotationCreated       = "org.label-schema.build-date"
	LabelAnnotationVendor        = "org.label-schema.vendor"
	LabelAnnotationDescription   = "org.label-schema.description"
	LabelAnnotationTitle         = "org.label-schema.name"
	LabelAnnotationDocumentation = "org.label-schema.usage"
	LabelAnnotationSource        = "org.label-schema.vcs-url"
)

Variables

This section is empty.

Functions

func GetAnnotationValue added in v1.4.3

func GetAnnotationValue(annotations map[string]string, annotationKey, labelKey string) string
OCI annotation/label with backwards compatibility

arg can be either lables or annotations https://github.com/opencontainers/image-spec/blob/main/annotations.md.

func GetAuthors added in v1.4.3

func GetAuthors(annotations map[string]string) string

func GetCategories

func GetCategories(labels map[string]string) string

func GetDescription

func GetDescription(annotations map[string]string) string

func GetDocumentation added in v1.4.3

func GetDocumentation(annotations map[string]string) string

func GetImageDirAndTag

func GetImageDirAndTag(imageName string) (string, string)

func GetImageLastUpdated added in v1.4.3

func GetImageLastUpdated(imageInfo ispec.Image) time.Time

GetImageLastUpdated This method will return last updated timestamp. The Created timestamp is used, but if it is missing, look at the history field and, if provided, return the timestamp of last entry in history.

func GetLicenses added in v1.4.3

func GetLicenses(annotations map[string]string) string

func GetRepo

func GetRepo(image string) string

func GetRootDir

func GetRootDir(image string, storeController storage.StoreController) string

func GetRoutePrefix

func GetRoutePrefix(name string) string

func GetSource added in v1.4.3

func GetSource(annotations map[string]string) string

func GetTitle added in v1.4.3

func GetTitle(annotations map[string]string) string

func GetVendor

func GetVendor(annotations map[string]string) string

Types

type Annotation added in v1.4.3

type Annotation struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type BaseOciLayoutUtils added in v1.4.2

type BaseOciLayoutUtils struct {
	Log             log.Logger
	StoreController storage.StoreController
}

OciLayoutInfo ...

func NewBaseOciLayoutUtils added in v1.4.2

func NewBaseOciLayoutUtils(storeController storage.StoreController, log log.Logger) *BaseOciLayoutUtils

NewBaseOciLayoutUtils initializes a new OciLayoutUtils object.

func (BaseOciLayoutUtils) CheckManifestSignature added in v1.4.2

func (olu BaseOciLayoutUtils) CheckManifestSignature(name string, digest godigest.Digest) bool

checks if manifest is signed or not checks for notary or cosign signature if cosign signature found it does not looks for notary signature.

func (BaseOciLayoutUtils) GetExpandedRepoInfo added in v1.4.2

func (olu BaseOciLayoutUtils) GetExpandedRepoInfo(name string) (RepoInfo, error)

func (BaseOciLayoutUtils) GetImageBlobManifest added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageBlobManifest(repo string, digest godigest.Digest) (ispec.Manifest, error)

func (BaseOciLayoutUtils) GetImageConfigInfo added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageConfigInfo(repo string, manifestDigest godigest.Digest) (ispec.Image, error)

func (BaseOciLayoutUtils) GetImageConfigSize added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageConfigSize(repo string, manifestDigest godigest.Digest) int64

func (BaseOciLayoutUtils) GetImageInfo added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageInfo(repo string, digest godigest.Digest) (ispec.Image, error)

func (BaseOciLayoutUtils) GetImageManifest added in v1.4.3

func (olu BaseOciLayoutUtils) GetImageManifest(repo string, reference string) (ispec.Manifest, godigest.Digest, error)

func (BaseOciLayoutUtils) GetImageManifestSize added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageManifestSize(repo string, manifestDigest godigest.Digest) int64

func (BaseOciLayoutUtils) GetImageManifests added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageManifests(repo string) ([]ispec.Descriptor, error)

Below method will return image path including root dir, root dir is determined by splitting.

func (BaseOciLayoutUtils) GetImagePlatform added in v1.4.2

func (olu BaseOciLayoutUtils) GetImagePlatform(imageConfig ispec.Image) (
	string, string,
)

func (BaseOciLayoutUtils) GetImageTagsWithTimestamp added in v1.4.2

func (olu BaseOciLayoutUtils) GetImageTagsWithTimestamp(repo string) ([]TagInfo, error)

GetImageTagsWithTimestamp returns a list of image tags with timestamp available in the specified repository.

func (BaseOciLayoutUtils) GetRepoLastUpdated added in v1.4.2

func (olu BaseOciLayoutUtils) GetRepoLastUpdated(repo string) (TagInfo, error)

func (BaseOciLayoutUtils) GetRepositories added in v1.4.3

func (olu BaseOciLayoutUtils) GetRepositories() ([]string, error)

Provide a list of repositories from all the available image stores.

type HistoryDescription added in v1.4.3

type HistoryDescription struct {
	Created    time.Time `json:"created"`
	CreatedBy  string    `json:"createdBy"`
	Author     string    `json:"author"`
	Comment    string    `json:"comment"`
	EmptyLayer bool      `json:"emptyLayer"`
}

type ImageAnnotations added in v1.4.3

type ImageAnnotations struct {
	Description   string
	Licenses      string
	Title         string
	Documentation string
	Source        string
	Labels        string
	Vendor        string
	Authors       string
}

func GetAnnotations added in v1.4.3

func GetAnnotations(annotations, labels map[string]string) ImageAnnotations

type ImageSummary added in v1.4.3

type ImageSummary struct {
	RepoName        string                    `json:"repoName"`
	Tag             string                    `json:"tag"`
	Digest          string                    `json:"digest"`
	ConfigDigest    string                    `json:"configDigest"`
	LastUpdated     time.Time                 `json:"lastUpdated"`
	IsSigned        bool                      `json:"isSigned"`
	Size            string                    `json:"size"`
	Platform        OsArch                    `json:"platform"`
	Vendor          string                    `json:"vendor"`
	Score           int                       `json:"score"`
	DownloadCount   int                       `json:"downloadCount"`
	Description     string                    `json:"description"`
	Licenses        string                    `json:"licenses"`
	Labels          string                    `json:"labels"`
	Title           string                    `json:"title"`
	Source          string                    `json:"source"`
	Documentation   string                    `json:"documentation"`
	History         []LayerHistory            `json:"history"`
	Layers          []LayerSummary            `json:"layers"`
	Vulnerabilities ImageVulnerabilitySummary `json:"vulnerabilities"`
	Authors         string                    `json:"authors"`
}

type ImageVulnerabilitySummary added in v1.4.3

type ImageVulnerabilitySummary struct {
	MaxSeverity string `json:"maxSeverity"`
	Count       int    `json:"count"`
}

type LayerHistory added in v1.4.3

type LayerHistory struct {
	Layer              LayerSummary       `json:"layer"`
	HistoryDescription HistoryDescription `json:"historyDescription"`
}

type LayerSummary added in v1.4.3

type LayerSummary struct {
	Size   string `json:"size"`
	Digest string `json:"digest"`
	Score  int    `json:"score"`
}

type OciLayoutUtils

type OciLayoutUtils interface {
	GetImageManifest(repo string, reference string) (ispec.Manifest, godigest.Digest, error)
	GetImageManifests(repo string) ([]ispec.Descriptor, error)
	GetImageBlobManifest(repo string, digest godigest.Digest) (ispec.Manifest, error)
	GetImageInfo(repo string, digest godigest.Digest) (ispec.Image, error)
	GetImageTagsWithTimestamp(repo string) ([]TagInfo, error)
	GetImagePlatform(imageInfo ispec.Image) (string, string)
	GetImageManifestSize(repo string, manifestDigest godigest.Digest) int64
	GetRepoLastUpdated(repo string) (TagInfo, error)
	GetExpandedRepoInfo(name string) (RepoInfo, error)
	GetImageConfigInfo(repo string, manifestDigest godigest.Digest) (ispec.Image, error)
	CheckManifestSignature(name string, digest godigest.Digest) bool
	GetRepositories() ([]string, error)
}

type OsArch added in v1.4.2

type OsArch struct {
	Os   string `json:"os"`
	Arch string `json:"arch"`
}

type Referrer added in v1.4.3

type Referrer struct {
	MediaType    string       `json:"mediatype"`
	ArtifactType string       `json:"artifacttype"`
	Size         int          `json:"size"`
	Digest       string       `json:"digest"`
	Annotations  []Annotation `json:"annotations"`
}

type RepoInfo added in v1.3.8

type RepoInfo struct {
	Summary        RepoSummary
	ImageSummaries []ImageSummary `json:"images"`
}

type RepoSummary added in v1.4.2

type RepoSummary struct {
	Name        string       `json:"name"`
	LastUpdated time.Time    `json:"lastUpdated"`
	Size        string       `json:"size"`
	Platforms   []OsArch     `json:"platforms"`
	Vendors     []string     `json:"vendors"`
	Score       int          `json:"score"`
	NewestImage ImageSummary `json:"newestImage"`
}

type TagInfo

type TagInfo struct {
	Name      string
	Digest    godigest.Digest
	Timestamp time.Time
}

func GetFixedTags

func GetFixedTags(allTags, vulnerableTags []TagInfo) []TagInfo

func GetLatestTag

func GetLatestTag(allTags []TagInfo) TagInfo

Jump to

Keyboard shortcuts

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