Skip to content

Commit

Permalink
fix(pipeline): include starlark exec limit to compiler flags in exec …
Browse files Browse the repository at this point in the history
…+ validate (#504)
  • Loading branch information
ecrupper authored Nov 29, 2023
1 parent d87ae80 commit c20a385
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions command/pipeline/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions command/pipeline/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions command/pipeline/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c20a385

Please sign in to comment.