-
Notifications
You must be signed in to change notification settings - Fork 33
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
Print traces and debug messages from OPA #1139
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #1139 +/- ##
==========================================
+ Coverage 84.24% 84.86% +0.62%
==========================================
Files 64 64
Lines 5097 5109 +12
==========================================
+ Hits 4294 4336 +42
+ Misses 803 773 -30
Flags with carried forward coverage won't be shown. Click here to find out more.
|
lcarva
reviewed
Nov 1, 2023
When running at trace log level the execution trace and debug messages will be printed to the log (stderr by default), and when running at the debug log level the execution traces will be omited. For example: ``` $ ec validate image --policy $POLICY --image $IMAGE --trace ... ime="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | | | Redo true" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | | Redo __local2965__ = data.lib.tasks_from_pipelinerun" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | | Redo __local2708__ = [{\"annotations\": {\"custom\": {\"collections\": [\"redhat\"], \"depends_on\": [\"attestation_type.known_attestation_type\"], \"failure_msg\": \"Pipeline task '%s' uses an out of date task bundle '%s'\", \"short_name\": \"task_ref_bundles_current\", \"solution\": \"A task bundle used is not the most recent. The most recent task bundles are defined as in xref:acceptable_bundles.adoc#_task_bundles[acceptable bundles] list.\"}, \"description\": \"For each Task in the SLSA Provenance attestation, check if the Tekton Bundle used is the most recent xref:acceptable_bundles.adoc#_task_bundles[acceptable bundle].\", \"scope\": \"rule\", \"title\": \"Task bundles are latest versions\"}, \"path\": [\"policy\", \"release\", \"attestation_task_bundle\", \"warn\"]}, {\"annotations\": {\"description\": \"To be able to reproduce and audit builds accurately it's important to know exactly what happened during the build. To do this Enterprise Contract requires that all tasks are defined in a set of known and trusted task bundles. This package includes rules to confirm that the tasks that built the image were defined in task bundles, and that the task bundles used are from the list of known and trusted bundles.\", \"scope\": \"package\", \"title\": \"Task bundle checks\"}, \"path\": [\"policy\", \"release\", \"attestation_task_bundle\"]}]" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | Unify set() = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | Exit data.policy.release.attestation_task_bundle.warn = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] Redo data.policy.release.attestation_task_bundle.warn = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | Redo data.policy.release.attestation_task_bundle.warn = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=debug msg="[data.policy.release.attestation_task_bundle.warn] /tmp/ec-work-321015487/policy/9af95111f/bundles.rego:31: HELLO\n" func=Run file=" conftest_evaluator.go:187" ``` ``` $ ec validate image --policy $POLICY --image $IMAGE --debug ... time="2023-10-31T12:56:37+01:00" level=debug msg="[data.policy.release.attestation_task_bundle.warn] /tmp/ec-work-321015487/policy/9af95111f/bundles.rego:31: HELLO\n" func=Run file=" conftest_evaluator.go:187" ```
zregvart
force-pushed
the
pr/trace-print
branch
2 times, most recently
from
November 2, 2023 13:17
20d4ab0
to
eb7c3c4
Compare
When running at trace log level the execution trace and debug messages will be printed to the log (stderr by default), and when running at the debug log level the execution traces will be omited. For example: ``` $ ec validate image --policy $POLICY --image $IMAGE --trace ... ime="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | | | Redo true" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | | Redo __local2965__ = data.lib.tasks_from_pipelinerun" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | | Redo __local2708__ = [{\"annotations\": {\"custom\": {\"collections\": [\"redhat\"], \"depends_on\": [\"attestation_type.known_attestation_type\"], \"failure_msg\": \"Pipeline task '%s' uses an out of date task bundle '%s'\", \"short_name\": \"task_ref_bundles_current\", \"solution\": \"A task bundle used is not the most recent. The most recent task bundles are defined as in xref:acceptable_bundles.adoc#_task_bundles[acceptable bundles] list.\"}, \"description\": \"For each Task in the SLSA Provenance attestation, check if the Tekton Bundle used is the most recent xref:acceptable_bundles.adoc#_task_bundles[acceptable bundle].\", \"scope\": \"rule\", \"title\": \"Task bundles are latest versions\"}, \"path\": [\"policy\", \"release\", \"attestation_task_bundle\", \"warn\"]}, {\"annotations\": {\"description\": \"To be able to reproduce and audit builds accurately it's important to know exactly what happened during the build. To do this Enterprise Contract requires that all tasks are defined in a set of known and trusted task bundles. This package includes rules to confirm that the tasks that built the image were defined in task bundles, and that the task bundles used are from the list of known and trusted bundles.\", \"scope\": \"package\", \"title\": \"Task bundle checks\"}, \"path\": [\"policy\", \"release\", \"attestation_task_bundle\"]}]" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | Unify set() = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | Exit data.policy.release.attestation_task_bundle.warn = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] Redo data.policy.release.attestation_task_bundle.warn = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=trace msg="[data.policy.release.attestation_task_bundle.warn] | Redo data.policy.release.attestation_task_bundle.warn = _" func=Run file=" conftest_evaluator.go:180" time="2023-10-31T12:56:37+01:00" level=debug msg="[data.policy.release.attestation_task_bundle.warn] /tmp/ec-work-321015487/policy/9af95111f/bundles.rego:31: HELLO\n" func=Run file=" conftest_evaluator.go:187" ``` ``` $ ec validate image --policy $POLICY --image $IMAGE --debug ... time="2023-10-31T12:56:37+01:00" level=debug msg="[data.policy.release.attestation_task_bundle.warn] /tmp/ec-work-321015487/policy/9af95111f/bundles.rego:31: HELLO\n" func=Run file=" conftest_evaluator.go:187" ```
zregvart
force-pushed
the
pr/trace-print
branch
from
November 2, 2023 15:35
eb7c3c4
to
8ac2d13
Compare
lcarva
reviewed
Nov 2, 2023
""" | ||
And the standard error should contain | ||
""" | ||
level=debug msg="\[data.main.deny\] .*/main.rego:13: here we are |
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.
🎉
lcarva
approved these changes
Nov 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running at trace log level the execution trace and debug messages will be printed to the log (stderr by default), and when running at the debug log level the execution traces will be omited.
For example: