Skip to content

fix(cmd): Fix all the outputs - #6550

Merged
thomastaylor312 merged 3 commits into
helm:dev-v3from
thomastaylor312:fix/missing_debug
Oct 7, 2019
Merged

thomastaylor312 merged 3 commits into
helm:dev-v3from
thomastaylor312:fix/missing_debug

Conversation

@thomastaylor312

Copy link
Copy Markdown
Contributor

There were two different methods and varying ways to output the status of a release.
This standardizes all of the outputs, but requires a breaking change. Output will
not perfectly match previous v3 output, and we had to break the printing function
in the action package, but now things are much more standardized.

Fixes #6238

@thomastaylor312 thomastaylor312 added breaking bug Categorizes issue or PR as related to a bug. v3.x Issues and Pull Requests related to the major version v3 labels Oct 1, 2019
@thomastaylor312 thomastaylor312 added this to the 3.0.0-beta.4 milestone Oct 1, 2019
@helm-bot helm-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 1, 2019

@adamreese adamreese left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. It has bugged me for some time.

Comment thread pkg/action/printer.go Outdated
}

if strings.EqualFold(rel.Info.Description, "Dry run complete") {
if fullInfo {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kinds of information should be in fullInfo verses regular info. If a value is added how would I make the decision?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally know what it is, but I think the best way around this is a comment. I'm thinking something like

Anything printed in this block should be additional information about the release that is not necessarily needed for normal output (like the full manifest or all of the computed values). Basic information such as the name, revision, and release date should always be printed

Comment thread pkg/action/printer.go Outdated
func PrintRelease(out io.Writer, rel *release.Release) {
// PrintRelease prints info about a release. If fullInfo is true, it will print
// the user supplied values and the computed values used to render the chart
func PrintRelease(out io.Writer, rel *release.Release, fullInfo bool) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking out the fullInfo logic into its own function would allow you to refactor out the boolean flag

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason it is in here is for ordering purposes. I tried to think of a way that would preserve the current output formatting order with a separate function, but if we want to maintain the input the same, it needs to be in the middle. Basically, I could have this function take a function parameter that can insert things (like func PrintRelease(out io.Writer, rel *release.Release, extras ExtraFunc...)). But as this is specifically for printing a whole release, I feel like it makes sense here. Any ideas how I could make it cleaner?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also break the current output ordering, which would probably be fine given how this is already breaking other things. That would also solve this issue

Comment thread pkg/action/printer.go Outdated
}
fmt.Fprintf(out, "NAMESPACE: %s\n", rel.Namespace)
fmt.Fprintf(out, "STATUS: %s\n", rel.Info.Status.String())
fmt.Fprintf(out, "REVISION: %d\n", rel.Version)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaking this in too I see. :trollface:

Comment thread cmd/helm/status.go

type statusPrinter struct {
release *release.Release
debug bool

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it is passed into the print command for fullInfo

There were two different methods and varying ways to output the status of a release.
This standardizes all of the outputs, but requires a breaking change. Output will
not perfectly match previous v3 output, and we had to break the printing function
in the `action` package, but now things are much more standardized.

Fixes helm#6238

Signed-off-by: Taylor Thomas <[email protected]>
@thomastaylor312

Copy link
Copy Markdown
Contributor Author

@adamreese and I talked and decided to do a bit heavier of a refactor here. I'll get to that at the beginning of next week

@helm-bot helm-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 7, 2019
@helm-bot helm-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 7, 2019
@thomastaylor312

thomastaylor312 commented Oct 7, 2019 •

Copy link
Copy Markdown
Contributor Author

Ok, I finished an additional refactor. Several breaking changes of note:

  • PrintRelease has been entirely removed from the action package and now is a CLI tool only detail in the cmd package
  • Output formats and the like have now been moved to pkg/cli/output as they didn't really belong in action anymore

I also added a cobra/pflag implementation for the output format in cmd so that we don't have to validate the format everywhere we use it

PLEASE NOTE: The large amounts of files changed in this were just updating the "golden" test files to match the new output

@bacongobbler bacongobbler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I like the change to the time output formatting as well. Much more human-readable.

@adamreese adamreese left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎵 Time is on my side, yes it is 🎵

@thomastaylor312
thomastaylor312 merged commit 0210d43 into helm:dev-v3 Oct 7, 2019
@thomastaylor312
thomastaylor312 deleted the fix/missing_debug branch October 7, 2019 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking bug Categorizes issue or PR as related to a bug. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. v3.x Issues and Pull Requests related to the major version v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants