-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixed make proto #747
Fixed make proto #747
Conversation
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.
LGTM, just super minor nits! Thanks!
Makefile
Outdated
PROMU_VERSION ?= 264dc36af9ea3103255063497636bd5713e3e9c1 | ||
PROTOC ?= $(BIN_DIR)/protoc-$(PROTOC_VERSION) | ||
PROTOC_VERSION ?= 3.4.0 | ||
PROTOC_PACKAGE ?= protoc-$(PROTOC_VERSION)-linux-x86_64.zip |
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 would put it to golang BIN_DIR
if possible (: What do you think?
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.
em, actually it's possible in theory, but the package has sub bin
dir, I should extract the binary only. That is why I put the package at the top of temporary dir.
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 do you mean? You can use PATH to file.. it's even better
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.
It's actually important, otherwise users can accidently commit this file
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 guess you make a mistake, I will put the package (protoc-$(PROTOC_VERSION)-linux-x86_64.zip)
into the TMP_GOPATH
dir.
cd -- $(TMP_GOPATH) && curl -OLSs $(PROTOC_DOWNLOAD_URL);
and then move the binary protoc
into golang BIN_DIR
.
but I will also change the destination of package downloaded. Thanks for your suggestion.
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.
oh.. Yes I totally missed that! no... TMP is totally fine for protoc package..! sorry
Makefile
Outdated
@go install ./vendor/github.com/gogo/protobuf/protoc-gen-gogofast | ||
@./scripts/genproto.sh | ||
proto: deps $(GOIMPORTS) $(PROTOC) | ||
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" ./scripts/genproto.sh |
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.
Nice 👍
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.
but maybe positional arguments would work better? Not a blocker
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.
Sorry, I can't catch your suggestion.
Makefile
Outdated
@echo ">> installing protoc@${PROTOC_VERSION}" | ||
@mv -- "$(TMP_GOPATH)/bin/protoc" "$(BIN_DIR)/protoc-$(PROTOC_VERSION)" | ||
@echo ">> produced $(BIN_DIR)/protoc-$(PROTOC_VERSION)" | ||
@go install ./vendor/github.com/gogo/protobuf/protoc-gen-gogofast |
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.
Let's run thins in very beginning. Otherwise when you run protoc
and it will get into to the 214 line and we abort this, protoc will be installed so running make proto
will not install protoc, but protoc-gen-gogofast
won't be there.
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 are right, my bad.
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.
One thing and LGTM
Makefile
Outdated
PROMU_VERSION ?= 264dc36af9ea3103255063497636bd5713e3e9c1 | ||
PROTOC ?= $(BIN_DIR)/protoc-$(PROTOC_VERSION) | ||
PROTOC_VERSION ?= 3.4.0 | ||
PROTOC_PACKAGE ?= protoc-$(PROTOC_VERSION)-linux-x86_64.zip |
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.
It's actually important, otherwise users can accidently commit this file
Makefile
Outdated
|
||
$(PROTOC): | ||
@echo ">> fetching protoc@${PROTOC_VERSION}" | ||
@if [ ! -x '$(BIN_DIR)/protoc' ]; then \ |
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.
Why is this? makefile already checks if command in variable $(PROTOC)
exists. Let's remove it to fetch it always, I think to simplify.
Makefile
Outdated
$(PROTOC): | ||
@echo ">> fetching protoc@${PROTOC_VERSION}" | ||
@if [ ! -x '$(BIN_DIR)/protoc' ]; then \ | ||
curl -LSs $(PROTOC_DOWNLOAD_URL) -o $(BIN_DIR)/$(PROTOC_PACKAGE); \ |
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 messed up... tmp packages in bin might be not ok... ): Can we move it back to tmp.
What I meant with my above comments is for $(PROTOC)
itself - it should be in BIN_DIR
as you already did it.
Sorry for confusion!
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.
It's Ok, I'll rollback the code.
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.
Perfect, once CI is read let's merge it.
I will checkout this and test on my machine as well.
And it does not work:
;p |
Because the temp dir does not exist... I'll fix it. |
We need |
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.
Nice, thanks! Will merge on green.
What about people on OSX ? |
What exactly blocker you see for osx?
…On Fri, Jan 18, 2019, 19:46 Adrien F ***@***.***> wrote:
What about people on OSX ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#747 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGoNu9acu4s1tJhKodZ0u8DzpDZ_yExBks5vEiSagaJpZM4aE-Qy>
.
|
The whole |
Thanks @adrien-f , maybe we should download the |
I find that we can use the golang env The valid combinations of Since the |
Seems much more sensible to me ! TIL about $GOOS 👍 |
I feel like limiting dev to OSX and Linux for development is ok. Worth to mention this in |
It's 👍 from me but the architecture detection would be good. (tested on linux and it's working as expected) |
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.
So @jojohappy do we wait on you to do OS split for protoc installation now in this PR, right?
Yes, it is WIP, I will update soon. |
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.
Awesome !
esac | ||
true | ||
} | ||
adjust_arch() { |
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.
New Line maybe?
scripts/installprotoc.sh
Outdated
|
||
is_supported_platform "$PLATFORM" | ||
if [[ $? -eq 1 ]]; then | ||
echo "platform $PLATFORM is not supported." |
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.
Maybe echo a link to protoc's download page ?
CONTRIBUTING.md
Outdated
@@ -9,8 +9,9 @@ Please follow the [code of conduct](CODE_OF_CONDUCT.md) in all your interactions | |||
## Pull Request Process | |||
|
|||
1. Read [getting started docs](docs/getting_started.md) and prepare Thanos. | |||
2. Familarize yourself with [Makefile](Makefile) commands like `format`, `build`, `proto` and `test`. | |||
3. Fork improbable-eng/thanos.git and start development from your own fork. Here are sample steps to setup your development environment: | |||
2. It is strongly recommended that you can use MACOSX or popular Linux distributions systems e.g., ubuntu, redhat, and opensuse for development. |
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.
It is strongly recommended that you
canuse OS X
Maybe also capitalize distributions names
5845b2f
to
040cb96
Compare
Tested and still ok 👍 |
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.
Oh no...more bash ^^
But if the outcome is to have reproducible proto generation.. I am in! LGTM
CONTRIBUTING.md
Outdated
@@ -9,8 +9,9 @@ Please follow the [code of conduct](CODE_OF_CONDUCT.md) in all your interactions | |||
## Pull Request Process | |||
|
|||
1. Read [getting started docs](docs/getting_started.md) and prepare Thanos. | |||
2. Familarize yourself with [Makefile](Makefile) commands like `format`, `build`, `proto` and `test`. | |||
3. Fork improbable-eng/thanos.git and start development from your own fork. Here are sample steps to setup your development environment: | |||
2. It is strongly recommended that you use OSX or popular Linux distributions systems e.g., Ubuntu, Redhat, and OpenSUSE for development. |
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.
2. It is strongly recommended that you use OSX or popular Linux distributions systems e.g., Ubuntu, Redhat, and OpenSUSE for development. | |
2. It is strongly recommended that you use OSX or popular Linux distributions systems e.g. Ubuntu, Redhat, or OpenSUSE for development. |
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.
Can we move it outside of Pull Request Process in some Prerequisites
section?
Just small doc nit and we can merge. Thanks @jojohappy (: |
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
Signed-off-by: jojohappy <sarahdj0917@gmail.com>
040cb96
to
cb96d88
Compare
I guess it's now time to hook it in CI to test if proto was generated, right? (: |
Ugh we agreed with @bwplotka to leave that as it is right now and focus on more important things so I wouldn't wait for it probably and add it separately. |
Signed-off-by: jojohappy sarahdj0917@gmail.com
Changes
We have a shortcut of
make proto
to generates golang files from Thanos proto files. But if people have not installed the standard protocol buffer implementation from https://github.com/google/protobuf, the command will be failed.This PR will fix the bug for downloading the
protoc
binary and pinning the version at3.4.0
we specified.Verification
To run
make proto
locally.