From 620a3b7dd57a43f26d2b054e0b29fb32261b1d42 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Wed, 2 Oct 2024 15:32:13 -0600 Subject: [PATCH] cleanup --- src/pkg/runner/runner.go | 10 +++++----- src/pkg/variables/variables.go | 1 - src/test/e2e/runner_test.go | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pkg/runner/runner.go b/src/pkg/runner/runner.go index d471ca6..8348c60 100644 --- a/src/pkg/runner/runner.go +++ b/src/pkg/runner/runner.go @@ -95,7 +95,7 @@ func (r *Runner) processIncludes(tasksFile types.TasksFile, setVariables map[str for _, include := range tasksFile.Includes { if include[taskReferenceName] != "" { referencedIncludes := []map[string]string{include} - err := r.importTasks(config.TaskFileLocation, referencedIncludes, setVariables) + err := r.importTasks(referencedIncludes, config.TaskFileLocation, setVariables) if err != nil { return err } @@ -106,7 +106,7 @@ func (r *Runner) processIncludes(tasksFile types.TasksFile, setVariables map[str return nil } -func (r *Runner) importTasks(currentFileLocation string, includes []map[string]string, setVariables map[string]string) error { +func (r *Runner) importTasks(includes []map[string]string, currentFileLocation string, setVariables map[string]string) error { // iterate through includes, open the file, and unmarshal it into a Task var includeFileLocationKey string var includeFileLocation string @@ -151,7 +151,7 @@ func (r *Runner) importTasks(currentFileLocation string, includes []map[string]s // recursively import tasks from included files if tasksFile.Includes != nil { - if err := r.importTasks(absIncludeFileLocation, tasksFile.Includes, setVariables); err != nil { + if err := r.importTasks(tasksFile.Includes, absIncludeFileLocation, setVariables); err != nil { return err } } @@ -191,8 +191,8 @@ func loadIncludedTaskFile(taskFile types.TasksFile, taskName string, setVariable if includeFileLocation, ok := includes[includeName]; ok { includeFileLocation = utils.TemplateString(setVariables, includeFileLocation) - resultPath, includedTasksFile, err := loadIncludeTask(config.TaskFileLocation, includeFileLocation) - config.TaskFileLocation = resultPath + absIncludeFileLocation, includedTasksFile, err := loadIncludeTask(config.TaskFileLocation, includeFileLocation) + config.TaskFileLocation = absIncludeFileLocation return includedTasksFile, includeTaskName, err } } diff --git a/src/pkg/variables/variables.go b/src/pkg/variables/variables.go index 501465d..939b117 100644 --- a/src/pkg/variables/variables.go +++ b/src/pkg/variables/variables.go @@ -57,7 +57,6 @@ func (vc *VariableConfig[T]) PopulateVariables(variables []InteractiveVariable[T vc.SetVariable(variable.Name, val, variable.Pattern, variable.Extra) } - // Check the variables pattern was met if err := vc.CheckVariablePattern(variable.Name); err != nil { return err } diff --git a/src/test/e2e/runner_test.go b/src/test/e2e/runner_test.go index 2046a3b..bf0a1f1 100644 --- a/src/test/e2e/runner_test.go +++ b/src/test/e2e/runner_test.go @@ -129,7 +129,7 @@ func TestTaskRunner(t *testing.T) { setVar := fmt.Sprintf("GIT_REVISION=%s", gitRev) stdOut, stdErr, err := e2e.Maru("run", "remote-import-to-local", "--set", setVar, "--file", "src/test/tasks/tasks.yaml") require.NoError(t, err, stdOut, stdErr) - require.Contains(t, stdErr, "bar") + require.Contains(t, stdErr, "baz") }) t.Run("run rerun-tasks", func(t *testing.T) {