commands

package
v0.0.0-...-ced0851 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

used for testing in the commands package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArg

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

Types

type AbstractCopyCommand

type AbstractCopyCommand interface {
	From() string
}

AbstractCopyCommand can either be a CopyCommand or a CachingCopyCommand.

func CastAbstractCopyCommand

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

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

func (*AddCommand) MetadataOnly

func (a *AddCommand) MetadataOnly() bool

func (*AddCommand) RequiresUnpackedFS

func (a *AddCommand) RequiresUnpackedFS() bool

func (*AddCommand) String

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

func (r *ArgCommand) String() string

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

type BaseCommand

type BaseCommand struct {
}

func (*BaseCommand) CacheCommand

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

func (*BaseCommand) FilesToSnapshot

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

func (*BaseCommand) FilesUsedFromContext

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

func (*BaseCommand) IsArgsEnvsRequiredInCache

func (b *BaseCommand) IsArgsEnvsRequiredInCache() bool

func (*BaseCommand) MetadataOnly

func (b *BaseCommand) MetadataOnly() bool

func (*BaseCommand) ProvidesFilesToSnapshot

func (b *BaseCommand) ProvidesFilesToSnapshot() bool

func (*BaseCommand) RequiresUnpackedFS

func (b *BaseCommand) RequiresUnpackedFS() bool

func (*BaseCommand) ShouldCacheOutput

func (b *BaseCommand) ShouldCacheOutput() bool

func (*BaseCommand) ShouldDetectDeletedFiles

func (b *BaseCommand) ShouldDetectDeletedFiles() bool

type Cached

type Cached interface {
	Layer() v1.Layer
}

type CachingCopyCommand

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

func (*CachingCopyCommand) ExecuteCommand

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

func (*CachingCopyCommand) FilesToSnapshot

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

func (*CachingCopyCommand) FilesUsedFromContext

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

func (*CachingCopyCommand) From

func (cr *CachingCopyCommand) From() string

func (CachingCopyCommand) Layer

func (c CachingCopyCommand) Layer() v1.Layer

func (*CachingCopyCommand) MetadataOnly

func (cr *CachingCopyCommand) MetadataOnly() bool

func (*CachingCopyCommand) String

func (cr *CachingCopyCommand) String() string

type CachingRunCommand

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

func (*CachingRunCommand) ExecuteCommand

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

func (*CachingRunCommand) FilesToSnapshot

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

func (*CachingRunCommand) IsArgsEnvsRequiredInCache

func (cr *CachingRunCommand) IsArgsEnvsRequiredInCache() bool

func (CachingRunCommand) Layer

func (c CachingRunCommand) Layer() v1.Layer

func (*CachingRunCommand) MetadataOnly

func (cr *CachingRunCommand) MetadataOnly() bool

func (*CachingRunCommand) String

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

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

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

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

func (*CopyCommand) From

func (c *CopyCommand) From() string

func (*CopyCommand) MetadataOnly

func (c *CopyCommand) MetadataOnly() bool

func (*CopyCommand) RequiresUnpackedFS

func (c *CopyCommand) RequiresUnpackedFS() bool

func (*CopyCommand) ShouldCacheOutput

func (c *CopyCommand) ShouldCacheOutput() bool

func (*CopyCommand) String

func (c *CopyCommand) String() string

String returns some information about the command for the image config

type CurrentCacheKey

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

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

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

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

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

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

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

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

func (r *RunCommand) IsArgsEnvsRequiredInCache() bool

func (*RunCommand) MetadataOnly

func (r *RunCommand) MetadataOnly() bool

func (*RunCommand) ProvidesFilesToSnapshot

func (r *RunCommand) ProvidesFilesToSnapshot() bool

func (*RunCommand) RequiresUnpackedFS

func (r *RunCommand) RequiresUnpackedFS() bool

func (*RunCommand) ShouldCacheOutput

func (r *RunCommand) ShouldCacheOutput() bool

func (*RunCommand) String

func (r *RunCommand) String() string

String returns some information about the command for the image config

type RunMarkerCommand

type RunMarkerCommand struct {
	BaseCommand

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

func (*RunMarkerCommand) CacheCommand

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

CacheCommand returns true since this command should be cached

func (*RunMarkerCommand) ExecuteCommand

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

func (*RunMarkerCommand) FilesToSnapshot

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

func (*RunMarkerCommand) IsArgsEnvsRequiredInCache

func (r *RunMarkerCommand) IsArgsEnvsRequiredInCache() bool

func (*RunMarkerCommand) MetadataOnly

func (r *RunMarkerCommand) MetadataOnly() bool

func (*RunMarkerCommand) ProvidesFilesToSnapshot

func (r *RunMarkerCommand) ProvidesFilesToSnapshot() bool

func (*RunMarkerCommand) RequiresUnpackedFS

func (r *RunMarkerCommand) RequiresUnpackedFS() bool

func (*RunMarkerCommand) ShouldCacheOutput

func (r *RunMarkerCommand) ShouldCacheOutput() bool

func (*RunMarkerCommand) ShouldDetectDeletedFiles

func (r *RunMarkerCommand) ShouldDetectDeletedFiles() bool

func (*RunMarkerCommand) String

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

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

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

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

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

func (w *WorkdirCommand) MetadataOnly() bool

func (*WorkdirCommand) String

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