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

update protoc and related #552

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

huww98
Copy link
Contributor

@huww98 huww98 commented Oct 1, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

updated protoc to v25.2
updated protoc-gen-go to v1.32.0
added protoc-gen-go-grpc at v1.3.0

Modified the Makefile to use "go install" to install tools.
Use extended regular expressions in "sed" command.

Which issue(s) this PR fixes:

Fixes build on arm MacOS host
Maybe Fixing #471, not tested

Special notes for your reviewer:

Does this PR introduce an API-breaking change?:

none

@huww98
Copy link
Contributor Author

huww98 commented Oct 1, 2023

cc @jdef

@huww98
Copy link
Contributor Author

huww98 commented Oct 5, 2023

@saad-ali Fixed GitHub action. It seems we are not running protoc there, also fixed this.

spec/Makefile

Lines 46 to 48 in 80d5310

# The file exists, but could be out-of-date.
$(CSI_GO): $(CSI_PROTO)
$(MAKE) -C lib/go csi/csi.pb.go

This rule is not running because the timestamp of csi.proto is not updated.

It seems to me that we should remove all the diff in Makefile, and rely on git to check for updated file.

@saad-ali
Copy link
Member

@huww98
Copy link
Contributor Author

huww98 commented Nov 15, 2023

@saad-ali I just sent the CCLA. Please check.

@saad-ali
Copy link
Member

Confirmed, CCLA received. Thank you @huww98!

@xing-yang
Copy link
Contributor

cc @bswartz

@jdef
Copy link
Member

jdef commented Dec 9, 2023

are we sure there are no breaking API changes here? e.g. the APIs exposed from the generated bindings seem to have changed considerably. i realize that there were no changes to the CSI API specification, but I wonder about potential breakage for folks relying on anything generated by the old compilers that may have changed. not that we want to block this PR because of that - but the potential for downstream breakage should probably be noted somewhere.

also, has anyone attempted to run these newly generated bindings against some sort of CO-maintained test suite? "CSI sanity" (or similar) comes to mind. or, at least, tried to recompile CO/CSI integration layers in conjunction w/ the changes herein?

@huww98
Copy link
Contributor Author

huww98 commented Dec 10, 2023

The only breaking I'm aware of is this:

The UnimplementedServer struct is now required to be embedded in implementations of the generated Server interface.

I will try this change on existing CSI driver and Kubernetes, and report back soon.

@huww98
Copy link
Contributor Author

huww98 commented Dec 10, 2023

@jdef See here for how I get csi-driver-host-path to work with this change. I tested this with csi-sanity. Both from master branch and recompiled with this change (I made some changes to the mock driver used in testing to compile it). The result is:

Ran 73 of 84 Specs in 0.630 seconds
SUCCESS! -- 73 Passed | 0 Failed | 1 Pending | 10 Skipped

go.mod Outdated Show resolved Hide resolved
Copy link
Member

@saad-ali saad-ali left a comment

Choose a reason for hiding this comment

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

It looks like there are a lot of different changes some fixing issues, some refactoring.

Would you be willing to break the changes in to smaller (more targeted) PRs? Or would you be willing to attend one of the monthly CSI community meetings to walk us through the changes?

go.mod Outdated Show resolved Hide resolved
lib/go/Makefile Outdated
@@ -21,7 +21,7 @@ export GOPATH

# Only set PROTOC_VER if it has an empty value.
ifeq (,$(strip $(PROTOC_VER)))
PROTOC_VER := 3.9.1
PROTOC_VER := 24.3
Copy link
Member

Choose a reason for hiding this comment

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

Per @bswartz where does this version number come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just the latest version from https://github.com/protocolbuffers/protobuf/releases when I open this PR. I will update it again.

@huww98
Copy link
Contributor Author

huww98 commented Feb 1, 2024

Would you be willing to break the changes in to smaller (more targeted) PRs?

It is hard. The old version does not support my arm64 MacBook. I have to upgrade the version first then tweak the Makefile to make it compile.

Or would you be willing to attend one of the monthly CSI community meetings to walk us through the changes?

OK if that is necessary.

@huww98
Copy link
Contributor Author

huww98 commented Feb 1, 2024

I've reviewed the meeting record yesterday. About the GitHub action, I've fixed it in this PRs. Please see https://github.com/huww98/csi-spec/actions/runs/7736057831/job/21092762877 .

In the action, It downloads all dependencies, run protoc, then compile the generated go file to make sure it compiles at least. Plus I have tried to integrate it into csi-driver-host-path and csi-sanity manually. I think this change should be safe enough.

lib/go/Makefile Outdated Show resolved Hide resolved
lib/go/Makefile Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@jdef
Copy link
Member

jdef commented Feb 7, 2024 via email

go.mod Outdated Show resolved Hide resolved
@saad-ali
Copy link
Member

@huww98 came to the CSI meeting and walked us through the changes.

@huww98 has one more commit that may need to be added to this.

Copy link
Contributor

@bswartz bswartz left a comment

Choose a reason for hiding this comment

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

This doesn't work on my system. The command "go env GOBIN" returns the empty string, and therefore I later get this error:

.protoc/bin/protoc -I../.. --go-grpc_out=csi --go_out=csi
--go_opt=paths=source_relative --go-grpc_opt=paths=source_relative
"csi.proto"
protoc-gen-go-grpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
make[1]: *** [Makefile:83: csi/csi.pb.go] Error 1
make[1]: Leaving directory '~/src/spec/lib/go'
make: *** [Makefile:20: lib/go/csi/csi_grpc.pb.go] Error 2

updated protoc to v25.2
updated protoc-gen-go to v1.32.0
added protoc-gen-go-grpc at v1.3.0

Modified the makefile to use "go install" to install tools.
Use extended regular expressions in "sed" command.

Fixes build on arm OSX host
@huww98
Copy link
Contributor Author

huww98 commented Feb 29, 2024

@bswartz fixed that.

@saad-ali Since the meeting, I've added GOBIN env support. I've also updated the second commit to avoid adding phony target then removing it, although not visible in the final codebase.

Always run "make build_go" on github actions

Always update the timesptamp of spec.md/csi.proto to make sure lib/go is built on CI
- use git to check for out-of-date generated files, avoids all the temp files and manual diff in the Makefile.
- not specify version for protoc-gen-go, it will use the version from go.mod
- do not copy over the protoc binary. Call it directly from unzipped path. So it can find the includes automatically, and we don't need the -I or --go_opts=Mxxx flags.
- use paths=source_relative to generate go files directly into destination, avoid the copy.
- simplify the sed command used to extract "csi.proto" file.
Copy link
Contributor

@bswartz bswartz left a comment

Choose a reason for hiding this comment

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

/lgtm

@bswartz bswartz merged commit abf6346 into container-storage-interface:master Mar 5, 2024
2 checks passed
Copy link

@kasserater kasserater left a comment

Choose a reason for hiding this comment

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

.

BlaineEXE added a commit to BlaineEXE/cosi-api that referenced this pull request Jul 13, 2024
Modeled after:
container-storage-interface/spec#552

Update to the latest, non-deprecated versions of Google's tools for
protobuf generation.

Also update make tools to allow working with go modules outside of
GOPATH, and to build on ARM-based Macbooks.

New tools are significantly different from prior tools. Notably, the
grpc plugin is no longer supported, so the `--go-gprc_out` flag is used,
which moves some generated content from `cosi.pb.go` to a new
`cosi_grpc.pb.go` file.

We are still able to keep fake-gen by continuing to use deprecated tool
versions for that purpose. There's a chance that it may not serve the
COSI project long-term, but it should still work for now.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
BlaineEXE added a commit to BlaineEXE/cosi-api that referenced this pull request Jul 18, 2024
Modeled after:
container-storage-interface/spec#552

Update to the latest, non-deprecated versions of Google's tools for
protobuf generation.

Also update make tools to allow working with go modules outside of
GOPATH, and to build on ARM-based Macbooks.

New tools are significantly different from prior tools. Notably, the
grpc plugin is no longer supported, so the `--go-gprc_out` flag is used,
which moves some generated content from `cosi.pb.go` to a new
`cosi_grpc.pb.go` file.

We are still able to keep fake-gen by continuing to use deprecated tool
versions for that purpose. There's a chance that it may not serve the
COSI project long-term, but it should still work for now.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
BlaineEXE added a commit to BlaineEXE/cosi-api that referenced this pull request Jul 18, 2024
Modeled after:
container-storage-interface/spec#552

Update to the latest, non-deprecated versions of Google's tools for
protobuf generation.

Also update make tools to allow working with go modules outside of
GOPATH, and to build on ARM-based Macbooks.

New tools are significantly different from prior tools. Notably, the
grpc plugin is no longer supported, so the `--go-gprc_out` flag is used,
which moves some generated content from `cosi.pb.go` to a new
`cosi_grpc.pb.go` file.

We are still able to keep fake-gen by continuing to use deprecated tool
versions for that purpose. There's a chance that it may not serve the
COSI project long-term, but it should still work for now.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
BlaineEXE added a commit to BlaineEXE/cosi-api that referenced this pull request Jul 19, 2024
Modeled after:
container-storage-interface/spec#552

Update to the latest, non-deprecated versions of Google's tools for
protobuf generation.

Also update make tools to allow working with go modules outside of
GOPATH, and to build on ARM-based Macbooks.

New tools are significantly different from prior tools. Notably, the
grpc plugin is no longer supported, so the `--go-gprc_out` flag is used,
which moves some generated content from `cosi.pb.go` to a new
`cosi_grpc.pb.go` file.

We are still able to keep fake-gen by continuing to use deprecated tool
versions for that purpose. There's a chance that it may not serve the
COSI project long-term, but it should still work for now.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants