move the tasks.Task interface to runtime.Task
--- a/config/config.go Wed Dec 22 10:36:23 2021 -0600
+++ b/config/config.go Thu Dec 23 08:50:45 2021 -0600
@@ -24,12 +24,12 @@
"keep.imfreedom.org/grim/convey/metaplans"
"keep.imfreedom.org/grim/convey/plans"
- "keep.imfreedom.org/grim/convey/tasks"
+ "keep.imfreedom.org/grim/convey/runtime" // Config represents a full convey configuration.
- Tasks map[string]tasks.Task
+ Tasks map[string]runtime.Task Plans map[string]plans.Plan
MetaPlans map[string]metaplans.MetaPlan
--- a/config/raw.go Wed Dec 22 10:36:23 2021 -0600
+++ b/config/raw.go Thu Dec 23 08:50:45 2021 -0600
@@ -7,6 +7,7 @@
"keep.imfreedom.org/grim/convey/metaplans"
"keep.imfreedom.org/grim/convey/plans"
+ "keep.imfreedom.org/grim/convey/runtime" "keep.imfreedom.org/grim/convey/tasks"
@@ -17,8 +18,8 @@
MetaPlans map[string]metaplans.MetaPlan `yaml:"meta-plans"`
-func (r *rawConfig) processTasks() (map[string]tasks.Task, error) {
- realTasks := map[string]tasks.Task{}
+func (r *rawConfig) processTasks() (map[string]runtime.Task, error) { + realTasks := map[string]runtime.Task{} for name, rawTask := range r.Tasks {
--- a/config/tasks.go Wed Dec 22 10:36:23 2021 -0600
+++ b/config/tasks.go Thu Dec 23 08:50:45 2021 -0600
@@ -19,16 +19,17 @@
"keep.imfreedom.org/grim/convey/docker"
"keep.imfreedom.org/grim/convey/podman"
+ "keep.imfreedom.org/grim/convey/runtime" "keep.imfreedom.org/grim/convey/script"
"keep.imfreedom.org/grim/convey/tasks"
// TaskMap is a type alias for a map of task names to tasks.
-type taskMap map[string]tasks.Task
+type taskMap map[string]runtime.Task // tasksMap is a lookup table for tasks
- tasksMap = map[string]tasks.Task{}
+ tasksMap = map[string]runtime.Task{} --- a/docker/build.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/build.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -28,7 +27,7 @@
return b.realBuild.Execute(name, logger, stageEnv, rt)
-func (b *Build) New() tasks.Task {
+func (b *Build) New() runtime.Task { --- a/docker/environment.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/environment.go Thu Dec 23 08:50:45 2021 -0600
@@ -7,13 +7,12 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
type Environment struct{}
// New creates a new Environment task.
-func (e *Environment) New() tasks.Task {
+func (e *Environment) New() runtime.Task { --- a/docker/export.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/export.go Thu Dec 23 08:50:45 2021 -0600
@@ -18,7 +18,7 @@
// New creates a new Export task.
-func (e *Export) New() tasks.Task {
+func (e *Export) New() runtime.Task { --- a/docker/import.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/import.go Thu Dec 23 08:50:45 2021 -0600
@@ -18,7 +18,7 @@
// New creates a new Import task.
-func (i *Import) New() tasks.Task {
+func (i *Import) New() runtime.Task { --- a/docker/login.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/login.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
@@ -23,7 +22,7 @@
return l.realLogin.Execute(name, logger, stageEnv, rt)
-func (l *Login) New() tasks.Task {
+func (l *Login) New() runtime.Task { --- a/docker/logout.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/logout.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
@@ -21,7 +20,7 @@
return l.realLogout.Execute(name, logger, stageEnv, rt)
-func (l *Logout) New() tasks.Task {
+func (l *Logout) New() runtime.Task { --- a/docker/pull.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/pull.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -23,7 +22,7 @@
return p.realPull.Execute(name, logger, stageEnv, rt)
-func (p *Pull) New() tasks.Task {
+func (p *Pull) New() runtime.Task { --- a/docker/push.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/push.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -23,7 +22,7 @@
return p.realPush.Execute(name, logger, stageEnv, rt)
-func (p *Push) New() tasks.Task {
+func (p *Push) New() runtime.Task { --- a/docker/remove.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/remove.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -24,7 +23,7 @@
return r.realRemove.Execute(name, logger, stageEnv, rt)
-func (r *Remove) New() tasks.Task {
+func (r *Remove) New() runtime.Task { --- a/docker/run.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/run.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -31,7 +30,7 @@
// New creates a new Run task.
-func (r *Run) New() tasks.Task {
+func (r *Run) New() runtime.Task { --- a/docker/tag.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/tag.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -21,7 +20,7 @@
// New creates a new Tag task.
-func (t *Tag) New() tasks.Task {
+func (t *Tag) New() runtime.Task { --- a/docker/tasks.go Wed Dec 22 10:36:23 2021 -0600
+++ b/docker/tasks.go Thu Dec 23 08:50:45 2021 -0600
@@ -1,11 +1,11 @@
- "keep.imfreedom.org/grim/convey/tasks"
+ "keep.imfreedom.org/grim/convey/runtime" - Tasks = map[string]tasks.Task{
+ Tasks = map[string]runtime.Task{ "docker/build": &Build{},
"docker/import": &Import{},
"docker/environment": &Environment{},
--- a/plans/plans.go Wed Dec 22 10:36:23 2021 -0600
+++ b/plans/plans.go Thu Dec 23 08:50:45 2021 -0600
@@ -28,7 +28,6 @@
"keep.imfreedom.org/grim/convey/logging"
"keep.imfreedom.org/grim/convey/runtime"
"keep.imfreedom.org/grim/convey/stages"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -46,7 +45,7 @@
// Execute runs the plan.
-func (p *Plan) Execute(path string, tasks map[string]tasks.Task, configEnv environment.Environment, rt *runtime.Runtime) error {
+func (p *Plan) Execute(path string, tasks map[string]runtime.Task, configEnv environment.Environment, rt *runtime.Runtime) error { if err := p.Valid(); err != nil {
--- a/plans/stages_test.go Wed Dec 22 10:36:23 2021 -0600
+++ b/plans/stages_test.go Thu Dec 23 08:50:45 2021 -0600
@@ -27,7 +27,7 @@
"keep.imfreedom.org/grim/convey/tasks"
-func runPlan(path string, p Plan, tasks map[string]tasks.Task) error {
+func runPlan(path string, p Plan, tasks map[string]runtime.Task) error { rt := runtime.New(env, "", false, false, 0*time.Second)
@@ -52,7 +52,7 @@
- tasks := map[string]tasks.Task{"count": count}
+ tasks := map[string]runtime.Task{"count": count} err := runPlan("single", p, tasks)
@@ -70,7 +70,7 @@
- tasks := map[string]tasks.Task{"count": count}
+ tasks := map[string]runtime.Task{"count": count} err := runPlan("multiple", p, tasks)
@@ -89,7 +89,7 @@
- tasks := map[string]tasks.Task{
+ tasks := map[string]runtime.Task{ @@ -112,7 +112,7 @@
- tasks := map[string]tasks.Task{
+ tasks := map[string]runtime.Task{ @@ -135,7 +135,7 @@
- tasks := map[string]tasks.Task{
+ tasks := map[string]runtime.Task{ @@ -158,7 +158,7 @@
- tasks := map[string]tasks.Task{
+ tasks := map[string]runtime.Task{ @@ -180,7 +180,7 @@
- tasks := map[string]tasks.Task{
+ tasks := map[string]runtime.Task{ --- a/podman/build.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/build.go Thu Dec 23 08:50:45 2021 -0600
@@ -9,7 +9,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -74,7 +73,7 @@
-func (b *Build) New() tasks.Task {
+func (b *Build) New() runtime.Task { --- a/podman/login.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/login.go Thu Dec 23 08:50:45 2021 -0600
@@ -8,7 +8,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
@@ -35,7 +34,7 @@
return exec.RunWithStdin(name, generator.Command(), stdin, rt.Timeout)
-func (l *Login) New() tasks.Task {
+func (l *Login) New() runtime.Task { --- a/podman/logout.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/logout.go Thu Dec 23 08:50:45 2021 -0600
@@ -6,7 +6,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
@@ -27,7 +26,7 @@
return exec.Run(name, generator.Command(), rt.Timeout)
-func (l *Logout) New() tasks.Task {
+func (l *Logout) New() runtime.Task { --- a/podman/pull.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/pull.go Thu Dec 23 08:50:45 2021 -0600
@@ -6,7 +6,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -34,7 +33,7 @@
-func (p *Pull) New() tasks.Task {
+func (p *Pull) New() runtime.Task { --- a/podman/push.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/push.go Thu Dec 23 08:50:45 2021 -0600
@@ -6,7 +6,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -34,7 +33,7 @@
-func (p *Push) New() tasks.Task {
+func (p *Push) New() runtime.Task { --- a/podman/remove.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/remove.go Thu Dec 23 08:50:45 2021 -0600
@@ -9,7 +9,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -42,7 +41,7 @@
-func (r *Remove) New() tasks.Task {
+func (r *Remove) New() runtime.Task { --- a/podman/run.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/run.go Thu Dec 23 08:50:45 2021 -0600
@@ -12,7 +12,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -167,7 +166,7 @@
return exec.Run(name, generator.Command(), rt.Timeout)
-func (r *Run) New() tasks.Task {
+func (r *Run) New() runtime.Task { --- a/podman/tag.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/tag.go Thu Dec 23 08:50:45 2021 -0600
@@ -6,7 +6,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -29,7 +28,7 @@
return exec.Run(name, generator.Command(), rt.Timeout)
-func (t *Tag) New() tasks.Task {
+func (t *Tag) New() runtime.Task { --- a/podman/tasks.go Wed Dec 22 10:36:23 2021 -0600
+++ b/podman/tasks.go Thu Dec 23 08:50:45 2021 -0600
@@ -1,11 +1,11 @@
- "keep.imfreedom.org/grim/convey/tasks"
+ "keep.imfreedom.org/grim/convey/runtime" - Tasks = map[string]tasks.Task{
+ Tasks = map[string]runtime.Task{ "podman/build": &Build{},
"podman/login": &Login{},
"podman/logout": &Logout{},
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/task.go Thu Dec 23 08:50:45 2021 -0600
@@ -0,0 +1,30 @@
+// Copyright 2016-2021 Gary Kramlich <grim@reaperworld.com> +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + log "github.com/sirupsen/logrus" + "keep.imfreedom.org/grim/convey/environment" +// Task is an interface for defining a task that can be run. + Execute(name string, logger *log.Entry, env environment.Environment, rt *Runtime) error --- a/script/shell.go Wed Dec 22 10:36:23 2021 -0600
+++ b/script/shell.go Thu Dec 23 08:50:45 2021 -0600
@@ -11,7 +11,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/exec"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -54,7 +53,7 @@
return exec.Run(name, []string{shell, filename}, rt.Timeout)
-func (s *Shell) New() tasks.Task {
+func (s *Shell) New() runtime.Task { --- a/script/tasks.go Wed Dec 22 10:36:23 2021 -0600
+++ b/script/tasks.go Thu Dec 23 08:50:45 2021 -0600
@@ -1,11 +1,11 @@
- "keep.imfreedom.org/grim/convey/tasks"
+ "keep.imfreedom.org/grim/convey/runtime" - Tasks = map[string]tasks.Task{
+ Tasks = map[string]runtime.Task{ "script/shell": &Shell{},
--- a/stages/stages.go Wed Dec 22 10:36:23 2021 -0600
+++ b/stages/stages.go Thu Dec 23 08:50:45 2021 -0600
@@ -26,7 +26,6 @@
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/logging"
"keep.imfreedom.org/grim/convey/runtime"
- "keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
@@ -72,7 +71,7 @@
// Execute runs the stage.
-func (s *Stage) Execute(path string, logger *log.Entry, taskMap map[string]tasks.Task, env environment.Environment, rt *runtime.Runtime) error {
+func (s *Stage) Execute(path string, logger *log.Entry, taskMap map[string]runtime.Task, env environment.Environment, rt *runtime.Runtime) error { stageEnv := env.Copy().Merge(env).MergeSlice(s.Environment)
if s.Concurrent && !rt.ForceSequential {
@@ -125,7 +124,7 @@
-func (s *Stage) runTask(path, name string, stageEnv environment.Environment, taskMap map[string]tasks.Task, rt *runtime.Runtime) error {
+func (s *Stage) runTask(path, name string, stageEnv environment.Environment, taskMap map[string]runtime.Task, rt *runtime.Runtime) error { absTaskName := fmt.Sprintf("%s/%s", path, name)
taskLogger := logging.NewAdapter(fmt.Sprintf("%s/%s", path, name))
--- a/tasks/clean.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/clean.go Thu Dec 23 08:50:45 2021 -0600
@@ -108,7 +108,7 @@
// New creates a new clean task.
-func (c *Clean) New() Task {
+func (c *Clean) New() runtime.Task { --- a/tasks/clone.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/clone.go Thu Dec 23 08:50:45 2021 -0600
@@ -18,12 +18,14 @@
+ "keep.imfreedom.org/grim/convey/runtime" // CloneTask creates a task of the given type from the given payload. It
// does this by creating a fresh instance of a task of the target type,
// then marshalling/unmarshalling the payload to that type.
-func Clone(task interface{}, taskType Task) (Task, error) {
+func Clone(task interface{}, taskType runtime.Task) (runtime.Task, error) { rawTask, err := yaml.Marshal(task)
--- a/tasks/clone_test.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/clone_test.go Thu Dec 23 08:50:45 2021 -0600
@@ -20,6 +20,8 @@
"github.com/stretchr/testify/assert"
+ "keep.imfreedom.org/grim/convey/runtime" func TestCloneTask(t *testing.T) {
@@ -33,7 +35,7 @@
- assert.Implements(t, (*Task)(nil), clone)
+ assert.Implements(t, (*runtime.Task)(nil), clone) cleanClone := clone.(*Clean)
assert.ElementsMatch(t, cleanClone.Files, files)
--- a/tasks/count.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/count.go Thu Dec 23 08:50:45 2021 -0600
@@ -36,7 +36,7 @@
// New creates a new count task.
-func (c *Count) New() Task {
+func (c *Count) New() runtime.Task { --- a/tasks/export.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/export.go Thu Dec 23 08:50:45 2021 -0600
@@ -33,7 +33,7 @@
// New creates a new Export task.
-func (e *Export) New() Task {
+func (e *Export) New() runtime.Task { --- a/tasks/fail.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/fail.go Thu Dec 23 08:50:45 2021 -0600
@@ -34,7 +34,7 @@
// New creates a new fail task.
-func (c *Fail) New() Task {
+func (c *Fail) New() runtime.Task { --- a/tasks/import.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/import.go Thu Dec 23 08:50:45 2021 -0600
@@ -34,7 +34,7 @@
// New creates a new Import task.
-func (i *Import) New() Task {
+func (i *Import) New() runtime.Task { --- a/tasks/noop.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/noop.go Thu Dec 23 08:50:45 2021 -0600
@@ -32,7 +32,7 @@
// New creates a new noop task.
-func (c *Noop) New() Task {
+func (c *Noop) New() runtime.Task { --- a/tasks/tasks.go Wed Dec 22 10:36:23 2021 -0600
+++ b/tasks/tasks.go Thu Dec 23 08:50:45 2021 -0600
@@ -18,15 +18,12 @@
- log "github.com/sirupsen/logrus"
- "keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/runtime"
// Tasks is the list of tasks defined in this package.
- Tasks = map[string]Task{
+ Tasks = map[string]runtime.Task{ "convey/clean": &Clean{},
"convey/export": &Export{},
@@ -34,11 +31,3 @@
-// Task is an interface for defining a task that can be run.
- Execute(name string, logger *log.Entry, env environment.Environment, rt *runtime.Runtime) error