redhat-openshift-ecosystem / openshift-preflight

Operator and container preflight certification tests
Apache License 2.0
60 stars 65 forks source link

ensure per-check logger carries the check name throughout execution #1196

Closed komish closed 2 months ago

komish commented 2 months ago

When executing checks, the engine emits check names at the start and end of a check's execution, as well as with the result. We run synchronously, so for the most part, this isn't a problem, but I noticed while troubleshooting something else that logs emitted from the check itself (after pulling the logger from context) don't include the check's name, and it's a small amount of code to pass that context into the check and make the logs a bit more clear.

This PR derives a logger with the check's name as a value, stuffs that into a new context to pass to check functions, and then strips all the other locations that were manually adding the "check" key to the logger.

dcibot commented 2 months ago

from change https://github.com/redhat-openshift-ecosystem/openshift-preflight/pull/1196:

komish commented 2 months ago

/test 4.13-e2e 4.17-e2e

acornett21 commented 2 months ago

/test 4.17-e2e

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acornett21, bcrochet, komish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/redhat-openshift-ecosystem/openshift-preflight/blob/main/OWNERS)~~ [acornett21,bcrochet,komish] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
dcibot commented 2 months ago

from change https://github.com/redhat-openshift-ecosystem/openshift-preflight/pull/1196: