-
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: minor refactor to scripts #7403
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7403 +/- ##
==========================================
+ Coverage 81.46% 81.51% +0.05%
==========================================
Files 348 348
Lines 26752 26752
==========================================
+ Hits 21793 21807 +14
+ Misses 3771 3764 -7
+ Partials 1188 1181 -7 |
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.
Pretty much all LGTM, just some very minor nits. Thanks for picking this up.
scripts/install-protoc.sh
Outdated
# This script ensures the installation of protobuf on client machine. | ||
# In case of manual run of this script, make sure you pass the args | ||
# expected at | ||
# https://github.com/grpc/grpc-go/blob/master/scripts/install-protoc.sh#L60 |
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 feels very prone to move around. In fact, line 60 of this file is something to detect your architecture. Maybe we can do something 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.
I've updated the top-level comment to talk more about usages. PTAL
|
||
main() { | ||
# Check if protoc is already available. | ||
if command -v protoc &> /dev/null; 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.
So if protoc is in my path somewhere, but I wanted to download to a specific path, it still won't do it?
Perhaps the PR description should say what this change is attempting to fix, specifically, instead of just "parts of ###"?
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.
Yes that's actually really confusing. i will fix that behavior in the PR that's to follow.
Perhaps the PR description should say what this change is attempting to fix, specifically, instead of just "parts of ###"?
err.. sorry about that. Initially I had only imagined having a very trivial change in this PR. I've updated the description. PTAL
echo "protoc version $PROTOC_VERSION is already installed." | ||
return | ||
else | ||
die "Existing protoc version ($INSTALL_VERSION) differs. Kindly make sure you have $PROTOC_VERSION installed." |
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 entire job of this script is to install it for me. It's funny for it to say "please install it". :)
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.
Will update this in the next PR
scripts/install-protoc.sh
Outdated
else | ||
echo "Unable to determine installed protoc version. Starting the installation." |
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.
Remove?
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.
Done
scripts/install-protoc.sh
Outdated
"x86_64") ARCH="x86_64";; | ||
"aarch64") ARCH="aarch_64";; | ||
"arm64") ARCH="aarch_64";; | ||
*) die "Unsupported architecture. Please consider manual installation from \ |
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.
Shouldn't these lines line up? (and below)
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.
Yes, good callout. Fixed.
scripts/install-protoc.sh
Outdated
esac | ||
} | ||
|
||
main "$@" |
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.
Please add a newline at the end of the 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.
Done.
scripts/regenerate.sh
Outdated
} | ||
trap finish EXIT | ||
|
||
GOBIN="${WORKDIR}"/bin | ||
ORIGINAL_PATH=$PATH | ||
source ./scripts/install-protoc.sh "${WORKDIR}" |
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 source
? Generally you don't want to source
anything unless it's explicitly supposed to add stuff to your environment.
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.
Done.
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.
Addressed most of your comments in the latest commit. For a few, i will take care of it in the next PR. PTAL
|
||
main() { | ||
# Check if protoc is already available. | ||
if command -v protoc &> /dev/null; 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.
Yes that's actually really confusing. i will fix that behavior in the PR that's to follow.
Perhaps the PR description should say what this change is attempting to fix, specifically, instead of just "parts of ###"?
err.. sorry about that. Initially I had only imagined having a very trivial change in this PR. I've updated the description. PTAL
echo "protoc version $PROTOC_VERSION is already installed." | ||
return | ||
else | ||
die "Existing protoc version ($INSTALL_VERSION) differs. Kindly make sure you have $PROTOC_VERSION installed." |
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.
Will update this in the next PR
scripts/install-protoc.sh
Outdated
# This script ensures the installation of protobuf on client machine. | ||
# In case of manual run of this script, make sure you pass the args | ||
# expected at | ||
# https://github.com/grpc/grpc-go/blob/master/scripts/install-protoc.sh#L60 |
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 updated the top-level comment to talk more about usages. PTAL
scripts/install-protoc.sh
Outdated
else | ||
echo "Unable to determine installed protoc version. Starting the installation." |
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.
Done
scripts/install-protoc.sh
Outdated
"x86_64") ARCH="x86_64";; | ||
"aarch64") ARCH="aarch_64";; | ||
"arm64") ARCH="aarch_64";; | ||
*) die "Unsupported architecture. Please consider manual installation from \ |
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.
Yes, good callout. Fixed.
scripts/install-protoc.sh
Outdated
esac | ||
} | ||
|
||
main "$@" |
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.
Done.
scripts/regenerate.sh
Outdated
} | ||
trap finish EXIT | ||
|
||
GOBIN="${WORKDIR}"/bin | ||
ORIGINAL_PATH=$PATH | ||
source ./scripts/install-protoc.sh "${WORKDIR}" |
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.
Done.
Fixing parts of #7400.
Changes:
install-protoc.sh
( following the rest of the file names under scripts/ )download_binary()
tomain()
INSTALL_PATH=${1:+"$1"}
install_protoc.sh
as the very first thing in the scriptGOBIN
$PATH
anymorecommon.sh
This PR does not make functional changes to any scripts -- which will be made in an upcoming PR
RELEASE NOTES: none