-
Notifications
You must be signed in to change notification settings - Fork 446
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
Add consistency check for deepcopy generated files #1127
Add consistency check for deepcopy generated files #1127
Conversation
cc @Yicheng-Lu-llll would you mind reviewing this PR? |
LGTM! Also manually test it: git clone https://github.com/varungup90/kuberay.git
cd kuberay
git checkout add-generated-files-check
cd ray-operator/
# do nothing to zz_generated.deepcopy.go
./hack/verify-generated-files.sh
#root@ip-172-31-8-217:/home/ubuntu/workspace/review/kuberay/ray-operator# ./hack/verify-generated-files.sh
#/home/ubuntu/workspace/review/kuberay/ray-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" #paths="./..."
#diffing ./hack/../apis against freshly generated deepcopy files
#./hack/../apis up to date.
# manually change something to zz_generated.deepcopy.go
./hack/verify-generated-files.sh
#root@ip-172-31-8-217:/home/ubuntu/workspace/review/kuberay/ray-operator# ./hack/verify-generated-files.sh
#/home/ubuntu/workspace/review/kuberay/ray-operator/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" #paths="./..."
#diffing ./hack/../apis against freshly generated deepcopy files
#diff -Naupr ./hack/../apis/ray/v1alpha1/zz_generated.deepcopy.go #./hack/../_tmp/apis/ray/v1alpha1/zz_generated.deepcopy.go
#--- ./hack/../apis/ray/v1alpha1/zz_generated.deepcopy.go 2023-06-01 15:04:41.326004561 +0000
#+++ ./hack/../_tmp/apis/ray/v1alpha1/zz_generated.deepcopy.go 2023-06-01 15:04:37.166101782 +0000
#@@ -6,7 +6,7 @@
# package v1alpha1
# import (
#- "k8s.io/api/core/v1"
#+ v1 "k8s.io/api/core/v1"
# runtime "k8s.io/apimachinery/pkg/runtime"
# )
#./hack/../apis is out of date. Please run make generate
|
@@ -30,6 +30,10 @@ jobs: | |||
- name: Verify Codegen | |||
working-directory: ./ray-operator | |||
run: ./hack/verify-codegen.sh | |||
|
|||
- name: Verify Generated Files |
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.
Just a nit-picky comment, we can have a better name here.
-Verify Generated Files
: showing it is used to verify the aforementioned runtime.Object interface generated by kubebuilder.
-Verify Codegen
: showing it is used to verify things like clientset, lister, informer.
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 got the idea from Kubernetes repo (https://github.com/kubernetes/kubernetes/blob/v1.22.1/hack/verify-generated-files.sh). Please suggest better alternatives.
There seems to be a conflict between "Verify Generated Files" and "Go-build-and-test / Lint (pull_request)". The linter expects |
Updated test-job.yaml file where goimports ignores zz_generated.deepcopy.go file. Verified it locally using github action |
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.
LGTM.
To summarize this PR,
-
Because the generated file
zz_generated.deepcopy.go
does not adhere to thegoimport
rule (as mentioned in this issue: api/v1alpha1/zz_generated.deepcopy.go is not compliant with goimport format kubernetes-sigs/controller-tools#559), we have made the decision to exclude thegoimport
check for thezz_generated.deepcopy.go
file. -
Excluding the
goimport
check for thezz_generated.deepcopy.go
file is fine because this PR will check the consistency for the generated files.
Add consistency check for deepcopy generated files
Why are these changes needed?
Checks consistency for deepcopy generated files
Related issue number
Closes #1111
Checks