--- a/runner/cmd.go Thu Dec 23 09:31:26 2021 -0600
+++ b/runner/cmd.go Thu Dec 23 10:03:40 2021 -0600
@@ -1,3 +1,19 @@
+// 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/>. @@ -30,37 +46,13 @@
Plans []string `kong:"arg,help='The names of the plans to run',default='default'"`
-func (c *RunnerCmd) runPlan(name string, cfg *config.Config, plan runtime.Plan) error {
- configPath, _ := filepath.Split(c.ConfigFile)
- env := environment.New(c.Environment...)
- rt := runtime.New(env, configPath, c.ForceSequential, c.KeepWorkspace, c.Timeout)
- rt.MetaPlans = cfg.MetaPlans
- rt.CpuShares = c.CpuShares
+func (c *RunnerCmd) runPlan(name string, cfg *config.Config, plan runtime.Plan, rt *runtime.Runtime) error { configEnv := environment.New(cfg.Environment...)
return plan.Execute(name, configEnv, rt)
-func (c *RunnerCmd) runPlans(ctx context.Context, cfg *config.Config) error {
+func (c *RunnerCmd) runPlans(ctx context.Context, cfg *config.Config, rt *runtime.Runtime) error { errChan := make(chan error, 1)
@@ -69,7 +61,7 @@
for _, name := range c.Plans {
- if err := c.runPlan(name, cfg, plan); err != nil {
+ if err := c.runPlan(name, cfg, plan, rt); err != nil { @@ -109,6 +101,19 @@
+ configPath, _ := filepath.Split(c.ConfigFile) + rt := c.Runtime(configPath, cfg) signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
@@ -117,7 +122,7 @@
ctx, cancel := context.WithCancel(context.Background())
go func(ctx context.Context, cfg *config.Config) {
- errChan <- c.runPlans(ctx, cfg)
+ errChan <- c.runPlans(ctx, cfg, rt) --- a/runtime/runtime.go Thu Dec 23 09:31:26 2021 -0600
+++ b/runtime/runtime.go Thu Dec 23 10:03:40 2021 -0600
@@ -38,6 +38,7 @@
MetaPlans map[string]MetaPlan
@@ -52,6 +53,7 @@
MetaPlans: map[string]MetaPlan{},
+ Plans: map[string]Plan{}, Tasks: map[string]Task{},