-
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: regenerate pbs with caching deps to a fixed tmp folder #7409
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7409 +/- ##
==========================================
- Coverage 81.47% 81.47% -0.01%
==========================================
Files 350 350
Lines 26843 26846 +3
==========================================
+ Hits 21871 21873 +2
- Misses 3784 3785 +1
Partials 1188 1188 |
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 some nits.
scripts/install-protoc.sh
Outdated
# Detect the hardware platform. | ||
ARCH="$(uname -m)" | ||
# Detect the Operating System. | ||
OS="$(uname -s)" |
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'd probably delete these vars and do these things in download_binary
instead. Note that you're setting ARCH
twice to different things, so that's a little confusing, and you're passing these as positional parameters, so separating their usage from their definition.
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 you are right. I dont know why we needed a function to be defined like this. I've moved everything into main() now. Looks cleaner this way.
scripts/regenerate.sh
Outdated
|
||
./scripts/install-protoc.sh "${WORKDIR}" | ||
"./$(dirname "${0}")/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.
I think you want to remove ./
at the start? Try executing as /abs/path/to/scripts/regenerate.sh
and I think it will fail?
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.
Yea, for whatever reason i've always run executables with a leading ./
. Every time I do a shell PR I learn something new.
I also did not want to put the abs/path
since that would require that you run the script from the gRPC-go/
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.
for whatever reason i've always run executables with a leading
./
.
If you're running one in the current directory, then that's important. If it's in an absolute path, you'd use /usr/bin/ls
, e.g. If it's in a relative path, then either ./bin/foo
or bin/foo
work.
scripts/regenerate.sh
Outdated
@@ -31,7 +28,7 @@ mkdir -p "${GOBIN}" | |||
echo "remove existing generated files" |
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: "Removing existing generated files."
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
@@ -31,7 +28,7 @@ mkdir -p "${GOBIN}" | |||
echo "remove existing generated files" | |||
# grpc_testing_not_regenerate/*.pb.go is not re-generated, | |||
# see grpc_testing_not_regenerate/README.md for details. | |||
rm -f $(find . -name '*.pb.go' | grep -v 'grpc_testing_not_regenerate') | |||
find . -name '*.pb.go' | grep -v 'grpc_testing_not_regenerate' | xargs rm -f || true | |||
|
|||
echo "go install google.golang.org/protobuf/cmd/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.
Maybe "Executing: go install _______"
(etc)?
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. Let me know how you feel about the new echo-s
@@ -40,10 +37,18 @@ echo "go install cmd/protoc-gen-go-grpc" | |||
(cd cmd/protoc-gen-go-grpc && go install .) | |||
|
|||
echo "git clone https://github.com/grpc/grpc-proto" | |||
git clone --quiet https://github.com/grpc/grpc-proto "${WORKDIR}/grpc-proto" | |||
if [ -d "${WORKDIR}/grpc-proto" ]; then | |||
(cd "${WORKDIR}/grpc-proto" && git pull) |
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 parens here (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.
so that I dont have to cd -
after the command :)
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.
Fair enough
Fixes #7400
@dfawley I went with something that's more along the lines of option no.3 in the issue. Now the deps are installed in a
"well-known" directory which is
/tmp/grpc-go-tools
. This will ensure not requiring to re-download all deps when running regenerate.Changes:
install-protoc.sh
protoc
in the required version is present in INSTALL_PATH and not $PATHregenerate.sh
/tmp/grpc-go-tools
instead of mktmpcc: @aranjans
RELEASE NOTES: none