commands

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 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

View Source
var RootDir string

Functions

func ParseArg added in v0.10.0

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

Types

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) MetadataOnly added in v0.7.0

func (b *BaseCommand) MetadataOnly() 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

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) 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) 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

	// 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

	ShouldCacheOutput() bool
}

func GetCommand

func GetCommand(cmd instructions.Command, buildcontext string) (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) MetadataOnly added in v0.7.0

func (r *RunCommand) MetadataOnly() 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 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