diff --git a/core/graph.go b/core/graph.go index 7bd829f..b5b0b32 100644 --- a/core/graph.go +++ b/core/graph.go @@ -277,6 +277,30 @@ func RunGraph(ctx context.Context, graphName string, graphContent []byte, opts R return CreateErr(nil, err, "failed to load yaml") } + // Capture GITHUB_TOKEN / INPUT_GITHUB_TOKEN from the OS environment and store in + // OverrideSecrets so it remains available for repo cloning (gh-action) and + // is properly surfaced as secrets.GITHUB_TOKEN / github.token. Then remove + // from the OS environment to prevent subprocesses from extracting it via + // /proc//environ or similar. + if opts.OverrideSecrets == nil { + opts.OverrideSecrets = make(map[string]string) + } + if _, exists := opts.OverrideSecrets["GITHUB_TOKEN"]; !exists { + if ghToken, ok := opts.OverrideEnv["GITHUB_TOKEN"]; ok && ghToken != "" { + opts.OverrideSecrets["GITHUB_TOKEN"] = ghToken + } else if ghToken := os.Getenv("GITHUB_TOKEN"); ghToken != "" { + opts.OverrideSecrets["GITHUB_TOKEN"] = ghToken + } else if inputToken := os.Getenv("INPUT_GITHUB_TOKEN"); inputToken != "" { + opts.OverrideSecrets["GITHUB_TOKEN"] = inputToken + } else if inputToken := os.Getenv("INPUT_TOKEN"); inputToken != "" { + opts.OverrideSecrets["GITHUB_TOKEN"] = inputToken + } + } + delete(opts.OverrideEnv, "GITHUB_TOKEN") + os.Unsetenv("GITHUB_TOKEN") + os.Unsetenv("INPUT_GITHUB_TOKEN") + os.Unsetenv("INPUT_TOKEN") + ag, errs := LoadGraph(graphYaml, nil, "", false, opts) if len(errs) > 0 { return CreateErr(nil, errs[0], "failed to load graph") @@ -299,13 +323,13 @@ func RunGraph(ctx context.Context, graphName string, graphContent []byte, opts R isGitHubWorkflow := false if opts.OverrideEnv["GITHUB_ACTIONS"] == "true" { isGitHubWorkflow = true - utils.LogOut.Infof("GitHub workflow detected via OverrideEnv") + utils.LogOut.Info("GitHub workflow detected via OverrideEnv\n") } else if os.Getenv("GITHUB_ACTIONS") == "true" { isGitHubWorkflow = true - utils.LogOut.Infof("GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)") + utils.LogOut.Info("GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)\n") } else if entryNode.GetNodeTypeId() == "core/gh-start@v1" { isGitHubWorkflow = true - utils.LogOut.Infof("GitHub workflow detected via entry node type: core/gh-start@v1") + utils.LogOut.Info("GitHub workflow detected via entry node type: core/gh-start@v1\n") } // mimickGitHubEnv: Determines if we need to set up a simulated GitHub environment. The easiest @@ -406,7 +430,7 @@ func RunGraph(ctx context.Context, graphName string, graphContent []byte, opts R if m, err := decodeJsonFromEnvValue[any](v.Value); err == nil { needsTracker.set(m, source, true, true) } - case isGitHubWorkflow && k == "ACT_INPUT_TOKEN": + case isGitHubWorkflow && (k == "ACT_INPUT_TOKEN" || k == "ACT_INPUT_GITHUB_TOKEN"): secretTracker.setSingle("GITHUB_TOKEN", v.Value, source, true, true) default: @@ -440,17 +464,19 @@ func RunGraph(ctx context.Context, graphName string, graphContent []byte, opts R } if mimickGitHubEnv { - if cwd, ok := finalEnv["GITHUB_WORKSPACE"]; ok { - newCwd = cwd - utils.LogOut.Debugf("changing working directory to GITHUB_WORKSPACE: %s\n", newCwd) - } - // If we are running a github actions workflow, then mimic a GitHub Actions environment // But only do is if we are NOT already in GitHub Actions err = SetupGitHubActionsEnv(finalEnv) if err != nil { return CreateErr(nil, err, "failed to setup GitHub Actions environment") } + + // Use the updated GITHUB_WORKSPACE as the working directory. + // SetupGitHubActionsEnv replaces GITHUB_WORKSPACE with a fresh temp folder. + if cwd, ok := finalEnv["GITHUB_WORKSPACE"]; ok { + newCwd = cwd + utils.LogOut.Debugf("changing working directory to GITHUB_WORKSPACE: %s\n", newCwd) + } } else if debugCb != nil && newCwd == "" { // for debug sessions, always create a temp working directory if none is set tmpDir, tmpErr := os.MkdirTemp("", "actrun-debug-*") diff --git a/nodes/gh-action@v1.go b/nodes/gh-action@v1.go index 9e6495c..888ff73 100644 --- a/nodes/gh-action@v1.go +++ b/nodes/gh-action@v1.go @@ -396,28 +396,14 @@ func init() { return nil, []error{core.CreateErr(nil, nil, "node representing GitHub Action '%v' can only be used in a GitHub Actions workflow.", nodeType)} } - // Reminder: - // `INPUT_TOKEN` comes from the GitHub Action actionforge/action. - // `GITHUB_TOKEN` is manually provided, eg through the web app and has a higher precedence. - // GITHUB_TOKEN should always be set via secrets, but just in case the user provides it via env, check also there ghToken := opts.OverrideSecrets["GITHUB_TOKEN"] - if ghToken == "" { - ghToken = opts.OverrideEnv["GITHUB_TOKEN"] - if ghToken == "" { - ghToken = os.Getenv("GITHUB_TOKEN") - if ghToken == "" { - // Note that `INPUT_*` env vars are only prefixed for the graph execution, not here - ghToken = os.Getenv("INPUT_TOKEN") - } - } - } // TODO: (Seb) for the validation process we only need the action.yml, not the entire repo // so check if we are in validate mode and only download the action.yml file _, err = os.Stat(actionRepoRoot) if errors.Is(err, os.ErrNotExist) { if ghToken == "" { - return nil, []error{core.CreateErr(nil, nil, "neither GITHUB_TOKEN nor INPUT_TOKEN are set")} + return nil, []error{core.CreateErr(nil, nil, "neither GITHUB_TOKEN nor INPUT_GITHUB_TOKEN are set")} } cloneUrl := fmt.Sprintf("https://github.com/%s/%s", owner, repo) diff --git a/tests_e2e/references/reference_app.sh_l12 b/tests_e2e/references/reference_app.sh_l12 index 7289066..fdba491 100644 --- a/tests_e2e/references/reference_app.sh_l12 +++ b/tests_e2e/references/reference_app.sh_l12 @@ -23,9 +23,9 @@ hint: stack trace: github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1123 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -33,9 +33,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_dir-walk.sh_l56 b/tests_e2e/references/reference_dir-walk.sh_l56 index ee20662..f2233e9 100644 --- a/tests_e2e/references/reference_dir-walk.sh_l56 +++ b/tests_e2e/references/reference_dir-walk.sh_l56 @@ -32,21 +32,21 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.(*WalkNode).ExecuteImpl - dir-walk@v1.go:62 + dir-walk@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -54,9 +54,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_error_no_output.sh_l8 b/tests_e2e/references/reference_error_no_output.sh_l8 index 94a8c53..7199a6a 100644 --- a/tests_e2e/references/reference_error_no_output.sh_l8 +++ b/tests_e2e/references/reference_error_no_output.sh_l8 @@ -33,31 +33,31 @@ hint: stack trace: github.com/actionforge/actrun-cli/core.(*Outputs).OutputValueById - outputs.go:114 + outputs.go:-1 github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById - inputs.go:364 + inputs.go:-1 github.com/actionforge/actrun-cli/core.inputValueById[...] - inputs.go:483 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...] - inputs.go:478 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputArrayValueById[...] - inputs.go:560 + inputs.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:27 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -65,9 +65,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_group-error.sh_l8 b/tests_e2e/references/reference_group-error.sh_l8 index 4612f6f..cdb7016 100644 --- a/tests_e2e/references/reference_group-error.sh_l8 +++ b/tests_e2e/references/reference_group-error.sh_l8 @@ -126,131 +126,131 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.runAndCaptureOutput - run@v1.go:393 + run@v1.go:-1 github.com/actionforge/actrun-cli/nodes.runCommand - run@v1.go:269 + run@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*RunNode).ExecuteImpl - run@v1.go:110 + run@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl - group-inputs@v1.go:39 + group-inputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:103 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl - group-outputs@v1.go:30 + group-outputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*RunNode).ExecuteImpl - run@v1.go:127 + run@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl - group-inputs@v1.go:39 + group-inputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:103 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl - group-outputs@v1.go:30 + group-outputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl - group-outputs@v1.go:30 + group-outputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*RunNode).ExecuteImpl - run@v1.go:127 + run@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl - group-inputs@v1.go:39 + group-inputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl - group-inputs@v1.go:39 + group-inputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:103 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl - group-outputs@v1.go:30 + group-outputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupOutputsNode).ExecuteImpl - group-outputs@v1.go:30 + group-outputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*RunNode).ExecuteImpl - run@v1.go:155 + run@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl - group-inputs@v1.go:39 + group-inputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupInputsNode).ExecuteImpl - group-inputs@v1.go:39 + group-inputs@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*GroupNode).ExecuteImpl - group@v1.go:102 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 diff --git a/tests_e2e/references/reference_group-port-collision.sh_l13 b/tests_e2e/references/reference_group-port-collision.sh_l13 index fcf39aa..24a1cdd 100644 --- a/tests_e2e/references/reference_group-port-collision.sh_l13 +++ b/tests_e2e/references/reference_group-port-collision.sh_l13 @@ -21,23 +21,23 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.init.41.func1 - group@v1.go:154 + group@v1.go:-1 github.com/actionforge/actrun-cli/core.NewNodeInstance - base.go:619 + base.go:-1 github.com/actionforge/actrun-cli/core.LoadNode - graph.go:687 + graph.go:-1 github.com/actionforge/actrun-cli/core.LoadNodes - graph.go:627 + graph.go:-1 github.com/actionforge/actrun-cli/core.LoadGraph - graph.go:542 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:280 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -45,9 +45,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_index.sh_l20 b/tests_e2e/references/reference_index.sh_l20 index 64c2561..9978d93 100644 --- a/tests_e2e/references/reference_index.sh_l20 +++ b/tests_e2e/references/reference_index.sh_l20 @@ -62,35 +62,35 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.(*ArrayGet).OutputValueById - array-get@v1.go:44 + array-get@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById - inputs.go:364 + inputs.go:-1 github.com/actionforge/actrun-cli/core.inputValueById[...] - inputs.go:483 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...] - inputs.go:478 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputArrayValueById[...] - inputs.go:560 + inputs.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:27 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*LoopNode).ExecuteImpl - for-loop@v1.go:54 + for-loop@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -98,9 +98,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_run-python-embedded.sh_l13 b/tests_e2e/references/reference_run-python-embedded.sh_l13 index f9af3de..89846ac 100644 --- a/tests_e2e/references/reference_run-python-embedded.sh_l13 +++ b/tests_e2e/references/reference_run-python-embedded.sh_l13 @@ -25,23 +25,23 @@ hint: stack trace: github.com/actionforge/actrun-cli/nodes.init.52.func1 - nrun-python-embedded@v1.go:16 + nrun-python-embedded@v1.go:-1 github.com/actionforge/actrun-cli/core.NewNodeInstance - base.go:619 + base.go:-1 github.com/actionforge/actrun-cli/core.LoadNode - graph.go:687 + graph.go:-1 github.com/actionforge/actrun-cli/core.LoadNodes - graph.go:627 + graph.go:-1 github.com/actionforge/actrun-cli/core.LoadGraph - graph.go:542 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:280 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -49,9 +49,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_s3_aws_walk.sh_l22 b/tests_e2e/references/reference_s3_aws_walk.sh_l22 index d070ce1..28467b6 100644 --- a/tests_e2e/references/reference_s3_aws_walk.sh_l22 +++ b/tests_e2e/references/reference_s3_aws_walk.sh_l22 @@ -36,21 +36,21 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.(*StorageListNode).ExecuteImpl - storage-walk@v1.go:45 + storage-walk@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -58,9 +58,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_s3_aws_walk.sh_l44 b/tests_e2e/references/reference_s3_aws_walk.sh_l44 index d070ce1..28467b6 100644 --- a/tests_e2e/references/reference_s3_aws_walk.sh_l44 +++ b/tests_e2e/references/reference_s3_aws_walk.sh_l44 @@ -36,21 +36,21 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.(*StorageListNode).ExecuteImpl - storage-walk@v1.go:45 + storage-walk@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -58,9 +58,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_select-data.sh_l9 b/tests_e2e/references/reference_select-data.sh_l9 index c6dc69d..473941c 100644 --- a/tests_e2e/references/reference_select-data.sh_l9 +++ b/tests_e2e/references/reference_select-data.sh_l9 @@ -69,35 +69,35 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.(*SelectDataNode).OutputValueById - select-data@v1.go:34 + select-data@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById - inputs.go:364 + inputs.go:-1 github.com/actionforge/actrun-cli/core.inputValueById[...] - inputs.go:483 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...] - inputs.go:478 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputArrayValueById[...] - inputs.go:560 + inputs.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:27 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*LoopNode).ExecuteImpl - for-loop@v1.go:54 + for-loop@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -105,9 +105,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/references/reference_steps_gh.sh_l11 b/tests_e2e/references/reference_steps_gh.sh_l11 index de91528..2cf2103 100644 --- a/tests_e2e/references/reference_steps_gh.sh_l11 +++ b/tests_e2e/references/reference_steps_gh.sh_l11 @@ -6,7 +6,7 @@ no value (is optional) found for: 'config_file' no value (is optional) found for: 'env_file' no value (is optional) found for: 'session_token' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) PushNodeVisit: core-concurrent-exec-v1-gold-raspberry-jellyfish, execute: true PushNodeVisit: core-concurrent-exec-v1-plum-parrot-tangerine, execute: true PushNodeVisit: core-const-string-v1-black-snake-violet, execute: false @@ -47,6 +47,7 @@ PushNodeVisit: right-2, execute: true PushNodeVisit: root, execute: true PushNodeVisit: start, execute: true build hasn't expired yet +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli left-2.LEFT_2: left-2.LEFT_2: left-2.LEFT_2: diff --git a/tests_e2e/references/reference_steps_gh_conclusion.sh_l11 b/tests_e2e/references/reference_steps_gh_conclusion.sh_l11 index c928fc4..5f0e8db 100644 --- a/tests_e2e/references/reference_steps_gh_conclusion.sh_l11 +++ b/tests_e2e/references/reference_steps_gh_conclusion.sh_l11 @@ -13,7 +13,8 @@ looking for value: 'session_token' looking for value: 'create_debug_session' found value in flags evaluated to: 'false' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli PushNodeVisit: start, execute: true 🟢 Execute 'Run Script (step-success)' PushNodeVisit: step-success, execute: true diff --git a/tests_e2e/references/reference_steps_gh_env.sh_l11 b/tests_e2e/references/reference_steps_gh_env.sh_l11 index c9e8c4a..6ce3337 100644 --- a/tests_e2e/references/reference_steps_gh_env.sh_l11 +++ b/tests_e2e/references/reference_steps_gh_env.sh_l11 @@ -13,7 +13,8 @@ looking for value: 'session_token' looking for value: 'create_debug_session' found value in flags evaluated to: 'false' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli PushNodeVisit: start, execute: true 🟢 Execute 'Run Script (step-set-env)' PushNodeVisit: step-set-env, execute: true diff --git a/tests_e2e/references/reference_steps_gh_forloop.sh_l11 b/tests_e2e/references/reference_steps_gh_forloop.sh_l11 index 3771da8..385a1de 100644 --- a/tests_e2e/references/reference_steps_gh_forloop.sh_l11 +++ b/tests_e2e/references/reference_steps_gh_forloop.sh_l11 @@ -13,7 +13,8 @@ looking for value: 'session_token' looking for value: 'create_debug_session' found value in flags evaluated to: 'false' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli PushNodeVisit: start, execute: true 🟢 Execute 'Run Script (init-step)' PushNodeVisit: init-step, execute: true diff --git a/tests_e2e/references/reference_steps_gh_heredoc.sh_l11 b/tests_e2e/references/reference_steps_gh_heredoc.sh_l11 index 69c59ae..a643935 100644 --- a/tests_e2e/references/reference_steps_gh_heredoc.sh_l11 +++ b/tests_e2e/references/reference_steps_gh_heredoc.sh_l11 @@ -13,7 +13,8 @@ looking for value: 'session_token' looking for value: 'create_debug_session' found value in flags evaluated to: 'false' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli PushNodeVisit: start, execute: true 🟢 Execute 'Run Script (step-heredoc)' PushNodeVisit: step-heredoc, execute: true diff --git a/tests_e2e/references/reference_steps_gh_path.sh_l11 b/tests_e2e/references/reference_steps_gh_path.sh_l11 index eee59a7..4360e12 100644 --- a/tests_e2e/references/reference_steps_gh_path.sh_l11 +++ b/tests_e2e/references/reference_steps_gh_path.sh_l11 @@ -13,7 +13,8 @@ looking for value: 'session_token' looking for value: 'create_debug_session' found value in flags evaluated to: 'false' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli PushNodeVisit: start, execute: true 🟢 Execute 'Run Script (step-add-path)' PushNodeVisit: step-add-path, execute: true diff --git a/tests_e2e/references/reference_steps_gh_sequential.sh_l11 b/tests_e2e/references/reference_steps_gh_sequential.sh_l11 index d56b934..563085c 100644 --- a/tests_e2e/references/reference_steps_gh_sequential.sh_l11 +++ b/tests_e2e/references/reference_steps_gh_sequential.sh_l11 @@ -13,7 +13,8 @@ looking for value: 'session_token' looking for value: 'create_debug_session' found value in flags evaluated to: 'false' -GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell)changing working directory to GITHUB_WORKSPACE: [REDACTED]/scripts +GitHub workflow detected via GITHUB_ACTIONS environment variable (.env or shell) +changing working directory to GITHUB_WORKSPACE: [REDACTED]/actrun-cli PushNodeVisit: start, execute: true 🟢 Execute 'Run Script (step1)' PushNodeVisit: step1, execute: true diff --git a/tests_e2e/references/reference_string-transform.sh_l61 b/tests_e2e/references/reference_string-transform.sh_l61 index 8bc6742..ca8db45 100644 --- a/tests_e2e/references/reference_string-transform.sh_l61 +++ b/tests_e2e/references/reference_string-transform.sh_l61 @@ -33,31 +33,31 @@ error: stack trace: github.com/actionforge/actrun-cli/nodes.(*StringTransform).OutputValueById - string-transform@v1.go:63 + string-transform@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Inputs).InputValueById - inputs.go:364 + inputs.go:-1 github.com/actionforge/actrun-cli/core.inputValueById[...] - inputs.go:483 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputValueFromSubInputs[...] - inputs.go:478 + inputs.go:-1 github.com/actionforge/actrun-cli/core.InputArrayValueById[...] - inputs.go:560 + inputs.go:-1 github.com/actionforge/actrun-cli/nodes.(*PrintNode).ExecuteImpl - print@v1.go:27 + print@v1.go:-1 github.com/actionforge/actrun-cli/core.(*Executions).Execute - executions.go:68 + executions.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteImpl - start@v1.go:50 + start@v1.go:-1 github.com/actionforge/actrun-cli/nodes.(*StartNode).ExecuteEntry - start@v1.go:45 + start@v1.go:-1 github.com/actionforge/actrun-cli/core.RunGraph - graph.go:514 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromString - graph.go:1104 + graph.go:-1 github.com/actionforge/actrun-cli/core.RunGraphFromFile - graph.go:1126 + graph.go:-1 github.com/actionforge/actrun-cli/cmd.cmdRootRun - cmd_root.go:188 + cmd_root.go:-1 github.com/spf13/cobra.(*Command).execute command.go:-1 github.com/spf13/cobra.(*Command).ExecuteC @@ -65,9 +65,9 @@ github.com/spf13/cobra.(*Command).ExecuteC github.com/spf13/cobra.(*Command).Execute command.go:-1 github.com/actionforge/actrun-cli/cmd.Execute - cmd_root.go:200 + cmd_root.go:-1 main.main - main.go:26 + main.go:-1 runtime.main proc.go:-1 runtime.goexit diff --git a/tests_e2e/tests_e2e.py b/tests_e2e/tests_e2e.py index e390386..424287e 100644 --- a/tests_e2e/tests_e2e.py +++ b/tests_e2e/tests_e2e.py @@ -147,6 +147,16 @@ def collect_shell_scripts(directory: str) -> list[str]: print(f"Skipping {os.path.basename(script)} (platform: {script_platform}, current: {CURRENT_PLATFORM})") return filtered +STACK_TRACE_LINE_PATTERN = re.compile(r'(\t\S+:)\d+') + +def normalize_stack_trace_lines(ref_dir: str, script_name: str): + """Normalize unstable line numbers in stack traces to -1.""" + for ref_file in Path(ref_dir).glob(f"reference_{script_name}_l*"): + content = ref_file.read_text(encoding="utf-8") + modified = STACK_TRACE_LINE_PATTERN.sub(r'\g<1>-1', content) + if modified != content: + ref_file.write_text(modified, encoding="utf-8") + def create_temp_script() -> str: fd, path = tempfile.mkstemp(suffix=".sh") os.close(fd) @@ -280,6 +290,7 @@ def process_and_run_test(root_dir: str, source_script: str, ref_dir: str, cov_di tmp_cwd = tempfile.mkdtemp(prefix=f"actrun.{script_name}") print(f"Running script: {source_script} -> {temp_script_path}:\n cwd: {tmp_cwd}\n") run_test_script(root_dir, temp_script_path, tmp_cwd) + normalize_stack_trace_lines(ref_dir, script_name) def compile_binaries(is_github_runner: bool): if is_github_runner: