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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refreshing output not stripped in error output with 'strip_refreshing' on custom run command #4442

Closed
rossstr-clickup opened this issue Apr 16, 2024 · 1 comment 路 Fixed by #4443
Labels
bug Something isn't working

Comments

@rossstr-clickup
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

#3518 Introduced a feature to filter output when running custom commands. However, if the plan workflow uses a custom run step to execute the plan, and the plan errors, the refreshing output is carried through in the error. This can lead to lengthy error comments.

This should be solvable by moving the location at which strip_refreshing is applied.

Reproduction Steps

Run plan with a custom run step, which has output: strip_refreshing set, and run a plan which results in an error.

Logs

Environment details

Additional Context

@rossstr-clickup rossstr-clickup added the bug Something isn't working label Apr 16, 2024
@rossstr-clickup rossstr-clickup changed the title refreshing output not stripped in error output refreshing output not stripped in error output with 'strip_refreshing' on custom run command Apr 16, 2024
@pseudomorph
Copy link
Contributor

Perhaps something like this:

https://github.com/runatlantis/atlantis/blob/main/server/core/runtime/run_step_runner.go#L72-L93

	output, err := runner.Run(ctx)

+	if postProcessOutput == valid.PostProcessRunOutputStripRefreshing {
+		output = StripRefreshingFromPlanOutput(output, tfVersion)
+	}

	if err != nil {
		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)
	}

	switch postProcessOutput {
	case valid.PostProcessRunOutputHide:
		return "", nil
	case valid.PostProcessRunOutputStripRefreshing:
-		return StripRefreshingFromPlanOutput(output, tfVersion), nil
+		return output, nil
	case valid.PostProcessRunOutputShow:
		return output, nil
	default:
		return output, nil
	}

I imagine that hiding output in cases of error is undesirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants