schema

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ThinManifestDepth specifies the number of items in a path if we split the
	// path into its parts, starting from the "topmost" folder given as an
	// argument to -thin-manifest-dir. E.g., a well-formed path is something
	// like:
	//
	//  ["", "manifests", "foo", "promoter-manifests.yaml"]
	//
	// . This is a result of some path handling/parsing logic in
	// ValidateThinManifestDirectoryStructure().
	ThinManifestDepth = 4
)

Variables

This section is empty.

Functions

func ParseImagesFromFile

func ParseImagesFromFile(filePath string) (registry.Images, error)

ParseImagesFromFile parses an Images type from a file.

func ParseImagesYAML

func ParseImagesYAML(b []byte) (registry.Images, error)

ParseImagesYAML parses Images from a byteslice.

func ValidateDigest

func ValidateDigest(digest image.Digest) error

ValidateDigest validates the digest.

func ValidateTag

func ValidateTag(tag image.Tag) error

ValidateTag validates the tag.

func ValidateThinManifestDirectoryStructure

func ValidateThinManifestDirectoryStructure(
	dir string,
) error

ValidateThinManifestDirectoryStructure enforces a particular directory structure for thin manifests. Most importantly, it requires that if a file named "foo/manifests/bar/promoter-manifest.yaml" exists, that a corresponding file named "foo/images/bar/promoter-manifest.yaml" must also exist.

Types

type Manifest

type Manifest struct {
	// Registries contains the source and destination (Src/Dest) registry names.
	// There must be at least 2 registries: 1 source registry and 1 or more
	// destination registries.
	Registries []registry.Context `yaml:"registries,omitempty"`
	Images     []registry.Image   `yaml:"images,omitempty"`

	// Hidden fields; these are data structure optimizations that are populated
	// from the fields above. As they are redundant, there is no point in
	// storing this information in YAML.
	SrcRegistry *registry.Context
	Filepath    string
}

Manifest stores the information in a manifest file (describing the desired state of a Docker Registry).

func ParseManifestFromFile

func ParseManifestFromFile(filePath string) (Manifest, error)

ParseManifestFromFile parses a Manifest from a filepath.

func ParseManifestYAML

func ParseManifestYAML(b []byte) (Manifest, error)

ParseManifestYAML parses a Manifest from a byteslice. This function is separate from ParseManifestFromFile() so that it can be tested independently.

func ParseThinManifestFromFile

func ParseThinManifestFromFile(filePath string, digestsToCheck []string) (Manifest, error)

ParseThinManifestFromFile parses a ThinManifest from a filepath and generates a Manifest.

func ParseThinManifestsFromDir

func ParseThinManifestsFromDir(
	dir string, onlyProwDiff bool,
) (mfests []Manifest, err error)

ParseThinManifestsFromDir parses all thin Manifest files within a directory. We effectively have to create a map of manifests, keyed by the source registry (there can only be 1 source registry).

func (*Manifest) Finalize

func (m *Manifest) Finalize() error

Finalize finalizes a Manifest by populating extra fields.

func (*Manifest) ToRegInvImage

func (m *Manifest) ToRegInvImage() registry.RegInvImage

ToRegInvImage converts a Manifest into a RegInvImage.

func (Manifest) Validate

func (m Manifest) Validate() error

Validate checks for semantic errors in the yaml fields (the structure of the yaml is checked during unmarshaling).

type ThinManifest

type ThinManifest struct {
	Registries []registry.Context `yaml:"registries,omitempty"`

	ImagesPath string `yaml:"imagesPath,omitempty"`
}

ThinManifest is a more secure Manifest because it does not define the Images[] directly, but moves it to a separate location. The idea is to define a ThinManifest type as a YAML in one folder, and to define the []Image in another folder, and to have far stricter ACLs for the ThinManifest type. Then, PRs modifying just the []Image YAML won't be able to modify the src/destination repos or the credentials tied to them.

func ParseThinManifestYAML

func ParseThinManifestYAML(b []byte) (ThinManifest, error)

ParseThinManifestYAML parses a ThinManifest from a byteslice.

Jump to

Keyboard shortcuts

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