Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Return correct status when using custom policy #5156

Merged
merged 13 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/core/runtime/run_step_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ func (r *RunStepRunner) Run(
err = fmt.Errorf("%s: running %q in %q: \n%s", err, command, path, output)
if !ctx.CustomPolicyCheck {
ctx.Log.Debug("error: %s", err)
return "", err
}
ctx.Log.Debug("Treating custom policy tool error exit code as a policy failure. Error output: %s", err)
return "", err
X-Guardian marked this conversation as resolved.
Show resolved Hide resolved
}

switch postProcessOutput {
Expand Down
1 change: 1 addition & 0 deletions server/core/runtime/run_step_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func TestRunStepRunner_Run(t *testing.T) {
TerraformVersion: projVersion,
ProjectName: c.ProjectName,
EscapedCommentArgs: []string{"-target=resource1", "-target=resource2"},
CustomPolicyCheck: true,
X-Guardian marked this conversation as resolved.
Show resolved Hide resolved
}
out, err := r.Run(ctx, nil, c.Command, tmpDir, map[string]string{"test": "var"}, true, valid.PostProcessRunOutputShow)
if c.ExpErr != "" {
Expand Down
Loading