-
Notifications
You must be signed in to change notification settings - Fork 376
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
fix: go module requirements for semantic versioning #240
fix: go module requirements for semantic versioning #240
Conversation
Welcome @alex1989hu! |
Hi @alex1989hu. Thanks for your PR. I'm waiting for a kubernetes-csi 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. |
/assign @xing-yang |
/ok-to-test |
This needs a release note as it is a breaking change. |
Did I miss something during examining of Furthermore, if we create symlink then we break Windows users. |
Yeah, external-provisioner is probably ok for now, but it will break others who are using the existing path. @pohly can you explain why csi-test needs to keep the symlink? |
Xing Yang <[email protected]> writes:
Yeah, external-provisioner is probably ok for now, but it will break
others who are using the existing path.
Anyone trying to import "v2.0.0" already got broken when that version
was tagged. This PR just fixes that.
@pohly can you explain why csi-test needs to keep the symlink?
The rationale was that csi-test might get imported by a larger variety
of different CSI drivers of which some perhaps still are doing vendoring
with dep. For example, PMEM-CSI... however, since then we have also
switched to "go mod" in PMEM-CSI.
For external-snapshotter, the number of downstream projects is probably
smaller and well-known (i.e. just external-provisioner).
|
Chatted with @msau42 . She also suggested to keep symlink for backward compatibility now as there are folks who use external-snapshotter repo. |
I have just added two additional commit with the requested modification |
This one should be modified too: |
Done 👍 |
On a second thought, since everything under v2 is thru a symlink, I think the files should be generated directly under pkg as before. Can you change this back? I looked at the rest of the changes. They look good to me. Once you change this one back, I'll merge it. Thanks. |
Honestly, currently I am not familiar with I made the following scenarios: Scenario 1Drop commit Result: ❌ # bash -x hack/update-generated-code.sh
+ set -o errexit
+ set -o nounset
+ set -o pipefail
++ unset CDPATH
+++ dirname hack/update-generated-code.sh
++ cd hack/..
++ pwd
+ SCRIPT_ROOT=/external-snapshotter
++ cd /external-snapshotter
++ ls -d -1 ./vendor/k8s.io/code-generator
+ CODEGEN_PKG=./vendor/k8s.io/code-generator
+ bash ./vendor/k8s.io/code-generator/generate-groups.sh deepcopy,client,informer,lister github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis volumesnapshot:v1beta1 --go-header-file /external-snapshotter/hack/boilerplate.go.txt
Generating deepcopy funcs
F0120 14:31:30.799150 9534 main.go:82] Error: Failed making a parser: unable to add directory "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1": unable to import "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1": go/build: importGo github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1: exit status 1
go: finding github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1 latest
go: finding github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot latest
go: finding github.com/kubernetes-csi/external-snapshotter/pkg/apis latest
go: finding github.com/kubernetes-csi/external-snapshotter/pkg latest
go: finding github.com/kubernetes-csi/external-snapshotter v1.2.2
go: downloading github.com/kubernetes-csi/external-snapshotter v1.2.2
go: extracting github.com/kubernetes-csi/external-snapshotter v1.2.2
can't load package: package github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1: unknown import path "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1": cannot find module providing package github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1 Scenario 2Drop commits: ConclusionThose are package path, not physical location of files. |
Running update-generated-code.sh should be able re-generate everything under https://github.com/kubernetes-csi/external-snapshotter/tree/master/pkg/client. If I delete everything under pkg/client, it won't be re-generated any more. If we let everything to be generated under v2, then they are no longer symlinks. |
Okay, I will drop the last commit and force push the branch |
So even if the last commit is dropped, I still have problem re-generate files under client. I have not found out the best solution yet. I wonder if v2/* should be the physical path while pkg and cmd should be symlinks. |
I dropped the last commit locally and I think
You add # pwd
/go/src/github.com/kubernetes-csi/external-snapshotter
# bash -x hack/update-generated-code.sh
+ set -o errexit
+ set -o nounset
+ set -o pipefail
++ unset CDPATH
+++ dirname hack/update-generated-code.sh
++ cd hack/..
++ pwd
+ SCRIPT_ROOT=/go/src/github.com/kubernetes-csi/external-snapshotter
++ cd /go/src/github.com/kubernetes-csi/external-snapshotter
++ ls -d -1 ./vendor/k8s.io/code-generator
+ CODEGEN_PKG=./vendor/k8s.io/code-generator
+ bash ./vendor/k8s.io/code-generator/generate-groups.sh deepcopy,client,informer,lister github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis volumesnapshot:v1beta1 --go-header-file /go/src/github.com/kubernetes-csi/external-snapshotter/hack/boilerplate.go.txt
Generating deepcopy funcs
F0120 17:44:24.285299 5755 main.go:82] Error: Failed making a parser: unable to add directory "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1": unable to import "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1": go/build: importGo github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1: exit status 1
go: finding github.com/kubernetes-csi/external-snapshotter v1.2.2
go: downloading github.com/kubernetes-csi/external-snapshotter v1.2.2
go: extracting github.com/kubernetes-csi/external-snapshotter v1.2.2
can't load package: package github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1: module github.com/kubernetes-csi/external-snapshotter@latest found (v1.2.2), but does not contain package github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1 It is weird that diff --git a/go.sum b/go.sum
index c6aa7aff..d023d559 100644
--- a/go.sum
+++ b/go.sum
@@ -129,6 +129,7 @@ github.com/kubernetes-csi/csi-lib-utils v0.7.0 h1:t1cS7HTD7z5D7h9iAdjWuHtMxJPb9s
github.com/kubernetes-csi/csi-lib-utils v0.7.0/go.mod h1:bze+2G9+cmoHxN6+WyG1qT4MDxgZJMLGwc7V4acPNm0=
github.com/kubernetes-csi/csi-test v2.0.0+incompatible h1:ia04uVFUM/J9n/v3LEMn3rEG6FmKV5BH9QLw7H68h44=
github.com/kubernetes-csi/csi-test v2.0.0+incompatible/go.mod h1:YxJ4UiuPWIhMBkxUKY5c267DyA0uDZ/MtAimhx/2TA0=
+github.com/kubernetes-csi/external-snapshotter v1.2.2 h1:OPXoJydNqkWjhLwJ20dSqOhkmUYcpm+CCO0pYm+C8Q8=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= It looks like Go Modules "ecosystem" wants to have those package with no success. I think once we merge this in and tag the repository we will able to re-generate again. My proposal is to drop the last commit as you suggested, tag the repository what @pohly said. Thoughts? |
It looks like csi-test has been releasing directly from master without cutting a release-xxx branch. External-snapshotter has release-2.0 branch. So once this change is merged, the normal procedure is to backport it to release-2.0 before cutting the 2.0.1 release. |
Rebased and dropped commit |
Can you reword the release notes following the release notes in kubernetes-csi/csi-test#232? |
Can you also squash your commits into one? |
This commit also adds the compatibility with dep (Go dependency management tool) via symlink creation (same method applied in kubernetes-csi/csi-test) TODO: fix hack/update-generated-code.sh Fixes issue #239. Signed-off-by: Alex Szakaly <[email protected]>
Squashed commits into one and added |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alex1989hu, xing-yang 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 |
f8c8cc4 Merge pull request kubernetes-csi#237 from msau42/prow b36b5bf Merge pull request kubernetes-csi#240 from dannawang0221/upgrade-go-version adfddcc Merge pull request kubernetes-csi#243 from pohly/git-subtree-pull-fix c465088 pull-test.sh: avoid "git subtree pull" error 7b175a1 Update csi-test version to v5.2.0 987c90c Update go version to 1.21 to match k/k 2c625d4 Add script to generate patch release notes git-subtree-dir: release-tools git-subtree-split: f8c8cc4
…ersion Update go version to 1.21 to match k/k
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fix go module requirements for semantic versioning
Which issue(s) this PR fixes:
Fixes #239
Special notes for your reviewer:
As per reviewer's request, added the compatibility with dep (Go dependency management tool). TODO: fix hack/update-generated-code.sh
Does this PR introduce a user-facing change?: