Skip to content

Version the CSI protobuf #74

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

Merged
merged 1 commit into from
Aug 11, 2017

Conversation

akutz
Copy link
Contributor

@akutz akutz commented Aug 10, 2017

This patch versions the generated CSI protobuf and provides a Travis-CI build step that verifies the protobuf is up-to-date before allowing any changes to be merged.

Additionally this patch also adds minimal Go language bindings in order to verify the specification. Finally, scaffolding was put into place in order to support Cxx language bindings in the future as well.

@jdef
Copy link
Member

jdef commented Aug 10, 2017

This patch also removes golang stub generation support. Other issues/PRs are trying to standardize proto stub generation: #68 #69
At some point in the near future I want the CI to test that the .proto file actually compiles -- losing that capability as part of this patch is unfortunate.

@akutz
Copy link
Contributor Author

akutz commented Aug 10, 2017

Hi @jdef,

You were invited but unable to join the call with @saad-ali, @jieyu, and myself yesterday. There is a plan to handle your concerns, and in fact I even mentioned your specific concern in our group chat in Slack a few hours back:

image

@jieyu summarized yesterday's meeting in this comment, but it looks like you were not tagged.

I hope this helps assuage any concerns you may have.

@jdef
Copy link
Member

jdef commented Aug 10, 2017

@akutz thanks for the summary. Looking forward to the PR that adds back .proto validation. If it doesn't happen over the next couple of days then I'd like to track the need via an issue.

@akutz
Copy link
Contributor Author

akutz commented Aug 10, 2017

Hi @jdef,

To be clear, it won't be validation but Go language binding generation. The validation @jieyu, @saad-ali, and I discussed includes using a bare-minimum Cxx and Go client to replicate the understood workflows against a mock plug-in, similar to CNI's methodology.

@jdef
Copy link
Member

jdef commented Aug 10, 2017 via email

Copy link
Member

@jieyu jieyu left a comment

Choose a reason for hiding this comment

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

Can you update CONTRIBUTING.md about the flow of updating protobuf in the spec:

  1. update the protobuf in spec.md
  2. run make locally
  3. commit the change and send a PR.

Makefile Outdated

build: $(CSI_PROTO) $(CSI_GOSRC)
# the target for building the temporary csi protobuf file.
Copy link
Member

Choose a reason for hiding this comment

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

nits: Can you use full sentences for the comment. In other word, Capitalize the first word of a sentence and uses a period in the end. Ditto everywhere else in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

As I was the first to create comments in the Makefiles for this project, is this your personal preference or part of the project's style guidelines? What you see is my preference, but I will change it in accordance with a posted style manual. Thanks!

README.md Outdated
| `CSI_PROTO_DIR` | The path of the directory in which the protobuf and Go source files will be generated. If this directory does not exist it will be created. | `.` |
| `CSI_PROTO_ADD` | A list of additional protobuf files used when building the Go source file | |
| `CSI_IMPORT_PATH` | The package of the generated Go source | `csi` |
This project contains the CSI [specification](spec.md) and
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@akutz akutz Aug 10, 2017

Choose a reason for hiding this comment

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

Hi @jieyu,

It is a single sentence. Do you mean I should not hard-wrap it? Sure, if that's this project's style. I prefer hard-wrapping for the sake of readability, but I will gladly adhere to the project's style guidelines.

Copy link
Member

Choose a reason for hiding this comment

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

I mean this is a single sentence, you should not wrap it. see the rationale here:
https://github.com/container-storage-interface/spec/blob/master/CONTRIBUTING.md#markdown-style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Makefile Outdated

clean:
rm -f $(CSI_PROTO) $(CSI_GOSRC)
rm -f $(CSI_PROTO)
Copy link
Member

Choose a reason for hiding this comment

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

Remove the tmp file as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

Good catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

.travis.yml Outdated
- printf "%s" "$GITHUB_API_TOKEN" > "${HOME}/.gist"
- gist -d "https://travis-ci.org/container-storage-interface/spec/jobs/${TRAVIS_BUILD_ID}" *.{proto,go}
# run make
script: make
Copy link
Member

Choose a reason for hiding this comment

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

For travis CI for now (until we have validation tooling checked in), can we try to call protoc to generate the go file to capture any protobuf syntax errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

That's not necessary. The other PR is almost on deck.

Copy link
Member

Choose a reason for hiding this comment

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

ok, but I do want to merge this first. The other might take a while to review. Sounds like not too much work here. Just call protoc in travis yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

You can then review them in tandem if you wish or I'll put them into the same PR. Your call. I don't want to reintroduce a lot of what I already pulled out.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Let's pull the other one into the same PR.

@akutz
Copy link
Contributor Author

akutz commented Aug 10, 2017

Hi @jdef,

FWIW it's already in progress with successful, forked builds. But the second PR will be dependent upon this PR. I will rebase the latter once this one is accepted.

@akutz akutz force-pushed the feature/csi.proto branch from 72ab19f to 459e38f Compare August 10, 2017 21:21
@akutz akutz mentioned this pull request Aug 10, 2017
@akutz akutz force-pushed the feature/csi.proto branch 5 times, most recently from a98cf4a to d9cd7d3 Compare August 10, 2017 22:08
lib/go/Makefile Outdated
ifeq (,$(strip $(GOPATH)))
GOPATH := $(HOME)/go
else
# If GOPATH is arleady set then update GOPATH to be its own
Copy link
Member

Choose a reason for hiding this comment

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

s/arleady/already/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@akutz akutz force-pushed the feature/csi.proto branch from d9cd7d3 to 81353a7 Compare August 11, 2017 17:40
@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jieyu,

Would you please mark this as approved? I've address all your suggested changes/fixes.

@akutz akutz force-pushed the feature/csi.proto branch 2 times, most recently from 865871b to 79c961f Compare August 11, 2017 17:46
Copy link
Member

@jieyu jieyu left a comment

Choose a reason for hiding this comment

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

Can you split this big patch into logically separate pieces. For instance, adding guideline for commit style should be in its own commit. See why we need to do this in the link below (probably add this to CONTRIBUTING.md as well).
https://kernelnewbies.org/PatchPhilosophy

You can separate this patch into the following logic changes:

  1. Remove tailing white spaces in the spec
  2. Adding guideline for commit message
  3. Build system refactor

protoc.mk Outdated
PROTOC_ARCH := x86_32
endif

PROTOC := ./protoc
Copy link
Member

Choose a reason for hiding this comment

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

I don't like the way we build protoc all the time. For C++ projects like Mesos/grpc, it might already bundle protoc and probably do not want to build protoc again. I'd suggest we allow downstream project to pass in a path to protoc (pre-existed at some location).

If you do need a *.mk file for modularization, please put that under build/make subdirectory. I might be interested in adding CMake support under build/cmake

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

I do like it. It ensures a specific version.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I only made proto.mk external from the Go process in the case that you might want to re-use it. If that's not the case I'll move it into lib/go/Makefile directly. Thank you for the feedback.

protoc.mk Outdated
PROTOC_OS := osx
endif

PROTOC_ARCH := $(shell uname -m)
Copy link
Member

Choose a reason for hiding this comment

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

Instead of that, let's allow users to pass in the value directory. uname does not work on windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

CSI does not support Windows today, so it is irrelevant.

Makefile Outdated
diff "$@" "$?"
else
diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@"
.PHONY: $(CSI_PROTO).tmp
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why this is a PHONY target?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

Because it ensures that a local, stale temp file won't cause the protobuf from not being rebuilt. We discussed this yesterday on Slack.


# If this is not running on Travis-CI then for sake of convenience
# go ahead and update the language bindings as well.
ifneq (true,$(TRAVIS))
Copy link
Member

Choose a reason for hiding this comment

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

Why not build library as well in CI? We need to capture library build error on CI as well, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

Because I don't want the default target in the root Makefile to do recursive Make.

lib/go/Makefile Outdated
go get $(@:$(GOPATH)/src/%=%)

PROTOC_GO := $(PROTOC_GO_PKGS) $(PROTOC_GEN_GO)
protoc-go: $(PROTOC_GO)
Copy link
Member

Choose a reason for hiding this comment

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

this is a PHONY target?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

Yes and no. It's an alias.

lib/go/Makefile Outdated
ifeq (true,$(TRAVIS))
diff "$@" "$?"
else
diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@"
Copy link
Member

Choose a reason for hiding this comment

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

So this output will depends on the version of protoc as well as the plugins i think? I am not sure if there will be any compatibility issue or not. For instance, what if a downstream wants to use a specific version of protoc because of some other dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

Then they can use that version. Please note that the version variable allows itself to be specified externally.

PROTOC_VER ?= 3.3.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As for the plug-ins, I'm thinking I will vendor the Go pkg dependencies in lib/go and build the plug-in out of that to ensure a specific version. I'll use Glide to record to actual dependency manifest. Good call.

lib/go/Makefile Outdated
go clean -i -v

clobber:
rm -f $(CSI_GO) $(CSI_GO_TMP)
Copy link
Member

Choose a reason for hiding this comment

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

rm .build directory as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @jieyu,

That's a good catch, thanks.

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jieyu,

This patch was originally separate commits, but I collapsed them at your request. In fact both you and @jdef objected to losing the Go code generation. I do not think it is prudent to divide them up again.

@jieyu
Copy link
Member

jieyu commented Aug 11, 2017

@akutz The merge was meant for the makefile refactor. Merging top level makefile change with golang binding changes. I am fine with that. But the commit style change and whitespace fix should be in separate commits.

@jdef
Copy link
Member

jdef commented Aug 11, 2017

This patch was originally separate commits...

@akutz I think Jie would like all the changes to remain as part of this PR, but that this PR itself should be broken up into logically distinct commits (that won't be squashed at merge time). @jieyu correct me if I'm wrong

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jdef and @jieyu,

Guys, I am not going to spend time breaking this back up. Please feel free to do so. I wouldn't have even touched the spec.md file if not for adding two lines to the spec in order to specify the package. I did this because @jieyu did the same in a now-closed PR. I thought it was a good idea. I cannot edit that file without it updating the WS. As I pointed out in Slack. We had a whole conversation. I even cleared this with @jdef and @saad-ali. @jdef, please feel free to add that text via your editor and I'll reset my copy of spec.md.

Just... sigh Yeah. :)

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

And @jieyu, the merge was meant for a use case, not a single file refactor. I get that you're being careful with the repo, but please don't forget there is a purpose to provide a feature/use case here, not simply the refactor of a single file.

@jieyu
Copy link
Member

jieyu commented Aug 11, 2017

@akutz at the very least, the style guide change should be a separate commit. Make sense?

@akutz akutz force-pushed the feature/csi.proto branch from 79c961f to 8b58152 Compare August 11, 2017 18:52
@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

@jieyu, why? What purpose does that serve? The update to the contribution file regarding proper procedure for updating the spec is irrelevant without the rest of the changes. Commits should be atomic features, and the remark in the contribution doc is pointless on its own.

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jieyu,

Also, you keep referring to CONTRIBUTING.md as a style guide when it's far more than just that. You should break it up if you want to keep process separate from style. I recommend you look at http://rexray.readthedocs.io/en/stable/ and how I provide separate documentation for style, process, and build reference. Perhaps we could do something like that here?

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jdef,

Could you please file a PR where you add the following to spec.md?

Container Storage Interface

This section describes the interface between COs and Plugins.

syntax = "proto3";
package csi;

It's around line 212. That way I can reset spec.md in this PR once I rebase off of your merged commit. It will remove all the whitespace changes. Thanks!

@jdef
Copy link
Member

jdef commented Aug 11, 2017 via email

@saad-ali
Copy link
Member

We need to ensure that this community is fosters an environment of collaboration while maintaining a high quality bar. I know we all have good intentions, and we'll sort this out. To that end, I sent out an invite for a meeting @ 1:30 PM PT today to see if we can resolve the open questions around this PR. Message me on slack (saad-ali) if you want an invite.

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jdef,

It is going to, and is, fail(ing) because the existing build process places that text at the top of the file. You'd have to modify the existing code generation process.

@jdef
Copy link
Member

jdef commented Aug 11, 2017

thanks @akutz, fixed

@akutz akutz force-pushed the feature/csi.proto branch from 8b58152 to f636064 Compare August 11, 2017 19:42
@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jieyu,

I removed spec.md from the PR after rebasing off of master with @jdef's merged changes.

@saad-ali
Copy link
Member

We had a productive meeting. Follow up items we agreed on:

  • Add comment to about what PHONY target is
  • Add a README to root of lib/
  • We are ok using go get for now, and not vendoring go dependencies.
  • Will leave make file for C as a hook for travis, and Jie can modify it in follow up PR.
  • uname --> switch to go version
  • proto buf should be major version (can be a follow up, @jdef)

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @saad-ali,

One slight change - I'm sticking with uname as CSI does not support Windows, so it doesn't matter if uname isn't a Windows command. Additionally, @jieyu may have honed in on that one command, but the fact is the Makefile uses dozens more GNU commands unavailable on Windows as well.

In other words -- supporting Windows is more than just replacing the use of the uname command.

@jieyu
Copy link
Member

jieyu commented Aug 11, 2017

uname for now sounds good. Consider adding a TODO there.

@akutz
Copy link
Contributor Author

akutz commented Aug 11, 2017

Hi @jieyu,

Thank you for your suggestion, but I'm going to leave it as is. FWIW, I had actually made the change to go env and decided to revert it. I understand you zeroed in on uname, but the fact is it's a larger issue. Go look at how protoc is downloaded or any other number of commands. Supporting Windows is a much broader task than just one command.

@akutz akutz force-pushed the feature/csi.proto branch 6 times, most recently from 861bdb8 to 6f1ce3a Compare August 11, 2017 22:41
Copy link
Member

@jieyu jieyu left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @akutz !

Makefile Outdated
diff "$@" "$?"
else
diff "$@" "$?" > /dev/null 2>&1 || cp -f "$?" "$@"
.PHONY: $(CSI_PROTO).tmp
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the PHONY target here for now as we discussed offline?

This patch versions the generated CSI protobuf and provides a Travis-CI
build step that verifies the protobuf is up-to-date before allowing any
changes to be merged.

Additionally this patch also adds minimal Go language bindings in order
to verify the specification. Finally, scaffolding was put into place in
order to support Cxx language bindings in the future as well.
@akutz akutz force-pushed the feature/csi.proto branch from 6f1ce3a to 15419ea Compare August 11, 2017 22:49
@jieyu jieyu merged commit 6606242 into container-storage-interface:master Aug 11, 2017
@jieyu jieyu mentioned this pull request Aug 11, 2017
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.

4 participants