Repository navigation
fix: add error log on invalid yaml - #3042
Conversation
Paco ReviewThe PR changes the log level for YAML decode errors in ReadTektonTypes from Debug to Warn. It adds a new Paco could not check everything:
No new verified findings. This is not a guarantee that the change is defect-free. Reviewed commit: fad9332. 0 verified findings; 0 summary-only. |
There was a problem hiding this comment.
🟡 Changes recommended
The new logging call can panic with a nil logger, and tests do not assert the error-level output.
2 open issues
What changed in this PR
Makes invalid Tekton YAML more visible in controller logs, particularly for push events.
Changes:
- Adds error-level logging for document decoding failures.
- Supplies loggers to existing YAML validation tests.
| File | Description |
|---|---|
| pkg/resolve/resolve.go | Logs decoding failures at error level. |
| pkg/resolve/resolve_test.go | Adds observer-backed loggers to resolver tests. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3042 +/- ##
=======================================
Coverage 91.98% 91.98%
=======================================
Files 167 167
Lines 12965 12967 +2
=======================================
+ Hits 11926 11928 +2
Misses 1038 1038
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5c859a3 to
af659a7
Compare
| if err != nil { | ||
| dt, dv := detectAtleastNameOrGenerateNameAndSchemaFromPipelineRun(doc) | ||
| debugf(log, "ReadTektonTypes: decode error for doc name=%s schema=%s err=%v", dt, dv, err) | ||
| if log != nil { |
There was a problem hiding this comment.
How about adding errorf function which replaces the debugf statement completely instead of logging twice, once at debug and again at error?
There was a problem hiding this comment.
or maybe even just remove the debugf statement to prevent double logging
There was a problem hiding this comment.
dont we have thing like that we can commonize btw?
af659a7 to
94bb9d3
Compare
|
When i made that change in 3df2338. The decode error was kept at debug on purpose. Some repositories carry a broken file in .tekton/ for a long time, and since we parse that directory on every event (sometimes twice, with the cancel-in-progress path), an error-level line here would repeat on every push for as long as the file stays broken. That makes the controller logs noisy for admins who can't fix the user's repo anyway. If the goal is visibility on push events, emitting a Kubernetes event on the Repository (like we already do for pull requests) or logging at warn level might be a better fit... |
we can advice in docs that don't keep any unrelated files in |
|
go-testing fixed in #3048 |
4e3e0a3 to
6363f9e
Compare
|
@zakisk we had it before and konflux folks complained so we may endup with another ticket "requesting us" to be removed 🙃 |
6363f9e to
975a4c6
Compare
made it a warning |
975a4c6 to
5339b5c
Compare
during resolution of an invalid yaml, PaC logs the error as debug log while it's an error and should be highlighted in controller logs so that user can take care of it. comments are posted for invalid yamls on pull request but for push events it's not easy to find the issue with invalid yaml. Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
5339b5c to
2f350f7
Compare
|
/paco review |


📝 Description of the Change
during resolution of an invalid yaml, PaC logs the error as debug log while it's an error and should be highlighted in controller logs so that user can take care of it. comments are posted for invalid yamls on pull request but for push events it's not easy to find the issue with invalid yaml.
🔗 Linked GitHub Issue
Fixes #
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.