Skip to content

Commit

Permalink
fix(stage): panic when stage.script is not wholly known
Browse files Browse the repository at this point in the history
  • Loading branch information
srevinsaju committed Oct 31, 2023
1 parent 7fd24d4 commit 79351bf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/ci/stage_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,16 @@ func (s *Stage) parseCommand(evalCtx *hcl.EvalContext, shell string, script cty.
// emptyCommands - specifies if both args and scripts were unset
emptyCommands := false
if script.Type() == cty.String {
if !script.IsKnown() {
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "invalid script",
Detail: fmt.Sprintf("script is not a valid string"),
Subject: s.Script.Range().Ptr(),
EvalContext: evalCtx,
})
return command{}, diags
}
if shell == "bash" {
runArgs = append(runArgs, "-e", "-u", "-c", script.AsString())
} else if shell == "sh" {
Expand Down

0 comments on commit 79351bf

Please sign in to comment.