Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@s-urbaniak
Copy link
Contributor

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

@s-urbaniak
Copy link
Contributor Author

@alban @jonboulle PTAL

GO_PROTOBUF_SHA="dda510ac0fd43b39770f22ac6260eb91d377bce3"

echo "installing golang/protobuf using GOPATH=${GOPATH}"
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
Copy link
Member

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.

Copy link
Contributor

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)

Copy link
Contributor

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

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 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.

@jonboulle
Copy link
Contributor

@s-urbaniak
Copy link
Contributor Author

ugh, the failed travis build is reproducible with a clean directory, investigating.

// 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"`
Copy link
Member

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.

Copy link
Contributor Author

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
@s-urbaniak
Copy link
Contributor Author

@alban travis seems to be happy now, I also catched up with #2377; PTAL

GO_PROTOBUF_SHA="2402d76f3d41f928c7902a765dfc872356dd3aad"

echo "installing golang/protobuf using GOPATH=${GOPATH}"
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Member

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 ;)

Copy link
Contributor

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

Copy link
Contributor Author

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
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 don't like this but it makes godep not remove cobra/doc's transitive dependencies.

Copy link
Member

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.

Copy link
Contributor

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?

Copy link
Member

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"?

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 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.

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

@s-urbaniak
Copy link
Contributor Author

@alban @jonboulle PTAL

@jonboulle
Copy link
Contributor

1,812 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

seriously? smdh

@s-urbaniak
Copy link
Contributor Author

@alban @jonboulle PTAL

@alban
Copy link
Member

alban commented Apr 6, 2016

LGTM

@jonboulle
Copy link
Contributor

Wait, we have both vendoredApps and different build tags? Isn't that redundant?

@jonboulle
Copy link
Contributor

er, never mind, I'm blind.

@jonboulle
Copy link
Contributor

LGTM

@jonboulle jonboulle merged commit 40b11c0 into rkt:master Apr 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants