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: status always success when using custom policy #5156

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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 @@ -88,9 +88,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
}

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 @@ -144,6 +144,7 @@ func TestRunStepRunner_Run(t *testing.T) {
TerraformVersion: projVersion,
ProjectName: c.ProjectName,
EscapedCommentArgs: []string{"-target=resource1", "-target=resource2"},
CustomPolicyCheck: true,
}
out, err := r.Run(ctx, nil, c.Command, tmpDir, map[string]string{"test": "var"}, true, valid.PostProcessRunOutputShow)
if c.ExpErr != "" {
Expand Down
Loading