Documentation ¶
Overview ¶
Package mutate provides facilities for mutating v1.Images of any kind.
Index ¶
- func Append(base v1.Image, adds ...Addendum) (v1.Image, error)
- func AppendLayers(base v1.Image, layers ...v1.Layer) (v1.Image, error)
- func AppendManifests(base v1.ImageIndex, adds ...IndexAddendum) v1.ImageIndex
- func Canonical(img v1.Image) (v1.Image, error)
- func Config(base v1.Image, cfg v1.Config) (v1.Image, error)
- func ConfigFile(base v1.Image, cfg *v1.ConfigFile) (v1.Image, error)
- func ConfigMediaType(img v1.Image, mt types.MediaType) v1.Image
- func CreatedAt(base v1.Image, created v1.Time) (v1.Image, error)
- func Extract(img v1.Image) io.ReadCloser
- func IndexMediaType(idx v1.ImageIndex, mt types.MediaType) v1.ImageIndex
- func MediaType(img v1.Image, mt types.MediaType) v1.Image
- func Rebase(orig, oldBase, newBase v1.Image) (v1.Image, error)
- func RemoveManifests(base v1.ImageIndex, matcher match.Matcher) v1.ImageIndex
- func Time(img v1.Image, t time.Time) (v1.Image, error)
- type Addendum
- type Annotatable
- type Appendable
- type IndexAddendum
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendLayers ¶
AppendLayers applies layers to a base image.
func AppendManifests ¶
func AppendManifests(base v1.ImageIndex, adds ...IndexAddendum) v1.ImageIndex
AppendManifests appends a manifest to the ImageIndex.
func Canonical ¶
Canonical is a helper function to combine Time and configFile to remove any randomness during a docker build.
func ConfigFile ¶
ConfigFile mutates the provided v1.Image to have the provided v1.ConfigFile
func ConfigMediaType ¶
ConfigMediaType modifies the MediaType() of the given image's Config.
func Extract ¶
func Extract(img v1.Image) io.ReadCloser
Extract takes an image and returns an io.ReadCloser containing the image's flattened filesystem.
Callers can read the filesystem contents by passing the reader to tar.NewReader, or io.Copy it directly to some output.
If a caller doesn't read the full contents, they should Close it to free up resources used during extraction.
func IndexMediaType ¶
func IndexMediaType(idx v1.ImageIndex, mt types.MediaType) v1.ImageIndex
IndexMediaType modifies the MediaType() of the given index.
func RemoveManifests ¶
func RemoveManifests(base v1.ImageIndex, matcher match.Matcher) v1.ImageIndex
RemoveManifests removes any descriptors that match the match.Matcher.
Types ¶
type Addendum ¶
type Addendum struct { Layer v1.Layer History v1.History URLs []string Annotations map[string]string MediaType types.MediaType }
Addendum contains layers and history to be appended to a base image
type Annotatable ¶
type Annotatable interface { partial.WithRawManifest }
Annotatable represents a manifest that can carry annotations.
func Annotations ¶
func Annotations(f Annotatable, anns map[string]string) Annotatable
Annotations mutates the annotations on an annotatable image or index manifest.
The annotatable input is expected to be a v1.Image or v1.ImageIndex, and returns the same type. You can type-assert the result like so:
img := Annotations(empty.Image, map[string]string{ "foo": "bar", }).(v1.Image)
Or for an index:
idx := Annotations(empty.Index, map[string]string{ "foo": "bar", }).(v1.ImageIndex)
If the input Annotatable is not an Image or ImageIndex, the result will attempt to lazily annotate the raw manifest.
type Appendable ¶
type Appendable interface { MediaType() (types.MediaType, error) Digest() (v1.Hash, error) Size() (int64, error) }
Appendable is an interface that represents something that can be appended to an ImageIndex. We need to be able to construct a v1.Descriptor in order to append something, and this is the minimum required information for that.
type IndexAddendum ¶
type IndexAddendum struct { Add Appendable v1.Descriptor }
IndexAddendum represents an appendable thing and all the properties that we may want to override in the resulting v1.Descriptor.