images

package
v0.0.0-...-493bf59 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 36 Imported by: 5

Documentation

Index

Constants

View Source
const (
	InvalidImageName             = "Invalid image name"
	IncorrectNamespace           = "Incorrect namespace for your environment"
	IncorrectRegistryOrNamespace = "Incorrect registry or namespace for your environment"
	MissingTrustData             = "does not have trust data for"
	ImageDoesNotExist            = "No such image"
	CancelingPush                = "Canceling push request"

	CanonicalTargetsRole = "targets"
)

Errors for image handling

View Source
const (
	DefaultTag = "latest"
)

Constants for image handling

Variables

This section is empty.

Functions

This section is empty.

Types

type AuxData

type AuxData struct {
	Tag    string `json:"Tag"`
	Digest string `json:"Digest"`
	Size   int64  `json:"Size"`
}

AuxData contains metadata about the content that was pushed

type IImages

type IImages interface {
	ListImages() (*[]string, error)
	ListTags(imageName string) (*[]string, error)
	DeleteTag(imageName, tagName string) error
	Push(name string, user *models.User, env *models.Environment, ip prompts.IPrompts) (*models.Image, error)
	Pull(name string, target *Target, user *models.User, env *models.Environment) error
	InitNotaryRepo(repo notaryClient.Repository, rootKeyPath string) error
	AddTargetHash(repo notaryClient.Repository, digest *models.ContentDigest, tag string, publish bool) error
	ListTargets(repo notaryClient.Repository, roles ...string) ([]*Target, error)
	LookupTarget(repo notaryClient.Repository, tag string) (*Target, error)
	DeleteTargets(repo notaryClient.Repository, tags []string, publish bool) error
	PrintChangelist(changes []changelist.Change)
	CheckChangelist(repo notaryClient.Repository, ip prompts.IPrompts) error
	GetNotaryRepository(pod, imageName string, user *models.User) notaryClient.Repository
	GetGloballyUniqueNamespace(name string, env *models.Environment, includeRegistry bool) (string, string, error)
	Publish(repo notaryClient.Repository) error
}

IImages describes container-image-related functionality

func New

func New(settings *models.Settings) IImages

New constructs an implementation of IImages

type SImages

type SImages struct {
	Settings *models.Settings
}

SImages is a concrete implementation of IImages

func (*SImages) AddTargetHash

func (d *SImages) AddTargetHash(repo notaryClient.Repository, digest *models.ContentDigest, tag string, publish bool) error

AddTargetHash adds the given content hash to a notary repo and sends a signing request to the server

func (*SImages) CheckChangelist

func (d *SImages) CheckChangelist(repo notaryClient.Repository, ip prompts.IPrompts) error

CheckChangelist prompts the user if they have unpublished changes to let them clear

undesired changes before publishing, or verify that the changes should be published

func (*SImages) DeleteTag

func (d *SImages) DeleteTag(imageName, tagName string) error

DeleteTag deletes a tag for an image.

func (*SImages) DeleteTargets

func (d *SImages) DeleteTargets(repo notaryClient.Repository, tags []string, publish bool) error

DeleteTargets deletes the signed targets for a list of tags

func (*SImages) GetGloballyUniqueNamespace

func (d *SImages) GetGloballyUniqueNamespace(name string, env *models.Environment, includeRegistry bool) (string, string, error)

GetGloballyUniqueNamespace returns the fully formatted name for an image <registry>/<namespace>/<image> and a tag if present

func (*SImages) GetNotaryRepository

func (d *SImages) GetNotaryRepository(pod, imageName string, user *models.User) notaryClient.Repository

GetNotaryRepository returns a pointer to the notary repository for an image

func (*SImages) InitNotaryRepo

func (d *SImages) InitNotaryRepo(repo notaryClient.Repository, rootKeyPath string) error

InitNotaryRepo intializes a notary repository

func (*SImages) ListImages

func (d *SImages) ListImages() (*[]string, error)

ListImages lists images for an environment.

func (*SImages) ListTags

func (d *SImages) ListTags(imageName string) (*[]string, error)

ListTags lists tags for an image.

func (*SImages) ListTargets

func (d *SImages) ListTargets(repo notaryClient.Repository, roles ...string) ([]*Target, error)

ListTargets intializes a notary repository

func (*SImages) LookupTarget

func (d *SImages) LookupTarget(repo notaryClient.Repository, tag string) (*Target, error)

LookupTarget searches for a specific target in a repository by tag name

func (*SImages) PrintChangelist

func (d *SImages) PrintChangelist(changes []changelist.Change)

PrintChangelist prints out the users unpublished changes in a formatted table

func (*SImages) Publish

func (d *SImages) Publish(repo notaryClient.Repository) error

Publish publishes changes to a repo

func (*SImages) Pull

func (d *SImages) Pull(name string, target *Target, user *models.User, env *models.Environment) error

Pull parses a name into registry/namespace/image:tag and attempts to retrieve it from the remote registry

func (*SImages) Push

func (d *SImages) Push(name string, user *models.User, env *models.Environment, ip prompts.IPrompts) (*models.Image, error)

Push parses a given name into registry/namespace/image:tag and attempts to push it to the remote registry

type Target

type Target struct {
	Name   string
	Digest digest.Digest
	Size   int64
	Role   string
}

Target contains metadata about a target

Jump to

Keyboard shortcuts

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