-
Couldn't load subscription status.
- Fork 881
protobuf: generate code using a script #2382
Conversation
|
@alban @jonboulle PTAL |
scripts/genproto.sh
Outdated
| GO_PROTOBUF_SHA="dda510ac0fd43b39770f22ac6260eb91d377bce3" | ||
|
|
||
| echo "installing golang/protobuf using GOPATH=${GOPATH}" | ||
| go get -u github.com/golang/protobuf/{proto,protoc-gen-go} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean we need Internet connectivity to run this script? Most Linux distributions (CoreOS Linux, Debian, Fedora...) have guidelines against using internet during the build. This would prevent using this script during the build.
The build normally downloads the CoreOS PXE image for building stage1's "coreos" flavor. To follow distribution guidelines, a configure option has been added: ./configure --with-coreos-local-pxe-image-path. CoreOS Linux uses it. Fedora & Debian only use the host flavor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly orthogonal, since we're continuing to commit the generated code for now: #2004 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and another reason to keep doing so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am inclined even not to create an issue for that since it becomes more and more obvious to check in the generated code.
Yes this script is a mere helper to have a reproducible way of regenerating the code by pinning the version of golang/protobuf.
|
ugh, the failed travis build is reproducible with a clean directory, investigating. |
api/v1alpha/api.pb.go
Outdated
| // for the image as nowadays all the image formats will be transformed to | ||
| // ACI. | ||
| BaseFormat *ImageFormat `protobuf:"bytes,1,opt,name=base_format" json:"base_format,omitempty"` | ||
| BaseFormat *ImageFormat `protobuf:"bytes,1,opt,name=base_format,json=baseFormat" json:"base_format,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this change come from?
Does it stay compatible with previous versions? I don't know the default case for the json= attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what upstream https://github.com/golang/protobuf generates, I had no intuition to what version the generated code was pinned at.
Since travis failed I have one now, namely the version referenced in Godeps, pinning the script to the very same version now and see if the generated code is the same.
Currently protobuf bindings have to be generated manually, the process is being documented as a code comment in api/v1alpha/api.proto. This automates protobuf generation by introducing a script and also a make target "protobuf". Fixes rkt#2004
scripts/genproto.sh
Outdated
| GO_PROTOBUF_SHA="2402d76f3d41f928c7902a765dfc872356dd3aad" | ||
|
|
||
| echo "installing golang/protobuf using GOPATH=${GOPATH}" | ||
| go get -u github.com/golang/protobuf/{proto,protoc-gen-go} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another solution we could use is to vendor them in rkt. Just saying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh, even better, you're right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add protoc-gen-go in vendoredApps and follow the Managing Dependencies guide.
Good luck with Godeps ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You copied my script and removed my TODO without doing it? :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double doh :-D
rkt/rkt.go
Outdated
| "github.com/coreos/rkt/rkt/config" | ||
| rktflag "github.com/coreos/rkt/rkt/flag" | ||
| "github.com/spf13/cobra" | ||
| _ "github.com/spf13/cobra/doc" // transitive dependency for man page generation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this but it makes godep not remove cobra/doc's transitive dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is ok as long as the comment is here to explain.
It reminds me of this dummy package in old rkt versions:
https://github.com/coreos/rkt/blob/v0.11.0/stage1/dummy.go#L15
which was removed in favor of the file vendoredApps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What version of godep are you using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a longer comment explaining the details you told me OOB about the "build ignore"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use godep v60.
Wait, I found something, godep explicitely ignores +ignore tags, if I use +doc tags in the _gen.go files, godep is happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, that's where I was going - let's do that!
On Wed, Apr 6, 2016 at 2:42 PM Sergiusz Urbaniak [email protected]
wrote:
In rkt/rkt.go
#2382 (comment):@@ -27,6 +27,7 @@ import (
"github.com/coreos/rkt/rkt/config"
rktflag "github.com/coreos/rkt/rkt/flag"
"github.com/spf13/cobra"
- _ "github.com/spf13/cobra/doc" // transitive dependency for man page generation
I use godep v60.
Wait, I found something, godep explicitely ignores +ignore tags, if I use
+doc tags in the _gen.go files, godep is happy.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/coreos/rkt/pull/2382/files/25f9cd2d2ca12f99738919fe4740e1c9823bba92..c62a59a4661fa1059bd696a17d4afbf84bdf0730#r58697141
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(tag support landed relatively recently via
tools/godep#271 )
On Wed, Apr 6, 2016 at 2:44 PM Jonathan Boulle [email protected]
wrote:
right, that's where I was going - let's do that!
On Wed, Apr 6, 2016 at 2:42 PM Sergiusz Urbaniak [email protected]
wrote:In rkt/rkt.go
#2382 (comment):@@ -27,6 +27,7 @@ import (
"github.com/coreos/rkt/rkt/config"
rktflag "github.com/coreos/rkt/rkt/flag"
"github.com/spf13/cobra"
- _ "github.com/spf13/cobra/doc" // transitive dependency for man page generation
I use godep v60.
Wait, I found something, godep explicitely ignores +ignore tags, if I
use +doc tags in the _gen.go files, godep is happy.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/coreos/rkt/pull/2382/files/25f9cd2d2ca12f99738919fe4740e1c9823bba92..c62a59a4661fa1059bd696a17d4afbf84bdf0730#r58697141
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or the vendoredApps route would be fine actually...
On Wed, Apr 6, 2016 at 2:44 PM Jonathan Boulle [email protected]
wrote:
(tag support landed relatively recently via
tools/godep#271 )On Wed, Apr 6, 2016 at 2:44 PM Jonathan Boulle [email protected]
wrote:right, that's where I was going - let's do that!
On Wed, Apr 6, 2016 at 2:42 PM Sergiusz Urbaniak <
[email protected]> wrote:In rkt/rkt.go
#2382 (comment):@@ -27,6 +27,7 @@ import (
"github.com/coreos/rkt/rkt/config"
rktflag "github.com/coreos/rkt/rkt/flag"
"github.com/spf13/cobra"
- _ "github.com/spf13/cobra/doc" // transitive dependency for man page generation
I use godep v60.
Wait, I found something, godep explicitely ignores +ignore tags, if I
use +doc tags in the _gen.go files, godep is happy.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/coreos/rkt/pull/2382/files/25f9cd2d2ca12f99738919fe4740e1c9823bba92..c62a59a4661fa1059bd696a17d4afbf84bdf0730#r58697141
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke with @krnowak about the vendoredApps route; tldr: meant for apps only, but why not. I am fine with either approach.
|
@alban @jonboulle PTAL |
seriously? smdh |
|
@alban @jonboulle PTAL |
|
LGTM |
|
Wait, we have both vendoredApps and different build tags? Isn't that redundant? |
|
er, never mind, I'm blind. |
|
LGTM |
Currently protobuf bindings have to be generated manually, the process
is being documented as a code comment in api/v1alpha/api.proto.
This automates protobuf generation by introducing a script and
also a make target "protobuf".
Fixes #2004