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

zarf command line execution error logging and log file readability #890

Closed
brianrexrode opened this issue Oct 12, 2022 · 13 comments · Fixed by #1889
Closed

zarf command line execution error logging and log file readability #890

brianrexrode opened this issue Oct 12, 2022 · 13 comments · Fixed by #1889
Labels
documentation 📘 Improvements or additions to documentation
Milestone

Comments

@brianrexrode
Copy link

Is your feature request related to a problem? Please describe.
When executing zarf package deploy from a command line, the erroring reporting seems inconsistent.
Example 1:
A deployment.yaml is missing spec.selector.
zarf output:
Screen Shot 2022-10-12 at 8 43 51 AM

Example 2:
A deployment.yaml is missing spec.template.metadata
zarf output:
Screen Shot 2022-10-12 at 8 47 23 AM

In both scenarios, when trying to review/troubleshoot using the associated log file with linux tools like vi, nano or simply cat the log file piped to less (cat /var/folders/bh/l8qqtz8x57j5vjd8sd33sxt40000gn/T/zarf-2022-10-12-08-46-18-3119412142.log | less) the log file is difficult to read due to the color flags.
Screen Shot 2022-10-12 at 9 09 17 AM

Describe the solution you'd like
For example 1, similar logging output to example 2.
The ability to use basic linux tools to easily review and examine the log file for troubleshooting.

Describe alternatives you've considered
Manually testing yaml files before building a zarf package (i.e. kubectl apply -f deployment.yaml) to avoid the "WARNING Unable to complete helm chart install/update" messages and application deployment failure.
Don't currently have a good alternative to viewing the logs. I can investigate other editing tools.

Additional context
Add any other context or screenshots about the feature request here.

@jeff-mccoy
Copy link
Contributor

That's interesting, cat on mac zsh (iterm / vscode) both print the color data as well, can you clarify what OS/terminal/shell you're using?

@brianrexrode
Copy link
Author

Here's what I'm working with and yeah, I like to use bash instead of zsh but don't have a great reason why 😆
Screen Shot 2022-10-13 at 7 43 31 AM
Screen Shot 2022-10-13 at 7 43 42 AM
Screen Shot 2022-10-13 at 7 44 14 AM

@Racer159
Copy link
Contributor

Racer159 commented Oct 29, 2022

In this case I believe the offender is less (I use bash as well but on popOS 22.04). Can you try with more @brianrexrode? (seems like less actually isn't more as they say).

less:
image

more:
image

@RothAndrew
Copy link
Contributor

While there may be different tools that makes this better, I believe this is a good enough use case to push forward implementation of a '--no-color' flag (or something to that effect). Likely not super high priority, but this will definitely show up again, like in a CI pipeline where the choice of tool isn't very flexible

@jeff-mccoy
Copy link
Contributor

jeff-mccoy commented Oct 30, 2022

Yeah we can probably look at that, but for FWIW, most CI systems do support ansi colors (I don't know of any that don't). I missed the fact he was using less, which I've always had issues messing up color output for me and prefer more. Also my CI flow is something like this when troubleshooting:

  • Grab a debug tar output from the pipeline
  • Extract the files
  • cat longfileIcareabout (dragged into the terminal window from finder)
  • terminal search

But I'm evil and like to use GUIs too...

@Racer159
Copy link
Contributor

Linux would set you right @jeff-mccoy 😈

image

@jeff-mccoy
Copy link
Contributor

I just like pretty things, I'm sorry I can't help it. I started using Linux in 1996 and used to live by a terminal only, but I guess I'm just too attracted to pretty interfaces...

@Racer159
Copy link
Contributor

You should give the Gnome 40 series a shot sometime. GTK4 and libadwatia are starting to bring the shiny to linux now (though admittedly there are some rough edges still, particularly for phones (yes really https://blogs.gnome.org/shell-dev/2022/09/09/gnome-shell-on-mobile-an-update/) and tablets).

@brianrexrode
Copy link
Author

I got the same results when using | more. I've probably done something weird to my terminal/shell. I'll try converting my profile back to zsh and see what I can find.

Thanks for looking into it.

Repository owner moved this from New Requests to Done in Zarf Project Board Dec 14, 2022
@Racer159
Copy link
Contributor

Racer159 commented Mar 1, 2023

Reopening this issue since I think it is worth some docs on why we did this, and how to easily view Zarf logs.

@Racer159 Racer159 reopened this Mar 1, 2023
@Racer159 Racer159 added documentation 📘 Improvements or additions to documentation and removed possible-bug 🐛 labels Mar 1, 2023
@Racer159
Copy link
Contributor

Racer159 commented Mar 1, 2023

cc @Madeline-UX / @Jessy-Morris

@Racer159 Racer159 added this to the v0.25.x milestone Mar 1, 2023
@Racer159
Copy link
Contributor

Racer159 commented Mar 2, 2023

@Racer159 Racer159 modified the milestones: v0.25.x, v0.26.x Mar 19, 2023
@Racer159 Racer159 modified the milestones: v0.27 (m1), v0.27 (m3) Apr 25, 2023
@Racer159 Racer159 removed this from the v0.27 (m3-5.30) milestone May 31, 2023
@caesarshift
Copy link
Contributor

pterm has a DisableColor function which (largely) resolves this issue. However, zarf prints some log lines before it parses the config which means that the initial log lines still print in color:

Lines with color even with this change:

 NOTE  Using config file /Users/jonsmith/git/zarf/zarf-config.toml

 NOTE  Saving log file to
       /var/folders/jl/q_sd6kxx74dg69cf00jgr2hr0000gn/T/zarf-2023-07-07-10-48-47-3648921497.log

OR with --no-log-file

 NOTE  Using config file /Users/jonsmith/git/zarf/zarf-config.toml

I'm not sure how or if to handle these log lines.

Racer159 added a commit that referenced this issue Aug 10, 2023
## Description

Add --no-color option to disable color output

## Related Issue

Fixes #890

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed

---------

Co-authored-by: Wayne Starr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 📘 Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants