From 27bcca2fe5fcae175a6c218bb50f5aef37b34b9d Mon Sep 17 00:00:00 2001 From: Samuel Corsi-House Date: Mon, 14 Feb 2022 08:28:22 -0500 Subject: [PATCH 1/2] fix: only passthrough args to primary tasks --- cli/internal/run/run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index 20218dfdd30dd..22eed7d917c94 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -497,7 +497,11 @@ func (c *RunCommand) Run(args []string) int { // Setup command execution argsactual := append([]string{"run"}, task) - argsactual = append(argsactual, runOptions.passThroughArgs...) + for _, target := range ctx.Targets { + if target == task { + argsactual = append(argsactual, runOptions.passThroughArgs...) + } + } // @TODO: @jaredpalmer fix this hack to get the package manager's name var cmd *exec.Cmd if ctx.Backend.Name == "nodejs-berry" { From 121e8d51f2e630396e3b860f735e5af9b98e248e Mon Sep 17 00:00:00 2001 From: Samuel Corsi-House Date: Wed, 16 Feb 2022 06:56:42 -0500 Subject: [PATCH 2/2] fix: better hashing --- cli/internal/run/run.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index 22eed7d917c94..f2bd4440087ca 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -434,6 +434,13 @@ func (c *RunCommand) Run(args []string) int { } targetLogger.Debug("task output globs", "outputs", outputs) + passThroughArgs := make([]string, 0, len(args)) + for _, target := range ctx.Targets { + if target == task { + passThroughArgs = append(passThroughArgs, runOptions.passThroughArgs...) + } + } + // Hash the task-specific environment variables found in the dependsOnKey in the pipeline var hashabledEnvVars []string var hashabledEnvPairs []string @@ -458,7 +465,7 @@ func (c *RunCommand) Run(args []string) int { Hash: pack.Hash, Task: task, Outputs: outputs, - PassThruArgs: runOptions.passThroughArgs, + PassThruArgs: passThroughArgs, HashableEnvPairs: hashabledEnvPairs, } hash, err := fs.HashObject(hashable) @@ -497,11 +504,7 @@ func (c *RunCommand) Run(args []string) int { // Setup command execution argsactual := append([]string{"run"}, task) - for _, target := range ctx.Targets { - if target == task { - argsactual = append(argsactual, runOptions.passThroughArgs...) - } - } + argsactual = append(argsactual, passThroughArgs...) // @TODO: @jaredpalmer fix this hack to get the package manager's name var cmd *exec.Cmd if ctx.Backend.Name == "nodejs-berry" {