Documentation ¶
Overview ¶
Package mod changes an image according to the requested modifications.
Index ¶
- func Apply(ctx context.Context, rc *regclient.RegClient, rSrc ref.Ref, opts ...Opts) (ref.Ref, error)
- type OptTime
- type Opts
- func WithAnnotation(name, value string) Opts
- func WithAnnotationOCIBase(rBase ref.Ref, dBase digest.Digest) Opts
- func WithAnnotationPromoteCommon() Opts
- func WithBuildArgRm(arg string, value *regexp.Regexp) Opts
- func WithConfigCmd(cmd []string) Opts
- func WithConfigEntrypoint(entrypoint []string) Opts
- func WithConfigPlatform(p platform.Platform) Opts
- func WithConfigTimestamp(optTime OptTime) Opts
- func WithConfigTimestampFromLabel(label string) Optsdeprecated
- func WithConfigTimestampMax(t time.Time) Optsdeprecated
- func WithData(maxDataSize int64) Opts
- func WithExposeAdd(port string) Opts
- func WithExposeRm(port string) Opts
- func WithExternalURLsRm() Opts
- func WithFileTarTime(name string, optTime OptTime) Opts
- func WithFileTarTimeMax(name string, t time.Time) Optsdeprecated
- func WithLabel(name, value string) Opts
- func WithLabelToAnnotation() Opts
- func WithLayerAddTar(rdr io.Reader, mt string, platforms []platform.Platform) Opts
- func WithLayerCompression(algo archive.CompressType) Opts
- func WithLayerReproducible() Opts
- func WithLayerRmCreatedBy(re regexp.Regexp) Opts
- func WithLayerRmIndex(index int) Opts
- func WithLayerStripFile(file string) Opts
- func WithLayerTimestamp(optTime OptTime) Opts
- func WithLayerTimestampFromLabel(label string) Optsdeprecated
- func WithLayerTimestampMax(t time.Time) Optsdeprecated
- func WithManifestToDocker() Opts
- func WithManifestToOCI() Opts
- func WithManifestToOCIReferrers() Opts
- func WithRebase() Opts
- func WithRebaseRefs(rOld, rNew ref.Ref) Opts
- func WithRefTgt(rTgt ref.Ref) Opts
- func WithVolumeAdd(volume string) Opts
- func WithVolumeRm(volume string) Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OptTime ¶ added in v0.5.2
type OptTime struct { Set time.Time // time to set, this or FromLabel are required FromLabel string // label from which to extract set time After time.Time // only change times that are after this BaseRef ref.Ref // define base image, do not alter timestamps from base layers BaseLayers int // define a number of layers to not modify (count of the layers in a base image) }
OptTime defines time settings for WithConfigTimestamp and WithLayerTimestamp.
type Opts ¶
type Opts func(*dagConfig, *dagManifest) error
Opts defines options for Apply
func WithAnnotation ¶
WithAnnotation adds an annotation, or deletes it if the value is set to an empty string. If name is not prefixed with a platform selector, this only applies to the top level manifest. Name may be prefixed with a list of platforms "[p1,p2,...]name", e.g. "[linux/amd64]com.example.field". The platform selector may also be "[*]" to apply to all manifests, including the top level manifest list.
func WithAnnotationOCIBase ¶
WithAnnotationOCIBase adds annotations for the base image.
func WithAnnotationPromoteCommon ¶ added in v0.6.0
func WithAnnotationPromoteCommon() Opts
WithAnnotationPromoteCommon pulls up common annotations from child images to the index.
func WithBuildArgRm ¶ added in v0.4.2
WithBuildArgRm removes a build arg from the config history.
func WithConfigCmd ¶ added in v0.6.0
WithConfigCmd sets the command in the config. For running a shell command, the `cmd` value should be `[]string{"/bin/sh", "-c", command}`.
func WithConfigEntrypoint ¶ added in v0.6.0
WithConfigEntrypoint sets the entrypoint in the config. For running a shell command, the `entrypoint` value should be `[]string{"/bin/sh", "-c", command}`.
func WithConfigPlatform ¶ added in v0.6.0
WithConfigPlatform sets the platform in the config.
func WithConfigTimestamp ¶ added in v0.5.2
WithConfigTimestamp sets the timestamp on the config entries based on options.
func WithConfigTimestampFromLabel
deprecated
WithConfigTimestampFromLabel sets the max timestamp in the config to match a label value.
Deprecated: replace with WithConfigTimestamp.
func WithConfigTimestampMax
deprecated
WithConfigTimestampMax sets the max timestamp on any config objects.
Deprecated: replace with WithConfigTimestamp.
func WithData ¶
WithData sets the descriptor data field max size. This also strips the data field off descriptors above the max size.
func WithExposeAdd ¶
WithExposeAdd defines an exposed port in the image config.
func WithExposeRm ¶
WithExposeRm deletes an exposed from the image config.
func WithExternalURLsRm ¶ added in v0.4.3
func WithExternalURLsRm() Opts
WithExternalURLsRm strips external URLs from descriptors and adjusts media type to match.
func WithFileTarTime ¶ added in v0.5.2
WithFileTarTime processes a tar file within a layer and adjusts the timestamps according to optTime.
func WithFileTarTimeMax
deprecated
added in
v0.4.4
WithFileTarTimeMax processes a tar file within a layer and rewrites the contents with a max timestamp.
Deprecated: replace with WithFileTarTime.
func WithLabelToAnnotation ¶
func WithLabelToAnnotation() Opts
WithLabelToAnnotation copies image config labels to manifest annotations.
func WithLayerAddTar ¶ added in v0.6.1
WithLayerAddTar appends a new layer to the image based on a tar input stream. If media type (mt) is not defined, it will default to Gzip and match Docker or OCI based on the manifest media type. If the platform slice is empty, the layer is added to all platforms.
func WithLayerCompression ¶ added in v0.6.1
func WithLayerCompression(algo archive.CompressType) Opts
WithLayerCompression alters the media type and compression algorithm of the layers.
func WithLayerReproducible ¶ added in v0.5.2
func WithLayerReproducible() Opts
WithLayerReproducible modifies the layer with reproducible options. This currently configures users and groups with numeric ids.
func WithLayerRmCreatedBy ¶
WithLayerRmCreatedBy deletes a layer based on a regex of the created by field in the config history for that layer.
func WithLayerRmIndex ¶
WithLayerRmIndex deletes a layer by index. The index starts at 0.
func WithLayerStripFile ¶
WithLayerStripFile removes a file from within the layer tar.
func WithLayerTimestamp ¶ added in v0.5.2
WithLayerTimestamp sets the timestamp on files in the layers based on options.
func WithLayerTimestampFromLabel
deprecated
WithLayerTimestampFromLabel sets the max layer timestamp based on a label in the image.
Deprecated: replace with WithLayerTimestamp.
func WithLayerTimestampMax
deprecated
WithLayerTimestampMax ensures no file timestamps are after specified time.
Deprecated: replace with WithLayerTimestamp.
func WithManifestToDocker ¶ added in v0.4.8
func WithManifestToDocker() Opts
WithManifestToDocker converts the manifest to Docker schema2 media types.
func WithManifestToOCI ¶
func WithManifestToOCI() Opts
WithManifestToOCI converts the manifest to OCI media types.
func WithManifestToOCIReferrers ¶ added in v0.4.6
func WithManifestToOCIReferrers() Opts
WithManifestToOCIReferrers converts other referrer types to OCI subject/referrers.
func WithRebase ¶ added in v0.4.5
func WithRebase() Opts
WithRebase attempts to rebase the image using OCI annotations identifying the base image.
func WithRebaseRefs ¶ added in v0.4.5
WithRebaseRefs swaps the base image layers from the old to the new reference.
func WithRefTgt ¶ added in v0.5.0
WithRefTgt sets the target manifest. Apply will default to pushing to the same name by digest.
func WithVolumeAdd ¶
WithVolumeAdd defines a volume in the image config.
func WithVolumeRm ¶
WithVolumeRm deletes a volume from the image config.