exec

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Package exec is a generated GoMock package.

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Index

Constants

View Source
const (
	LinuxOS   = "linux"
	Amd64Arch = "amd64"
)

Operating systems and architectures.

Variables

View Source
var ErrDockerCommandNotFound = errors.New("docker: command not found")

ErrDockerCommandNotFound means the docker command is not found.

Functions

func ValidatePlatform added in v1.9.0

func ValidatePlatform(platform *string) error

ValidatePlatform checks if the entered string is a Docker-buildable platform.

Types

type BuildArguments

type BuildArguments struct {
	URI        string            // Required. Location of ECR Repo. Used to generate image name in conjunction with tag.
	Tags       []string          // Optional. List of tags to apply to the image besides "latest".
	Dockerfile string            // Required. Dockerfile to pass to `docker build` via --file flag.
	Context    string            // Optional. Build context directory to pass to `docker build`.
	Target     string            // Optional. The target build stage to pass to `docker build`.
	CacheFrom  []string          // Optional. Images to consider as cache sources to pass to `docker build`
	Platform   string            // Optional. OS/Arch to pass to `docker build`.
	Args       map[string]string // Optional. Build args to pass via `--build-arg` flags. Equivalent to ARG directives in dockerfile.
}

BuildArguments holds the arguments we can pass in as flags from the manifest.

type Cmd added in v1.7.0

type Cmd struct {
	// contains filtered or unexported fields
}

Cmd runs external commands, it wraps the exec.Command function from the stdlib so that running external commands can be unit tested.

func NewCmd added in v1.7.0

func NewCmd() *Cmd

NewCmd returns a Cmd that can run external commands. By default the output of the commands is piped to stderr.

func (*Cmd) InteractiveRun added in v1.7.0

func (c *Cmd) InteractiveRun(name string, args []string) error

InteractiveRun runs the input command that starts a child process.

func (*Cmd) Run added in v1.7.0

func (c *Cmd) Run(name string, args []string, opts ...CmdOption) error

Run starts the named command and waits until it finishes.

type CmdOption added in v1.7.0

type CmdOption func(cmd *exec.Cmd)

CmdOption is a type alias to configure a command.

func Stderr added in v1.7.0

func Stderr(writer io.Writer) CmdOption

Stderr sets the internal *exec.Cmd's Stderr field.

func Stdin added in v1.7.0

func Stdin(r io.Reader) CmdOption

Stdin sets the internal *exec.Cmd's Stdin field.

func Stdout added in v1.7.0

func Stdout(writer io.Writer) CmdOption

Stdout sets the internal *exec.Cmd's Stdout field.

type DockerCommand

type DockerCommand struct {
	// contains filtered or unexported fields
}

DockerCommand represents docker commands that can be run.

func NewDockerCommand

func NewDockerCommand() DockerCommand

NewDockerCommand returns a DockerCommand.

func (DockerCommand) Build

func (c DockerCommand) Build(in *BuildArguments) error

Build will run a `docker build` command for the given ecr repo URI and build arguments.

func (DockerCommand) CheckDockerEngineRunning

func (c DockerCommand) CheckDockerEngineRunning() error

CheckDockerEngineRunning will run `docker info` command to check if the docker engine is running.

func (DockerCommand) IsEcrCredentialHelperEnabled added in v1.8.0

func (c DockerCommand) IsEcrCredentialHelperEnabled(uri string) bool

IsEcrCredentialHelperEnabled return true if ecr-login is enabled either globally or registry level

func (DockerCommand) Login

func (c DockerCommand) Login(uri, username, password string) error

Login will run a `docker login` command against the Service repository URI with the input uri and auth data.

func (DockerCommand) Push

func (c DockerCommand) Push(uri string, tags ...string) (digest string, err error)

Push pushes the images with the specified tags and ecr repository URI, and returns the image digest on success.

func (DockerCommand) RedirectPlatform added in v1.9.0

func (c DockerCommand) RedirectPlatform(image string) (*string, error)

type Dockerfile

type Dockerfile struct {
	ExposedPorts []portConfig
	HealthCheck  *HealthCheck
	// contains filtered or unexported fields
}

Dockerfile represents a parsed Dockerfile.

func NewDockerfile

func NewDockerfile(fs afero.Fs, path string) *Dockerfile

NewDockerfile returns an empty Dockerfile.

func (*Dockerfile) GetExposedPorts

func (df *Dockerfile) GetExposedPorts() ([]uint16, error)

GetExposedPorts returns a uint16 slice of exposed ports found in the Dockerfile.

func (*Dockerfile) GetHealthCheck

func (df *Dockerfile) GetHealthCheck() (*HealthCheck, error)

GetHealthCheck parses the HEALTHCHECK instruction from the Dockerfile and returns it. If the HEALTHCHECK is NONE or there is no instruction, returns nil.

type ErrDockerDaemonNotResponsive

type ErrDockerDaemonNotResponsive struct {
	// contains filtered or unexported fields
}

ErrDockerDaemonNotResponsive means the docker daemon is not responsive.

func (ErrDockerDaemonNotResponsive) Error

type ErrInvalidPort

type ErrInvalidPort struct {
	Match string
}

ErrInvalidPort means that while there was a port provided, it was out of bounds or unparseable

func (ErrInvalidPort) Error

func (e ErrInvalidPort) Error() string

type ErrNoExpose

type ErrNoExpose struct {
	Dockerfile string
}

ErrNoExpose means there were no documented EXPOSE statements in the given dockerfile.

func (ErrNoExpose) Error

func (e ErrNoExpose) Error() string

type ErrOutdatedSSMPlugin added in v1.4.0

type ErrOutdatedSSMPlugin struct {
	CurrentVersion string
	LatestVersion  string
}

ErrOutdatedSSMPlugin means the ssm plugin is not up-to-date.

func (ErrOutdatedSSMPlugin) Error added in v1.4.0

func (e ErrOutdatedSSMPlugin) Error() string

type ErrSSMPluginNotExist added in v1.4.0

type ErrSSMPluginNotExist struct{}

ErrSSMPluginNotExist means the ssm plugin is not installed.

func (ErrSSMPluginNotExist) Error added in v1.4.0

func (e ErrSSMPluginNotExist) Error() string

type HealthCheck

type HealthCheck struct {
	Interval    time.Duration
	Timeout     time.Duration
	StartPeriod time.Duration
	Retries     int
	Cmd         []string
}

HealthCheck represents health check options for a Dockerfile.

type MockcmdRunner added in v1.7.0

type MockcmdRunner struct {
	// contains filtered or unexported fields
}

MockcmdRunner is a mock of cmdRunner interface.

func NewMockcmdRunner added in v1.7.0

func NewMockcmdRunner(ctrl *gomock.Controller) *MockcmdRunner

NewMockcmdRunner creates a new mock instance.

func (*MockcmdRunner) EXPECT added in v1.7.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockcmdRunner) Run added in v1.7.0

func (m *MockcmdRunner) Run() error

Run mocks base method.

type MockcmdRunnerMockRecorder added in v1.7.0

type MockcmdRunnerMockRecorder struct {
	// contains filtered or unexported fields
}

MockcmdRunnerMockRecorder is the mock recorder for MockcmdRunner.

func (*MockcmdRunnerMockRecorder) Run added in v1.7.0

Run indicates an expected call of Run.

type MockhttpClient added in v1.7.0

type MockhttpClient struct {
	// contains filtered or unexported fields
}

MockhttpClient is a mock of httpClient interface.

func NewMockhttpClient added in v1.7.0

func NewMockhttpClient(ctrl *gomock.Controller) *MockhttpClient

NewMockhttpClient creates a new mock instance.

func (*MockhttpClient) EXPECT added in v1.7.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockhttpClient) Get added in v1.7.0

func (m *MockhttpClient) Get(url string) (*http.Response, error)

Get mocks base method.

type MockhttpClientMockRecorder added in v1.7.0

type MockhttpClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockhttpClientMockRecorder is the mock recorder for MockhttpClient.

func (*MockhttpClientMockRecorder) Get added in v1.7.0

func (mr *MockhttpClientMockRecorder) Get(url interface{}) *gomock.Call

Get indicates an expected call of Get.

type Mockrunner added in v1.7.0

type Mockrunner struct {
	// contains filtered or unexported fields
}

Mockrunner is a mock of runner interface.

func NewMockrunner added in v1.7.0

func NewMockrunner(ctrl *gomock.Controller) *Mockrunner

NewMockrunner creates a new mock instance.

func (*Mockrunner) EXPECT added in v1.7.0

func (m *Mockrunner) EXPECT() *MockrunnerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*Mockrunner) InteractiveRun added in v1.7.0

func (m *Mockrunner) InteractiveRun(name string, args []string) error

InteractiveRun mocks base method.

func (*Mockrunner) Run added in v1.7.0

func (m *Mockrunner) Run(name string, args []string, options ...CmdOption) error

Run mocks base method.

type MockrunnerMockRecorder added in v1.7.0

type MockrunnerMockRecorder struct {
	// contains filtered or unexported fields
}

MockrunnerMockRecorder is the mock recorder for Mockrunner.

func (*MockrunnerMockRecorder) InteractiveRun added in v1.7.0

func (mr *MockrunnerMockRecorder) InteractiveRun(name, args interface{}) *gomock.Call

InteractiveRun indicates an expected call of InteractiveRun.

func (*MockrunnerMockRecorder) Run added in v1.7.0

func (mr *MockrunnerMockRecorder) Run(name, args interface{}, options ...interface{}) *gomock.Call

Run indicates an expected call of Run.

type SSMPluginCommand added in v1.4.0

type SSMPluginCommand struct {
	// contains filtered or unexported fields
}

SSMPluginCommand represents commands that can be run to trigger the ssm plugin.

func NewSSMPluginCommand added in v1.4.0

func NewSSMPluginCommand(s *session.Session) SSMPluginCommand

NewSSMPluginCommand returns a SSMPluginCommand.

func (SSMPluginCommand) InstallLatestBinary added in v1.4.0

func (s SSMPluginCommand) InstallLatestBinary() error

InstallLatestBinary installs the latest ssm plugin.

func (SSMPluginCommand) StartSession added in v1.4.0

func (s SSMPluginCommand) StartSession(ssmSess *ecs.Session) error

StartSession starts a session using the ssm plugin.

func (SSMPluginCommand) ValidateBinary added in v1.4.0

func (s SSMPluginCommand) ValidateBinary() error

ValidateBinary validates if the ssm plugin exists and needs update.

Jump to

Keyboard shortcuts

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