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

generate: translate genpolicy logs, show warnings #633

Merged
merged 1 commit into from
Jun 26, 2024
Merged

Conversation

katexochen
Copy link
Member

Previously, we would collect the output with RUST_LOG=info, but only print it in case the invocation failed, thus swallowing any warnings. This PR introduces a log translator, that parses the output of genpolicy line by line and filters the output with regard to the currently configured log level. As a consequence, warnings are now shown by default, and when we configure debug logging in the Contrast CLI, the info logging of genpolicy is shown. However, in case genpolicy fails and the CLI debug level is info, we will now get slightly less output.

Example output (CLI loglevel info):

✔️ Patched targets
time=2024-06-26T08:03:50.284+02:00 level=WARN msg="Skipping symlink with long link name (NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem, 48 bytes, NetLock_Arany_=Class_Gold=_Ftanstvny.pem, 40 bytes): etc/ssl/certs/988a38cb.0"
time=2024-06-26T08:03:50.284+02:00 level=WARN msg="Skipping symlink with long link name (/usr/share/ca-certificates/mozilla/NetLock_Arany_=Class_Gold=_Főtanúsítvány.crt, 83 bytes, /usr/share/ca-certificates/mozilla/NetLock_Arany_=Class_Gold=_Ftanstvny.crt, 75 bytes): etc/ssl/certs/NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem"
time=2024-06-26T08:04:28.788+02:00 level=WARN msg="Failed to parse user as u32, using uid = 0 - error invalid digit found in string" position=genpolicy::registry
✔️ Generated workload policy annotations
✔️ Updated manifest workspace/manifest.json

@katexochen katexochen added the changelog PRs that should be part of the release notes label Jun 26, 2024
@katexochen katexochen requested review from burgerdev and msanft June 26, 2024 06:17
cli/cmd/generate.go Show resolved Hide resolved
cli/cmd/generate.go Show resolved Hide resolved
@katexochen katexochen force-pushed the p/genpolicy-logs branch 2 times, most recently from f748605 to 3964914 Compare June 26, 2024 09:43
@katexochen katexochen requested a review from burgerdev June 26, 2024 10:56
Copy link
Contributor

@burgerdev burgerdev left a comment

Choose a reason for hiding this comment

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

Thanks!

@katexochen katexochen merged commit 896004d into main Jun 26, 2024
8 checks passed
@katexochen katexochen deleted the p/genpolicy-logs branch June 26, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog PRs that should be part of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants