commands

package
v1.25.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

used for testing in the commands package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArg added in v0.10.0

func ParseArg(key string, val *string, env []string, ba *dockerfile.BuildArgs) (string, *string, error)

Types

type AbstractCopyCommand added in v1.25.0

type AbstractCopyCommand interface {
	From() string
}

AbstractCopyCommand can either be a CopyCommand or a CachingCopyCommand.

func CastAbstractCopyCommand added in v1.25.0

func CastAbstractCopyCommand(cmd interface{}) (AbstractCopyCommand, bool)

CastAbstractCopyCommand tries to convert a command to an AbstractCopyCommand.

type AddCommand

type AddCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*AddCommand) ExecuteCommand

func (a *AddCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand executes the ADD command Special stuff about ADD:

  1. If <src> is a remote file URL: - destination will have permissions of 0600 - If remote file has HTTP Last-Modified header, we set the mtime of the file to that timestamp - If dest doesn't end with a slash, the filepath is inferred to be <dest>/<filename>
  2. If <src> is a local tar archive: - it is unpacked at the dest, as 'tar -x' would

func (*AddCommand) FilesToSnapshot

func (a *AddCommand) FilesToSnapshot() []string

FilesToSnapshot should return an empty array if still nil; no files were changed

func (*AddCommand) FilesUsedFromContext added in v0.5.0

func (a *AddCommand) FilesUsedFromContext(config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)

func (*AddCommand) MetadataOnly added in v0.7.0

func (a *AddCommand) MetadataOnly() bool

func (*AddCommand) RequiresUnpackedFS added in v0.15.0

func (a *AddCommand) RequiresUnpackedFS() bool

func (*AddCommand) String added in v0.4.0

func (a *AddCommand) String() string

String returns some information about the command for the image config

type ArgCommand

type ArgCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*ArgCommand) ExecuteCommand

func (r *ArgCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand only needs to add this ARG key/value as seen

func (*ArgCommand) String added in v0.4.0

func (r *ArgCommand) String() string

String returns some information about the command for the image config history

type BaseCommand added in v0.5.0

type BaseCommand struct {
}

func (*BaseCommand) CacheCommand added in v0.5.0

func (b *BaseCommand) CacheCommand(v1.Image) DockerCommand

func (*BaseCommand) FilesToSnapshot added in v0.5.0

func (b *BaseCommand) FilesToSnapshot() []string

func (*BaseCommand) FilesUsedFromContext added in v0.5.0

func (b *BaseCommand) FilesUsedFromContext(_ *v1.Config, _ *dockerfile.BuildArgs) ([]string, error)

func (*BaseCommand) IsArgsEnvsRequiredInCache added in v1.25.0

func (b *BaseCommand) IsArgsEnvsRequiredInCache() bool

func (*BaseCommand) MetadataOnly added in v0.7.0

func (b *BaseCommand) MetadataOnly() bool

func (*BaseCommand) ProvidesFilesToSnapshot added in v1.25.0

func (b *BaseCommand) ProvidesFilesToSnapshot() bool

func (*BaseCommand) RequiresUnpackedFS added in v0.7.0

func (b *BaseCommand) RequiresUnpackedFS() bool

func (*BaseCommand) ShouldCacheOutput added in v0.7.0

func (b *BaseCommand) ShouldCacheOutput() bool

func (*BaseCommand) ShouldDetectDeletedFiles added in v1.25.0

func (b *BaseCommand) ShouldDetectDeletedFiles() bool

type Cached added in v1.25.0

type Cached interface {
	Layer() v1.Layer
}

type CachingCopyCommand added in v0.14.0

type CachingCopyCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*CachingCopyCommand) ExecuteCommand added in v0.14.0

func (cr *CachingCopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*CachingCopyCommand) FilesToSnapshot added in v0.14.0

func (cr *CachingCopyCommand) FilesToSnapshot() []string

func (*CachingCopyCommand) FilesUsedFromContext added in v0.15.0

func (cr *CachingCopyCommand) FilesUsedFromContext(config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)

func (*CachingCopyCommand) From added in v0.15.0

func (cr *CachingCopyCommand) From() string

func (CachingCopyCommand) Layer added in v1.25.0

func (c CachingCopyCommand) Layer() v1.Layer

func (*CachingCopyCommand) MetadataOnly added in v1.25.0

func (cr *CachingCopyCommand) MetadataOnly() bool

func (*CachingCopyCommand) String added in v0.14.0

func (cr *CachingCopyCommand) String() string

type CachingRunCommand added in v0.6.0

type CachingRunCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*CachingRunCommand) ExecuteCommand added in v0.6.0

func (cr *CachingRunCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*CachingRunCommand) FilesToSnapshot added in v0.6.0

func (cr *CachingRunCommand) FilesToSnapshot() []string

func (*CachingRunCommand) IsArgsEnvsRequiredInCache added in v1.25.0

func (cr *CachingRunCommand) IsArgsEnvsRequiredInCache() bool

func (CachingRunCommand) Layer added in v1.25.0

func (c CachingRunCommand) Layer() v1.Layer

func (*CachingRunCommand) MetadataOnly added in v1.25.0

func (cr *CachingRunCommand) MetadataOnly() bool

func (*CachingRunCommand) String added in v0.6.0

func (cr *CachingRunCommand) String() string

type CmdCommand

type CmdCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*CmdCommand) ExecuteCommand

func (c *CmdCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand executes the CMD command Argument handling is the same as RUN.

func (*CmdCommand) String added in v0.4.0

func (c *CmdCommand) String() string

String returns some information about the command for the image config history

type CopyCommand

type CopyCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*CopyCommand) CacheCommand added in v0.4.0

func (c *CopyCommand) CacheCommand(img v1.Image) DockerCommand

CacheCommand returns true since this command should be cached

func (*CopyCommand) ExecuteCommand

func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*CopyCommand) FilesToSnapshot

func (c *CopyCommand) FilesToSnapshot() []string

FilesToSnapshot should return an empty array if still nil; no files were changed

func (*CopyCommand) FilesUsedFromContext added in v0.5.0

func (c *CopyCommand) FilesUsedFromContext(config *v1.Config, buildArgs *dockerfile.BuildArgs) ([]string, error)

func (*CopyCommand) From added in v0.15.0

func (c *CopyCommand) From() string

func (*CopyCommand) MetadataOnly added in v0.7.0

func (c *CopyCommand) MetadataOnly() bool

func (*CopyCommand) RequiresUnpackedFS added in v0.14.0

func (c *CopyCommand) RequiresUnpackedFS() bool

func (*CopyCommand) ShouldCacheOutput added in v0.14.0

func (c *CopyCommand) ShouldCacheOutput() bool

func (*CopyCommand) String added in v0.4.0

func (c *CopyCommand) String() string

String returns some information about the command for the image config

type CurrentCacheKey added in v0.6.0

type CurrentCacheKey func() (string, error)

type DockerCommand

type DockerCommand interface {
	// ExecuteCommand is responsible for:
	// 	1. Making required changes to the filesystem (ex. copying files for ADD/COPY or setting ENV variables)
	//  2. Updating metadata fields in the config
	// It should not change the config history.
	ExecuteCommand(*v1.Config, *dockerfile.BuildArgs) error
	// Returns a string representation of the command
	String() string
	// A list of files to snapshot, empty for metadata commands or nil if we don't know
	FilesToSnapshot() []string

	// ProvidesFileToSnapshot is true for all metadata commands and commands which know
	// list of files changed. False for Run command.
	ProvidesFilesToSnapshot() bool

	// Return a cache-aware implementation of this command, if it exists.
	CacheCommand(v1.Image) DockerCommand

	// Return true if this command depends on the build context.
	FilesUsedFromContext(*v1.Config, *dockerfile.BuildArgs) ([]string, error)

	MetadataOnly() bool

	RequiresUnpackedFS() bool

	// Whether the output layer of this command should be cached in and
	// retrieved from the layer cache.
	ShouldCacheOutput() bool

	// ShouldDetectDeletedFiles returns true if the command could delete files.
	ShouldDetectDeletedFiles() bool

	// True if need add ARGs and EVNs to composite cache string with resolved command
	// need only for RUN instruction
	IsArgsEnvsRequiredInCache() bool
}

func GetCommand

func GetCommand(cmd instructions.Command, fileContext util.FileContext, useNewRun bool, cacheCopy bool, cacheRun bool) (DockerCommand, error)

type EntrypointCommand

type EntrypointCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*EntrypointCommand) ExecuteCommand

func (e *EntrypointCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*EntrypointCommand) String added in v0.4.0

func (e *EntrypointCommand) String() string

String returns some information about the command for the image config history

type EnvCommand

type EnvCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*EnvCommand) ExecuteCommand

func (e *EnvCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*EnvCommand) String added in v0.4.0

func (e *EnvCommand) String() string

String returns some information about the command for the image config history

type ExposeCommand

type ExposeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*ExposeCommand) ExecuteCommand

func (r *ExposeCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*ExposeCommand) String added in v0.4.0

func (r *ExposeCommand) String() string

type HealthCheckCommand

type HealthCheckCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*HealthCheckCommand) ExecuteCommand

func (h *HealthCheckCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*HealthCheckCommand) String added in v0.4.0

func (h *HealthCheckCommand) String() string

String returns some information about the command for the image config history

type LabelCommand

type LabelCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*LabelCommand) ExecuteCommand

func (r *LabelCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*LabelCommand) String added in v0.4.0

func (r *LabelCommand) String() string

String returns some information about the command for the image config history

type OnBuildCommand

type OnBuildCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*OnBuildCommand) ExecuteCommand

func (o *OnBuildCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand adds the specified expression in Onbuild to the config

func (*OnBuildCommand) String added in v0.4.0

func (o *OnBuildCommand) String() string

String returns some information about the command for the image config history

type RunCommand

type RunCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*RunCommand) CacheCommand added in v0.4.0

func (r *RunCommand) CacheCommand(img v1.Image) DockerCommand

CacheCommand returns true since this command should be cached

func (*RunCommand) ExecuteCommand

func (r *RunCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*RunCommand) FilesToSnapshot

func (r *RunCommand) FilesToSnapshot() []string

func (*RunCommand) IsArgsEnvsRequiredInCache added in v1.25.0

func (r *RunCommand) IsArgsEnvsRequiredInCache() bool

func (*RunCommand) MetadataOnly added in v0.7.0

func (r *RunCommand) MetadataOnly() bool

func (*RunCommand) ProvidesFilesToSnapshot added in v1.25.0

func (r *RunCommand) ProvidesFilesToSnapshot() bool

func (*RunCommand) RequiresUnpackedFS added in v0.7.0

func (r *RunCommand) RequiresUnpackedFS() bool

func (*RunCommand) ShouldCacheOutput added in v0.7.0

func (r *RunCommand) ShouldCacheOutput() bool

func (*RunCommand) String added in v0.4.0

func (r *RunCommand) String() string

String returns some information about the command for the image config

type RunMarkerCommand added in v1.25.0

type RunMarkerCommand struct {
	BaseCommand

	Files []string
	// contains filtered or unexported fields
}

func (*RunMarkerCommand) CacheCommand added in v1.25.0

func (r *RunMarkerCommand) CacheCommand(img v1.Image) DockerCommand

CacheCommand returns true since this command should be cached

func (*RunMarkerCommand) ExecuteCommand added in v1.25.0

func (r *RunMarkerCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*RunMarkerCommand) FilesToSnapshot added in v1.25.0

func (r *RunMarkerCommand) FilesToSnapshot() []string

func (*RunMarkerCommand) IsArgsEnvsRequiredInCache added in v1.25.0

func (r *RunMarkerCommand) IsArgsEnvsRequiredInCache() bool

func (*RunMarkerCommand) MetadataOnly added in v1.25.0

func (r *RunMarkerCommand) MetadataOnly() bool

func (*RunMarkerCommand) ProvidesFilesToSnapshot added in v1.25.0

func (r *RunMarkerCommand) ProvidesFilesToSnapshot() bool

func (*RunMarkerCommand) RequiresUnpackedFS added in v1.25.0

func (r *RunMarkerCommand) RequiresUnpackedFS() bool

func (*RunMarkerCommand) ShouldCacheOutput added in v1.25.0

func (r *RunMarkerCommand) ShouldCacheOutput() bool

func (*RunMarkerCommand) ShouldDetectDeletedFiles added in v1.25.0

func (r *RunMarkerCommand) ShouldDetectDeletedFiles() bool

func (*RunMarkerCommand) String added in v1.25.0

func (r *RunMarkerCommand) String() string

String returns some information about the command for the image config

type ShellCommand

type ShellCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*ShellCommand) ExecuteCommand

func (s *ShellCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*ShellCommand) String added in v0.4.0

func (s *ShellCommand) String() string

String returns some information about the command for the image config history

type StopSignalCommand

type StopSignalCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*StopSignalCommand) ExecuteCommand

func (s *StopSignalCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

ExecuteCommand handles command processing similar to CMD and RUN,

func (*StopSignalCommand) String added in v0.4.0

func (s *StopSignalCommand) String() string

String returns some information about the command for the image config history

type UserCommand

type UserCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*UserCommand) ExecuteCommand

func (r *UserCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*UserCommand) String added in v0.4.0

func (r *UserCommand) String() string

type VolumeCommand

type VolumeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*VolumeCommand) ExecuteCommand

func (v *VolumeCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*VolumeCommand) FilesToSnapshot

func (v *VolumeCommand) FilesToSnapshot() []string

func (*VolumeCommand) String added in v0.4.0

func (v *VolumeCommand) String() string

type WorkdirCommand

type WorkdirCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*WorkdirCommand) ExecuteCommand

func (w *WorkdirCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.BuildArgs) error

func (*WorkdirCommand) FilesToSnapshot

func (w *WorkdirCommand) FilesToSnapshot() []string

FilesToSnapshot returns the workingdir, which should have been created if it didn't already exist

func (*WorkdirCommand) MetadataOnly added in v0.7.0

func (w *WorkdirCommand) MetadataOnly() bool

func (*WorkdirCommand) String added in v0.4.0

func (w *WorkdirCommand) String() string

String returns some information about the command for the image config history

Jump to

Keyboard shortcuts

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