--- a/docker/build.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/build.go Sat Jan 13 00:31:17 2018 -0600
@@ -29,6 +29,7 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Build defines the options for building a docker image. Dockerfile string `yaml:"dockerfile"`
Files yaml.StringOrSlice `yaml:"files"`
@@ -47,6 +48,7 @@
{{if .Target}} --target {{.Target}}{{end}}
+// Execute runs the docker build command func (b *Build) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -121,10 +123,12 @@
return Docker(name, buildTemplate, params, st)
+// New creates a new docker build task. func (b *Build) New() tasks.Task {
+// Valid checks that the build task is valid. func (b *Build) Valid() error {
--- a/docker/docker.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/docker.go Sat Jan 13 00:31:17 2018 -0600
@@ -24,6 +24,7 @@
+ // Tasks is a map of all docker tasks. Tasks = map[string]tasks.Task{
@@ -41,6 +42,7 @@
dockerTemplate = `docker {{if .DockerConfig}}--config {{.DockerConfig}} {{end}}`
+// Docker runs a docker command. func Docker(name, template string, params map[string]interface{}, st *state.State) error {
fullTemplate := dockerTemplate + template
params["DockerConfig"] = st.DockerConfig
@@ -48,6 +50,8 @@
return command.Run(name, fullTemplate, params, st.PlanTimeout)
+// DockerOutput runs a docker command but returns the output rather than +// outputting to the logger. func DockerOutput(name, template string, params map[string]interface{}, st *state.State) (string, string, error) {
fullTemplate := dockerTemplate + template
params["DockerConfig"] = st.DockerConfig
--- a/docker/environment.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/environment.go Sat Jan 13 00:31:17 2018 -0600
@@ -31,12 +31,15 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Environment contains options for loading environment variables from a file type Environment struct {
File string `yaml:"from-file"`
Files yaml.StringOrSlice `yaml:"from-files"`
Prefix string `yaml:"prefix"`
+// Execute runs the environment plan. func (e *Environment) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -129,10 +132,12 @@
+// New creates a new environment command. func (e *Environment) New() tasks.Task {
+// Valid validate the environment command. func (e *Environment) Valid() error {
e.Files = append([]string{e.File}, e.Files...)
--- a/docker/export.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/export.go Sat Jan 13 00:31:17 2018 -0600
@@ -31,6 +31,8 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Export represents an export task which exports files from the workspace to Files yaml.StringOrSlice `yaml:"files"`
@@ -83,6 +85,7 @@
+// Execute runs the export task. func (e *Export) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -125,10 +128,12 @@
+// New creates a new Export task. func (e *Export) New() tasks.Task {
+// Valid validates the export task. func (e *Export) Valid() error {
--- a/docker/healthcheck.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/healthcheck.go Sat Jan 13 00:31:17 2018 -0600
@@ -25,6 +25,7 @@
"bitbucket.org/rw_grim/convey/state"
+// HealthCheck represents a docker health check. type HealthCheck struct {
Command string `yaml:"command"`
Interval time.Duration `yaml:"interval"`
--- a/docker/import.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/import.go Sat Jan 13 00:31:17 2018 -0600
@@ -26,12 +26,15 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Import represents an import task which imports files from the host to the Files yaml.StringOrSlice `yaml:"files"`
const importTemplate = `cp {{.source}} {{.workspaceID}}:/workspace/{{.destination}}`
+// Execute runs the import task. func (i *Import) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -68,10 +71,12 @@
+// New creates a new import task. func (i *Import) New() tasks.Task {
+// Valid validates the import task. func (i *Import) Valid() error {
--- a/docker/login.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/login.go Sat Jan 13 00:31:17 2018 -0600
@@ -24,6 +24,7 @@
"bitbucket.org/rw_grim/convey/tasks"
+// Login represents an login task for logging into a docker registry. Username string `yaml:"username"`
Password string `yaml:"password"`
@@ -32,6 +33,7 @@
const loginTemplate = `login -u {{.username}} -p {{.password}}{{if .server}} {{.server}}{{end}}`
+// Execute runs the login task. func (l *Login) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -59,10 +61,12 @@
return Docker(name, loginTemplate, params, st)
+// New creates a new login task. func (l *Login) New() tasks.Task {
+// Valid validate the login task. func (l *Login) Valid() error {
--- a/docker/logout.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/logout.go Sat Jan 13 00:31:17 2018 -0600
@@ -24,12 +24,14 @@
"bitbucket.org/rw_grim/convey/tasks"
+// Logout represents a logout task which logs out of a docker registry. Server string `yaml:"server"`
const logoutTemplate = `logout{{if .server}} {{.server}}{{end}}`
+// Execute runs the logout task. func (l *Logout) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -45,10 +47,12 @@
return Docker(name, logoutTemplate, params, st)
+// New creates a new logout task. func (l *Logout) New() tasks.Task {
+// Valid validates the logout task. func (l *Logout) Valid() error {
--- a/docker/network.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/network.go Sat Jan 13 00:31:17 2018 -0600
@@ -24,6 +24,7 @@
"bitbucket.org/rw_grim/convey/util"
+// Network represents a docker network. @@ -37,6 +38,7 @@
networkDestroyTemplate = `network rm {{.Name}}`
+// NewNetwork creates a new docker network. func NewNetwork(st *state.State) (*Network, error) {
@@ -58,10 +60,12 @@
+// Name returns the name of the network. func (network *Network) Name() string {
+// Destroy tears down the docker network. func (network *Network) Destroy() error {
for _, name := range network.state.GetRunning() {
params := map[string]interface{}{
--- a/docker/pull.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/pull.go Sat Jan 13 00:31:17 2018 -0600
@@ -25,6 +25,8 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Pull represents a docker pull task which pulls an image from a docker Image string `yaml:"image"`
Images yaml.StringOrSlice `yaml:"images"`
@@ -32,6 +34,7 @@
const pullTemplate = `pull {{.image}}`
+// Execute runs the pull task. func (p *Pull) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -53,10 +56,12 @@
+// New creates a new pull task. func (p *Pull) New() tasks.Task {
+// Valid validates the pull task. func (p *Pull) Valid() error {
p.Images = append([]string{p.Image}, p.Images...)
--- a/docker/push.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/push.go Sat Jan 13 00:31:17 2018 -0600
@@ -25,6 +25,7 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Push represents a docker push task which push an image to a docker registry. Image string `yaml:"image"`
Images yaml.StringOrSlice `yaml:"images"`
@@ -32,6 +33,7 @@
const pushTemplate = `push {{.image}}`
+// Execute runs the push task. func (p *Push) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -53,10 +55,12 @@
+// New creates a new push task. func (p *Push) New() tasks.Task {
+// Valid validates the push task. func (p *Push) Valid() error {
p.Images = append([]string{p.Image}, p.Images...)
--- a/docker/remove.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/remove.go Sat Jan 13 00:31:17 2018 -0600
@@ -27,6 +27,7 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Remove represents a docker rm task which deletes a local docker image. Image string `yaml:"image"`
Images yaml.StringOrSlice `yaml:"images"`
@@ -35,6 +36,7 @@
const removeTemplate = `rmi {{.image}}`
+// Execute runs the remove task. func (r *Remove) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -60,10 +62,12 @@
+// New creates a new remove task. func (r *Remove) New() tasks.Task {
+// Valid validates the remove task. func (r *Remove) Valid() error {
r.Images = append([]string{r.Image}, r.Images...)
--- a/docker/run.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/run.go Sat Jan 13 00:31:17 2018 -0600
@@ -35,6 +35,7 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Run represents a docker run task which will run a container. Command string `yaml:"command"`
Detach bool `yaml:"detach"`
@@ -51,6 +52,7 @@
HealthCheck HealthCheck `yaml:"healthcheck"`
+// UnmarshalYAML is a custom yaml unmarshaller for run tasks. func (r *Run) UnmarshalYAML(unmarshal func(interface{}) error) error {
raw := rawRun{Shell: "/bin/sh", HealthCheck: HealthCheck{}}
@@ -126,6 +128,7 @@
return scriptFile, entryPoint, commandArg, nil
+// Execute runs the run task. func (r *Run) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, r.Environment)
fullEnv = environment.Merge(fullEnv, st.GetEnv())
@@ -337,10 +340,12 @@
return Docker(name, runTemplate, params, st)
+// New creates a new run task. func (r *Run) New() tasks.Task {
+// Valid validates the run task. func (r *Run) Valid() error {
--- a/docker/tag.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/tag.go Sat Jan 13 00:31:17 2018 -0600
@@ -25,6 +25,7 @@
"bitbucket.org/rw_grim/convey/yaml"
+// Tag represents a docker tag command. Source string `yaml:"source"`
Destination string `yaml:"destination"`
@@ -33,6 +34,7 @@
const tagTemplate = `tag {{.source}} {{.destination}}`
+// Execute runs the execute task. func (t *Tag) Execute(name string, logger *gomol.LogAdapter, env []string, st *state.State) error {
fullEnv := environment.Merge(env, st.GetEnv())
@@ -60,10 +62,12 @@
+// New creates a new docker tag task. func (t *Tag) New() tasks.Task {
+// Valid validates the tag task. func (t *Tag) Valid() error {
--- a/docker/workspace.go Sat Jan 13 00:00:58 2018 -0600
+++ b/docker/workspace.go Sat Jan 13 00:31:17 2018 -0600
@@ -26,6 +26,7 @@
"bitbucket.org/rw_grim/convey/util"
+// Workspace represents a docker workspace. @@ -60,6 +61,7 @@
+// NewWorkspace creates a new docker workspace. func NewWorkspace(st *state.State) (*Workspace, error) {
@@ -88,10 +90,12 @@
+// Name returns the name of the docker workspace. func (ws *Workspace) Name() string {
+// Destroy removes the docker workspace. func (ws *Workspace) Destroy() error {
params := map[string]interface{}{