-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
update logcheck version and hack/verify-structured-logging.sh #103293
update logcheck version and hack/verify-structured-logging.sh #103293
Conversation
Hi @umangachapagain. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cc @serathius |
23d0e11
to
1abca60
Compare
hack/verify-structured-logging.sh
Outdated
# Trim the trailing /... from given packages | ||
ignore_packages=`cat ${KUBE_ROOT}/hack/.structured_logging | grep -oE '^[a-zA-Z0-9/]+[^/\.]'` | ||
# Packages to test = all packages - ignored packages | ||
packages=`go list ${KUBE_ROOT}/... | grep -v '$ignore_packages'` |
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.
I don't think this works, or at least when I tried it. Can you check this
packages=`go list ${KUBE_ROOT}/... | grep -v '$ignore_packages'` | |
packages=`grep -vf <(cat ./hack/.structured_logging | grep -oE '^[a-zA-Z0-9/]+[^/\.]') <(go list ./...) ` |
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.
Yes, it didn't work and I made the required changes.
1abca60
to
943769d
Compare
@serathius FYI Running the script as it is generates following errors Running structured logging static check on migrated packages
Structured logging static check passed on migrated packages :)
code in directory /home/uchapaga/go/src/k8s.io/kubernetes/staging/src/k8s.io/api/admission/v1 expects import "k8s.io/api/admission/v1"
code in directory /home/uchapaga/go/src/k8s.io/kubernetes/staging/src/k8s.io/api/admission/v1beta1 expects import "k8s.io/api/admission/v1beta1"
... This is due to import comments in some packages. This can be easily fixed by enabling Go modules, which is turned off for some reason. Should I enable it? When running with Running structured logging static check on migrated packages
Structured logging static check passed on migrated packages :)
Running structured logging static check on all other packages
pkg/generated/openapi/zz_generated.openapi.go:26:2: cannot find package "." in:
/home/uchapaga/go/src/k8s.io/kubernetes/vendor/github.com/go-openapi/spec
/home/uchapaga/go/src/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go:26:7: could not import github.com/go-openapi/spec (invalid package name: "")
/home/uchapaga/go/src/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go:26:7: could not import github.com/go-openapi/spec (invalid package name: "")
logcheck: 3 errors during loading
pkg/generated/openapi/zz_generated.openapi.go:26:2: cannot find package "." in:
/home/uchapaga/go/src/k8s.io/kubernetes/vendor/github.com/go-openapi/spec
/home/uchapaga/go/src/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go:26:7: could not import github.com/go-openapi/spec (invalid package name: "")
-: build constraints exclude all Go files in /home/uchapaga/go/src/k8s.io/kubernetes/pkg/volume/util/fsquota/common
/home/uchapaga/go/src/k8s.io/kubernetes/pkg/generated/openapi/zz_generated.openapi.go:26:7: could not import github.com/go-openapi/spec (invalid package name: "")
logcheck: 4 errors during loading
Please fix above failures. You can locally test via:
hack/verify-structured-logging.sh These are loading errors on generated packages. Should we skip testing these? |
943769d
to
9061ad7
Compare
Kubernetes builds from sources in vendor/, not in module mode. So the sources should be scanned in that mode most likely. |
@umangachapagain
PS: I'm using macOS |
d37e9c3
to
6c0ca6c
Compare
Seems like a macOS only issue that was there long before this PR. I'll need help on this. Should we open a new issue for it and move ahead with this PR (since CI runs fine and will unblock migration tests)? @serathius @shivanshu1333 |
/test pull-kubernetes-verify |
Created #105316 to unblock the PR for import errors in macOS |
/retest |
/test pull-kubernetes-verify |
Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
hack/verify-structured-logging.sh now tests migrated packages for use of unstructured logging functions and all other packages for use of correct structured logging patterns. Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
6c0ca6c
to
1dd30f6
Compare
/assign @dims @BenTheElder |
/approve leaving |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, umangachapagain 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:
Approvers can indicate their approval by writing |
/lgtm |
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR updates the version of logcheck and enhances hack/verify-structured-logging.sh.
With this change we can now test quality of structured logging migration PRs that are not yet added in .structured_logging.
Which issue(s) this PR fixes:
Fixes #102439
Special notes for your reviewer:
Since checks needs to be run on entire codebase, test time is increased as compared to testing only the migrated packages listed in .structured_logging file.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: