-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: Add an output
option to filter output for custom run steps
#3518
Conversation
output
option to filter output for custom run stepsoutput
option to filter output for custom run steps
hi @runatlantis/maintainers, is anyone available to review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is perfect for now. A very clean and scoped approach. There is no need to run arbitrary commands and I'm hesitant to overload custom workflows that much.
Please polish and add docs. I'll merge once complete. |
…unatlantis#3518) * feat: Add an `output` option to filter output for custom run steps
I saw this missed v0.25.0. Is there any estimate on when this will be released? |
@jmreicha This was included in both |
Ah, good deal. Thanks for the clarification! |
we have an issue to fix the autogenerated changelog , the filters are a bit
wrong.
…On Sat, Aug 12, 2023, 8:53 a.m. Josh Reichardt ***@***.***> wrote:
Ah, good deal. Thanks for the clarification!
—
Reply to this email directly, view it on GitHub
<#3518 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERF44XI5EFU4WNG3VPTXU6RHZANCNFSM6AAAAAAZFSEILU>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
…unatlantis#3518) * feat: Add an `output` option to filter output for custom run steps
…unatlantis#3518) * feat: Add an `output` option to filter output for custom run steps
what
Add an
output
argument to therun
step used for custom commands that can post-process command output. Allows you to do something likewhich will filter out
Refreshing state...
lines similar to how it's done when using the defaultterraform plan
steps.The valid options for
output
are:show
- the default, current behavior of echoing the outputhide
- hide the output for the entire command. Useful for setup steps whose output isn't useful to show in the posted plan comment. Theoretically for the example above, it can be used for theterragrunt plan
step, and then adding anotherterrarunt show
step that outputs the plan in human-readable form.strip_refreshing
- runs the StripRefreshingFromPlanOutput that currently runs for the default plan actionAlternatively, I also considered adding a different (or composable) option to run an arbitrary command to filter. E.g. maybe an
outputFilter
option that accepts a shell command similar tocommand
. It would receive instdin
the full output of the runcommand
to do arbitrary filtering on. Decided not to though since it'd be a bit more complex and may not really be needed.Please let me know if this is a reasonable approach, and if so I'll polish it up and add docs!
why
This significantly reduces the verbosity of the plan output posted in PR comments for workflows that use custom commands, letting these workflows match the behavior of the default plan action.
There is a potential workaround per #3386 (comment), but doing so hides the filtered output from real-time streaming logs as well. The user would have no way of seeing these filtered out log lines even if they wanted to.
tests
Tested by running the unit tests and running in a real AWS account set up using terragrunt. The
strip_refreshing
option configured above works as expected, omitting everything before the last "Refreshing state..." marker :Before this PR
After this PR
The
hide
option also works as expected, completely hiding the output for the step it is set for.references