Skip to content
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 verify scripts for defaulters generator #549

Merged
merged 1 commit into from
Jun 30, 2021

Conversation

pravarag
Copy link
Contributor

This PR is related to: #483

This PR contains changes for verifying defaulters generator. Currently I'm facing a SIGSEGV error while trying to run verify-defaulters.sh script from local with below logs,

-bash>descheduler(verify-defaulters-gen)$
 ->  ./hack/verify-defaulters.sh
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0x12b69a7]

goroutine 1 [running]:
k8s.io/gengo/examples/defaulter-gen/generators.getManualDefaultingFunctions(0xc0080d6540, 0x0, 0xc009de99e0)
	/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler/_tmp/kube-verify.u8W7BZ/descheduler/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go:149 +0xa7
k8s.io/gengo/examples/defaulter-gen/generators.Packages(0xc0080d6540, 0xc000132e60, 0x1353d49, 0x6, 0xc0080d6540)
	/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler/_tmp/kube-verify.u8W7BZ/descheduler/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go:275 +0x79f
k8s.io/gengo/args.(*GeneratorArgs).Execute(0xc000132e60, 0xc000103050, 0x1353d49, 0x6, 0x1381050, 0x0, 0x0)
	/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler/_tmp/kube-verify.u8W7BZ/descheduler/vendor/k8s.io/gengo/args/args.go:206 +0x1b7
main.main()
	/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler/_tmp/kube-verify.u8W7BZ/descheduler/vendor/k8s.io/code-generator/cmd/defaulter-gen/main.go:76 +0x365

Opening this PR as a follow-up from this conversation: #507 (comment)

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 11, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @pravarag. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 11, 2021
@ingvagabund
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 12, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 1, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 20, 2021
@ingvagabund
Copy link
Contributor

/retest

@ingvagabund
Copy link
Contributor

@pravarag the test is still failing with:

./hack/verify-defaulters.sh
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x68 pc=0x6b3ba7]
goroutine 1 [running]:
k8s.io/gengo/examples/defaulter-gen/generators.getManualDefaultingFunctions(0xc0052a0700, 0x0, 0xc00af8f860)
	/home/prow/go/src/sigs.k8s.io/descheduler/_tmp/kube-verify.1BwmFC/descheduler/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go:149 +0xa7
k8s.io/gengo/examples/defaulter-gen/generators.Packages(0xc0052a0700, 0xc000118e60, 0x74fc51, 0x6, 0xc0052a0700)
	/home/prow/go/src/sigs.k8s.io/descheduler/_tmp/kube-verify.1BwmFC/descheduler/vendor/k8s.io/gengo/examples/defaulter-gen/generators/defaulter.go:275 +0x79f
k8s.io/gengo/args.(*GeneratorArgs).Execute(0xc000118e60, 0xc00007d020, 0x74fc51, 0x6, 0x77d430, 0x0, 0x0)
	/home/prow/go/src/sigs.k8s.io/descheduler/_tmp/kube-verify.1BwmFC/descheduler/vendor/k8s.io/gengo/args/args.go:206 +0x1b7
main.main()
	/home/prow/go/src/sigs.k8s.io/descheduler/_tmp/kube-verify.1BwmFC/descheduler/vendor/k8s.io/code-generator/cmd/defaulter-gen/main.go:76 +0x365
make: *** [Makefile:130: verify-gen] Error 2

@pravarag
Copy link
Contributor Author

@ingvagabund for the failing test, this error I've been getting since the very start. But, I'm still not able to debug that why this error coming only for this generator. I submitted separate PRs for other two generators and the changes worked without any such error. But, for this generator it's been failing with this error. Would you like to suggest any changes I could do here?

@ingvagabund
Copy link
Contributor

diff --git a/hack/verify-defaulters.sh b/hack/verify-defaulters.sh
index 1e2c7e665..a1273332b 100755
--- a/hack/verify-defaulters.sh
+++ b/hack/verify-defaulters.sh
@@ -19,8 +19,8 @@ go build -o "${OS_OUTPUT_BINPATH}/defaulter-gen" "k8s.io/code-generator/cmd/defa
 
 ${OS_OUTPUT_BINPATH}/defaulter-gen \
             --go-header-file "hack/boilerplate/boilerplate.go.txt" \
-            --input-dirs "./pkg/apis/componentconfig/v1alpha1,./pkg/api/v1alpha1" \
-            --extra-peer-dirs "./pkg/apis/componentconfig/v1alpha1,./pkg/api/v1alpha1" \
+            --input-dirs "${PRJ_PREFIX}/pkg/apis/componentconfig/v1alpha1,${PRJ_PREFIX}/pkg/api/v1alpha1" \
+                       --extra-peer-dirs "${PRJ_PREFIX}/pkg/apis/componentconfig/v1alpha1,${PRJ_PREFIX}/pkg/api/v1alpha1" \
             --output-file-base zz_generated.defaults
 popd > /dev/null 2>&1

helped to get rid of the panic.

@pravarag
Copy link
Contributor Author

helped to get rid of the panic.

@ingvagabund where did you add this part? Was it in verify-defaulters-gen script only?

@ingvagabund
Copy link
Contributor

Yeah, just updated hack/verify-defaulters.sh

@pravarag pravarag force-pushed the verify-defaulters-gen branch 3 times, most recently from b5cdb13 to 7626546 Compare June 28, 2021 16:13
@pravarag
Copy link
Contributor Author

Thanks @ingvagabund , the change has worked 😄

${OS_OUTPUT_BINPATH}/defaulter-gen \
--go-header-file "hack/boilerplate/boilerplate.go.txt" \
--input-dirs "${PRJ_PREFIX}/pkg/apis/componentconfig/v1alpha1,${PRJ_PREFIX}/pkg/api/v1alpha1" \
+ --extra-peer-dirs "${PRJ_PREFIX}/pkg/apis/componentconfig/v1alpha1,${PRJ_PREFIX}/pkg/api/v1alpha1" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you drop +? I'd expect the bash script to fail actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ingvagabund
Copy link
Contributor

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 30, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ingvagabund, pravarag

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 30, 2021
@k8s-ci-robot k8s-ci-robot merged commit 032ea70 into kubernetes-sigs:master Jun 30, 2021
briend pushed a commit to briend/descheduler that referenced this pull request Feb 11, 2022
…s-gen

Add verify scripts for defaulters generator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants