Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Oct 2, 2024
1 parent 165f294 commit 620a3b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down
1 change: 0 additions & 1 deletion src/pkg/variables/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 620a3b7

Please sign in to comment.