Documentation ¶
Index ¶
- type BuildCmd
- type CommandSequence
- type DockerCmd
- type DockerCmdOpts
- type InstructionSet
- type Parser
- func (parser *Parser) AssertLint() int
- func (parser *Parser) IsOpenable() bool
- func (parser *Parser) Lint() error
- func (parser *Parser) NextUUID() (string, error)
- func (parser *Parser) Parse() (*CommandSequence, error)
- func (parser *Parser) RandomizeUUIDGenerator()
- func (parser *Parser) SeedUUIDGenerator()
- type PushCmd
- type SubSequence
- type SubSequenceMetadata
- type TagCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildCmd ¶ added in v0.7.0
BuildCmd is a wrapper for the os/exec call for `docker build`
func (*BuildCmd) Message ¶ added in v0.7.0
Message returns the shell command that gets run for docker build commands
func (*BuildCmd) Run ¶ added in v0.7.0
Run is the command that actually calls docker build shell command. Determine the image ID for the resulting image and return that as well.
func (*BuildCmd) WithOpts ¶ added in v0.7.0
func (b *BuildCmd) WithOpts(opts *DockerCmdOpts) DockerCmd
WithOpts sets options required for the BuildCmd
type CommandSequence ¶
type CommandSequence struct {
Commands []*SubSequence
}
A CommandSequence is an intermediate data type in the parsing process. Once a Builderfile is parsed into an InstructionSet, it is further parsed into a CommandSequence, which is essential an array of strings where each string is a command to be run.
type DockerCmd ¶ added in v0.7.0
type DockerCmd interface { // Run() runs the underlying command. The string return value is expected // to be the ID of the image being operated on Run() (string, error) // Message() returns a string representation of the command if it were to // be run on the command line Message() string // WithOpts sets the options for the command. It is expected to return the // same DockerCmd in a state in which the Run() function can be called // immediately after without error (i.e.`dockerCmdInstance.WithOpts(opts).Run()`) WithOpts(opts *DockerCmdOpts) DockerCmd }
DockerCmd is an interface that wraps the various docker command types.
type DockerCmdOpts ¶ added in v0.7.0
type DockerCmdOpts struct { DockerClient dclient.DockerClient Image string Workdir string Stdout io.Writer Stderr io.Writer SkipPush bool ImageUUID string }
DockerCmdOpts is an options struct for the options required by the various structs that implement the DockerCmd interface
type InstructionSet ¶
type InstructionSet struct { DockerBuildOpts []string DockerTagOpts []string Containers []builderfile.ContainerSection }
An InstructionSet is an intermediate datatype - once a Builderfile is parsed and the TOML is validated, the parser parses the data into an InstructionSet. The primary purpose of this step is to merge any global container options into the sections for the individual containers.
type Parser ¶
Parser is a struct that contains a Builderfile and knows how to parse it both as raw text and to convert toml to a Builderfile struct. It also knows how to tell if the Builderfile is valid (openable) or nat.
func NewParser ¶
NewParser returns an initialized Parser. Not currently necessary, as no default values are assigned to a new Parser, but useful to have in case we need to change this.
func (*Parser) AssertLint ¶
AssertLint is like Lint except that instead of returning an nil/error to indicate success/failure, it exits nonzero if linting fails.
func (*Parser) IsOpenable ¶
IsOpenable examines the Builderfile provided to the Parser and returns a bool indicating whether or not the file exists and openable.
func (*Parser) Lint ¶
Lint parses a builderfile and returns either nil if the file was parsed successfully or an error indicating that parsing failed and the file is invalid.
func (*Parser) NextUUID ¶
NextUUID returns the next UUID generated by the parser's uuid generator. This will either be a random uuid (normal behavior) or the same uuid every time if the generator is "seeded" (used for tests)
func (*Parser) Parse ¶
func (parser *Parser) Parse() (*CommandSequence, error)
Parse further parses the Builderfile struct into an InstructionSet struct, merging the global container options into the individual container sections.
func (*Parser) RandomizeUUIDGenerator ¶
func (parser *Parser) RandomizeUUIDGenerator()
RandomizeUUIDGenerator turns this parser's uuidGenerator into a random generator. All calls to NextUUID() will produce a random uuid after this function is called and until SeedUUIDGenerator() is called.
func (*Parser) SeedUUIDGenerator ¶
func (parser *Parser) SeedUUIDGenerator()
SeedUUIDGenerator turns this parser's uuidGenerator into a seeded generator. All calls to NextUUID() will produce the same uuid after this function is called and until RandomizeUUIDGenerator() is called.
type PushCmd ¶ added in v0.7.0
type PushCmd struct { PushFunc func(opts docker.PushImageOptions, auth docker.AuthConfiguration) error Image string Tag string Registry string AuthUn string AuthPwd string AuthEmail string OutputStream io.Writer // contains filtered or unexported fields }
PushCmd is a wrapper for the docker PushImage functionality
func (*PushCmd) Message ¶ added in v0.7.0
Message returns the shell command that would be equivalent to the PushImage command
func (*PushCmd) Run ¶ added in v0.7.0
Run is the command that actually calls PushImage to do the pushing
func (*PushCmd) WithOpts ¶ added in v0.7.0
func (p *PushCmd) WithOpts(opts *DockerCmdOpts) DockerCmd
WithOpts sets options required for the PushCmd
type SubSequence ¶
type SubSequence struct { Metadata *SubSequenceMetadata SubCommand []DockerCmd }
A SubSequence is a logical grouping of commands such as a sequence of build, tag, and push commands. In addition, the subsequence metadata contains any important metadata about the container build such as the name of the Dockerfile and which files/dirs to exclude.
type SubSequenceMetadata ¶
type SubSequenceMetadata struct { Name string Dockerfile string Included []string Excluded []string UUID string SkipPush bool }
SubSequenceMetadata contains any important metadata about the container build such as the name of the Dockerfile and which files/dirs to exclude.
type TagCmd ¶ added in v0.7.0
type TagCmd struct { TagFunc func(name string, opts docker.TagImageOptions) error Image string Force bool Tag string Repo string // contains filtered or unexported fields }
TagCmd is a wrapper for the docker TagImage functionality
func (*TagCmd) Message ¶ added in v0.7.0
Message returns the shell command that would be equivalent to the TagImage command
func (*TagCmd) Run ¶ added in v0.7.0
Run is the command that actually calls TagImage to do the tagging
func (*TagCmd) WithOpts ¶ added in v0.7.0
func (t *TagCmd) WithOpts(opts *DockerCmdOpts) DockerCmd
WithOpts sets options required for the TagCmd