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

✨ Upgrade ginkgo to v2 #2522

Closed
wants to merge 1 commit into from
Closed

✨ Upgrade ginkgo to v2 #2522

wants to merge 1 commit into from

Conversation

haoxins
Copy link

@haoxins haoxins commented Feb 28, 2022

No description provided.

@k8s-ci-robot
Copy link
Contributor

Welcome @haoxins!

It looks like this is your first PR to kubernetes-sigs/kubebuilder 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kubebuilder has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @haoxins. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: haoxins
To complete the pull request process, please assign pwittrock after the PR has been reviewed.
You can assign the PR to them by writing /assign @pwittrock in a comment when ready.

The full list of commands accepted by this bot can be found 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

@haoxins haoxins changed the title mod: Upgrade ginkgo to v2 🌱 Upgrade ginkgo to v2 Feb 28, 2022
@camilamacedo86
Copy link
Member

/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 Mar 2, 2022
@@ -104,9 +104,7 @@ var _ = BeforeSuite(func(done Done) {

_, err := testenv.Start()
Expect(err).NotTo(HaveOccurred())

close(done)
}, 60)
Copy link
Member

Choose a reason for hiding this comment

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

Why the done was removed here?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Shows that the migration for this one is:

It("...", func() {
	done := make(chan interface{})
	go func() {
		// user test code to run asynchronously
		close(done) //signifies the code is done
	}()
	Eventually(done, timeout).Should(BeClosed())
})

Copy link
Author

Choose a reason for hiding this comment

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

yeah, if async is important for us, we can do that.
Also, custom reports~

. "github.com/onsi/gomega"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
Copy link
Member

Choose a reason for hiding this comment

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

why the printer was removed?

@@ -44,9 +43,7 @@ var testEnv *envtest.Environment
func TestAPIs(t *testing.T) {
RegisterFailHandler(Fail)

RunSpecsWithDefaultAndCustomReporters(t,
"Controller Suite",
[]Reporter{printer.NewlineReporter{}})
Copy link
Member

Choose a reason for hiding this comment

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

Why we are changing the default scaffold more than just the import?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

So, how could we achieve the same with the v2? Are we able to provide it via the scaffolds? How will it impact the author's projects?

Also, it shows a breaking change for authors' projects so the emoji needs to be changed to warning :

Copy link
Member

Choose a reason for hiding this comment

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

It looks like the migration for this involves adding a ReportAfterSuite node: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#generating-custom-reports-when-a-test-suite-completes

Copy link
Member

@camilamacedo86 camilamacedo86 Mar 8, 2022

Choose a reason for hiding this comment

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

Since we need to. change the scaffold then it shows a breaking change.

github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/onsi/ginkgo/v2 v2.1.3
github.com/onsi/gomega v1.17.0
Copy link
Member

Choose a reason for hiding this comment

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

This version is probably incompatible. We need to revert the dep if/when the v1beta1 be used see: https://github.com/kubernetes-sigs/kubebuilder/blob/master/pkg/plugins/golang/v3/commons.go#L38

Copy link
Author

Choose a reason for hiding this comment

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

Some nit changes, mainly

  • Ensure that we are updating the dep but does not change the default scaffold implementation
  • Ensure that the update is valid only for the go/v3 plugin and we will do the downgrade if/when v1beta1 CRD be a scaffold for backwards compatibilities.

Also, see:

Maybe I can split the scaffold change into another PR?

Copy link
Member

Choose a reason for hiding this comment

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

@camilamacedo86 I might be totally missing something, but what does the ginkgo version have to do with the CRD version? I would expect ginkgo/v2 to work with projects that use v1beta1 CRDs. Is it just that the other dependencies we're required to use with v1beta1 CRDs use ginkgo/v1, so we're concerned that there would be issues if the kubebuilder project used v2, but the project's dependencies used v1?

The one important thing to cover is this:

  • Regardless of the CRD version (or anything else), if a project was originally scaffolded with ginkgo v1, we should continue scaffolding new APIs and webhooks with ginkgo v1.

I'm not sure I saw anything for that in my review, but if we have that covered, disregard.

Copy link
Member

@camilamacedo86 camilamacedo86 Mar 8, 2022

Choose a reason for hiding this comment

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

When we scaffold CRD v1beta1 we need to ensure that we use compatible deps with controller-gen v0.6.2 and controller-runtime v0.9.2 since these are the latest versions where we can use v1beta1 with. So, my point is that:

  • We need to check if the ginkgo v2 is compatible with or not, if not we need to try to downgrade (here)
  • However, we checked in the review that changes in the scaffolds are required and that the previous code will not work with ginkgov2 so it is a breaking change and then we cannot move forward in go/v3. We will need a go/v4 plugin to add this one. I am thinking that we should track it to address with go/v4, see: https://github.com/kubernetes-sigs/kubebuilder/milestone/26

@joelanford wdyt?

/hold

(it shows a breaking change and cannot be addressed on go/v3)

Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Some nit changes, mainly

  • Ensure that we are updating the dep but does not change the default scaffold implementation
  • Ensure that the update is valid only for the go/v3 plugin and we will do the downgrade if/when v1beta1 CRD be a scaffold for backwards compatibilities.

Also, see:

@haoxins haoxins changed the title 🌱 Upgrade ginkgo to v2 ✨ Upgrade ginkgo to v2 Mar 2, 2022
@haoxins
Copy link
Author

haoxins commented Mar 2, 2022

@camilamacedo86 I just reverted the change to scaffold so that I can finish the plugin/v3 change tomorrow.
I prefer to do that in another PR, but fine if you think they should be done as a whole.

@haoxins
Copy link
Author

haoxins commented Mar 3, 2022

Some nit changes, mainly

  • Ensure that we are updating the dep but does not change the default scaffold implementation
  • Ensure that the update is valid only for the go/v3 plugin and we will do the downgrade if/when v1beta1 CRD be a scaffold for backwards compatibilities.

Also, see:

Updated~

revert useless change

revert

chore

change v3 scaffolds base on CRD version

fix

fix

fix

apply

fix
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Mar 3, 2022

@haoxins: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kubebuilder-e2e-k8s-1-15-12 59d4527 link true /test pull-kubebuilder-e2e-k8s-1-15-12

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 8, 2022
Copy link
Member

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

Hi @haoxins,

We checked in the review that changes in the scaffolds are required and that the previous code will not work with ginkgo v2 so it is a breaking change and then we cannot move forward in go/v3. We will need a go/v4 plugin to add this one. I am thinking that we should track it to address with go/v4, see: https://github.com/kubernetes-sigs/kubebuilder/milestone/26. WDYT Could you help us out by doing that and linking this PR?

See:

Also, you can check the policy: https://github.com/kubernetes-sigs/kubebuilder/blob/master/VERSIONING.md#introducing-changes-to-plugins

@joelanford wdyt? Have you objections to it?

@haoxins
Copy link
Author

haoxins commented Mar 9, 2022

  1. 👍 If async and custom reports are required for us, I can implement these changes.
  2. I just created an issue for this PR to track the upgrade for go/v4 milestone and other discussions, see Upgrade ginkgo to v2 for go/v4 plugin #2532.

@camilamacedo86
Copy link
Member

Hi @haoxins,

I am closing this one since we can plan that for go/v4 and we could check that is a breaking change and I hope that you do not mind. Thank you it will be helpful for we achieve it with go/v4 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants