From c20a385da8da488021d0fe8800f1b4b29b7053b0 Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:41:36 -0500 Subject: [PATCH] fix(pipeline): include starlark exec limit to compiler flags in exec + validate (#504) --- command/pipeline/exec.go | 10 ++++++++++ command/pipeline/validate.go | 10 ++++++++++ command/pipeline/validate_test.go | 1 + 3 files changed, 21 insertions(+) diff --git a/command/pipeline/exec.go b/command/pipeline/exec.go index 57b55d40..d9f44fa9 100644 --- a/command/pipeline/exec.go +++ b/command/pipeline/exec.go @@ -161,6 +161,13 @@ var CommandExec = &cli.Command{ Usage: "set the maximum depth for nested templates", Value: 3, }, + &cli.Uint64Flag{ + EnvVars: []string{"VELA_COMPILER_STARLARK_EXEC_LIMIT", "COMPILER_STARLARK_EXEC_LIMIT"}, + Name: "compiler-starlark-exec-limit", + Aliases: []string{"starlark-exec-limit", "sel"}, + Usage: "set the starlark execution step limit for compiling starlark pipelines", + Value: 7500, + }, // Environment Flags &cli.BoolFlag{ @@ -299,6 +306,9 @@ func exec(c *cli.Context) error { return err } + // set starlark exec limit + client.StarlarkExecLimit = c.Uint64("compiler-starlark-exec-limit") + // set when user is sourcing templates from local machine if len(p.TemplateFiles) != 0 { client.WithLocalTemplates(p.TemplateFiles) diff --git a/command/pipeline/validate.go b/command/pipeline/validate.go index 5da71410..85da7f20 100644 --- a/command/pipeline/validate.go +++ b/command/pipeline/validate.go @@ -86,6 +86,13 @@ var CommandValidate = &cli.Command{ Usage: "set the maximum depth for nested templates", Value: 3, }, + &cli.Uint64Flag{ + EnvVars: []string{"VELA_COMPILER_STARLARK_EXEC_LIMIT", "COMPILER_STARLARK_EXEC_LIMIT"}, + Name: "compiler-starlark-exec-limit", + Aliases: []string{"starlark-exec-limit", "sel"}, + Usage: "set the starlark execution step limit for compiling starlark pipelines", + Value: 7500, + }, &cli.BoolFlag{ EnvVars: []string{"VELA_REMOTE", "PIPELINE_REMOTE"}, Name: "remote", @@ -191,6 +198,9 @@ func validate(c *cli.Context) error { return err } + // set starlark exec limit + client.StarlarkExecLimit = c.Uint64("compiler-starlark-exec-limit") + // set when user is sourcing templates from local machine if len(p.TemplateFiles) != 0 { client.WithLocal(true) diff --git a/command/pipeline/validate_test.go b/command/pipeline/validate_test.go index 2dd889f3..a4b8d03c 100644 --- a/command/pipeline/validate_test.go +++ b/command/pipeline/validate_test.go @@ -30,6 +30,7 @@ func TestPipeline_Validate(t *testing.T) { fullSet.String("repo", "octocat", "doc") fullSet.String("output", "json", "doc") fullSet.String("pipeline-type", "yaml", "doc") + fullSet.Uint64("compiler-starlark-exec-limit", 10000, "doc") fullSet.Bool("remote", true, "doc") // setup flags