Documentation ¶
Index ¶
- func ApplyEnv(env map[string]string) func(string, ...string) error
- func DownloadFile(ctx context.Context, url, out string) error
- func GetLatestTag(ctx context.Context, owner, repo string) (string, error)
- func GoTimeoutFlag(ctx context.Context) []string
- func GoVerboseFlag() []string
- func Runtime() (string, bool)
- type BuildCommand
- type BuildOption
- type Command
- type ContainerError
- type FailedRequestError
- type Mount
- type MountOption
- type RunCommand
- type RunOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLatestTag ¶ added in v0.2.5
func GoTimeoutFlag ¶
GoTimeoutFlag returns a timeout flag and duration corresponding to the given context deadline as a slice of strings. If the context has no deadline then an empty slice of strings is returned.
func GoVerboseFlag ¶
func GoVerboseFlag() []string
GoVerboseFlag checks if 'Mage' was run with the verbose flag and if so returns the Go verbose flag '-v' as a slice of strings. An empty slice of strings is returned otherwise.
Types ¶
type BuildCommand ¶
BuildCommand is used to generate a command which will build a container image.
type BuildOption ¶
type BuildOption func(c *BuildCommand) error
func BuildArgs ¶
func BuildArgs(args ...string) BuildOption
BuildArgs applies build arguments for variable substitution within a container file.
func BuildContainerFilePath ¶
func BuildContainerFilePath(path string) BuildOption
BuildContainerFilepath is a path to a container file containing build instructions.
func BuildEnv ¶
func BuildEnv(env map[string]string) BuildOption
BuildEnv adds the supplied map of variable/value pairs to the commands run environment.
func BuildRuntime ¶
func BuildRuntime(runtime string) BuildOption
BuildRuntime manually sets the desired container runtime.
func BuildTags ¶
func BuildTags(tags ...string) BuildOption
BuildTags applies tags to the build image.
type Command ¶
func NewBuildCommand ¶
func NewBuildCommand(contextDirectory string, options ...BuildOption) (Command, error)
contextDirectory is the "build" directory from which the container runtime will observe as the relative root location. options is a variadic slice of additional options to apply to the container build command. An error will be returned if any invalid parameters are supplied or there is no available container runtime on the system.
func NewRunCommand ¶
NewRunCommand returns a function which will run a container with optional arguments.
image is a mandatory image name for the container to run in. options is a variadic slice of additional options to apply to the container run command. An error will be returned if any invalid parameters are supplied or there is no available container runtime on the system.
type ContainerError ¶
type ContainerError string
func (ContainerError) Error ¶
func (e ContainerError) Error() string
type FailedRequestError ¶ added in v0.2.5
type FailedRequestError int
func (FailedRequestError) Error ¶ added in v0.2.5
func (e FailedRequestError) Error() string
type Mount ¶
type Mount struct {
// contains filtered or unexported fields
}
Mount abstracts a volume mount used with container commands.
func NewMount ¶
func NewMount(options ...MountOption) (Mount, error)
NewMount returns a mount with the supplied options applied. An error is returned if any of the options are invalid.
func (*Mount) Options ¶
func (m *Mount) Options(options ...MountOption) error
Options applies the given options to a mount. If any options are invalid an error is returned.
type MountOption ¶
var MountReadOnly MountOption = func(m *Mount) error { m.readOnly = true return nil }
MountReadOnly sets the mount to be "readonly" within the container.
func MountSource ¶
func MountSource(source string) MountOption
MountSource sets the mount source location. The nature of this value changes with the mount type.
func MountTarget ¶
func MountTarget(target string) MountOption
MountTarget sets the mount target within the container.
type RunCommand ¶
type RunCommand struct {
// contains filtered or unexported fields
}
RunCommand wraps a command which runs a container.
type RunOption ¶
type RunOption func(*RunCommand) error
var RunDisableSELinux RunOption = func(c *RunCommand) error { c.disableSELinux = true return nil }
RunDisableSELinux sets "--security-opt label=disable" to bypass setting a container policy.
var RunRemoveAfter RunOption = func(c *RunCommand) error { c.removeAfter = true return nil }
RunRemoveAfter ensures the container is removed after it exits.
func RunRuntime ¶
RunRuntime manually sets the desired container runtime.
func RunWorkingDir ¶
RunWorkingDir sets a working directory within the container.