-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
scripts: improve regenerate.sh to use the correct proto compiler version #7064
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7064 +/- ##
==========================================
- Coverage 81.24% 80.70% -0.54%
==========================================
Files 345 346 +1
Lines 33941 33802 -139
==========================================
- Hits 27574 27280 -294
- Misses 5202 5355 +153
- Partials 1165 1167 +2 |
8bb8747
to
af6bc49
Compare
e404049
to
a582a54
Compare
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 prefer if we didnt track the version of protoc in different places.
What might be nicer is if both regenerate.sh
and vet.sh
points to the same place to install protoc. Also note ./vet.sh -install
basically does the same thing of installing protoc
for Github Actions.
I prefer creating a new script which installs protoc based on the ${OS}
. And for ./vet -install
I could call into the script to install the linux
and x86_64
flavor of protoc. And do something similar for regenerate.sh
20c21cb
to
a880e4d
Compare
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've made a few comments on your change. Could you please take a look at it?
2cddfeb
to
cc78601
Compare
5313711
to
6f7efac
Compare
scripts/vet-proto.sh
Outdated
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then | ||
source ./scripts/install_protoc.sh "/home/runner/go" | ||
else | ||
die "run protoc installer https://github.com/grpc/grpc-go/scripts/install_protoc.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.
This is how links to files in our repo @ master would look like https://github.com/grpc/grpc-go/blob/master/admin/admin.go
Also about this; why not just something like:
source ./scripts/install_protoc.sh
if [[ "${GITHUB_ACTIONS}" = "true" ]]; then | ||
source ./scripts/install_protoc.sh "/home/runner/go" | ||
else | ||
die "run protoc installer https://github.com/grpc/grpc-go/blob/master/scripts/install_protoc.sh" | ||
fi |
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.
nit: This still looks like a link to what to do. But just points to a script without the how to. Have you looked at my other comment that talked about why it might be nice to run install_protoc.sh also in this case?
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.
added few lines on how to use install_protoc.sh
in case of manual run.
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, modulo two nits
scripts/regenerate.sh
Outdated
@@ -19,12 +19,16 @@ WORKDIR=$(mktemp -d) | |||
|
|||
function finish { | |||
rm -rf "$WORKDIR" | |||
# Revert back the PATH to client's original value | |||
export PATH=$ORIGINAL_PATH | |||
echo "Restored PATH variable to original value." |
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.
nit: remove this echo as well. The user doesnt have to know that the state changed and was reverted.
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.
Updated
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. Please update the PR description as discussed
scripts/install_protoc.sh
Outdated
DOWNLOAD_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-$2-$1.zip" | ||
# Download and unzip | ||
curl -LO "$DOWNLOAD_URL" | ||
INSTALL_DIR="${3:-${GOBIN:-${GOPATH:-$HOME/go}/bin}}" |
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.
The last /bin
is not required here. @arvindbr8 and myself tested this. If the script is run as is currently written, it ends up putting the protoc
binary in GOPATH/bin/bin
.
Also, the script now ends up copying a readme.txt
to the INSTALL_DIR
. Can we not do that. Thanks.
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.
@easwars i have removed the extra /bin
. For the second part, readme.txt is part of the zip of binary, so for now i am just doing rm "${INSTALL_DIR}/readme.txt"
.
Fixes #6583
This PR includes the following changes:
install_protoc.sh
script(responsible for installing protobuf on client side in case its not present) which is called byvet.sh and regenerate.sh
.RELEASE NOTES: n/a