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

Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

Conversation

@alexeagle
Copy link
Contributor

This allows rules_proto to supply a pre-built binary toolchain for protoc without needing any Bazel module supplied by the protocolbuffers maintainers. Obviates the need for protobuf to be released to the BCR as in protocolbuffers/protobuf#16014 Allows the protocolbuffers team to stop caring about Bazel builds for external users, and to close associated bugs.

Next step in rules_proto supplying a toolchain that doesn't require users build protoc from sources.

@alexeagle alexeagle requested review from a team and comius as code owners March 4, 2024 23:28
@alexeagle alexeagle requested a review from thesayyn March 4, 2024 23:29
This allows rules_proto to supply a pre-built binary toolchain for protoc without needing any Bazel module supplied by the protocolbuffers maintainers.
Obviates the need for protobuf to be released to the BCR as in protocolbuffers/protobuf#16014
Allows the protocolbuffers team to stop caring about Bazel builds for external users, and to close associated bugs.

Next step in rules_proto supplying a toolchain that doesn't require users build protoc from sources.
It seems that Googlers aren't checking the same buildifier warnings in google3 that GitHub enforces, so the main branch was already red.
Fixing to green up my PR.
Copy link
Collaborator

@comius comius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to diverge rules_proto, I think it would be good to accept this PR. But eventually when the rules are in protobuf, the toolchain registration should happen there as well.-

Comment on lines 29 to 37
# Workaround: protobuf doesn't publish their integrity hashes to e.g. checksums.txt
# Create a file that looks like a checksums.txt from a shasum command, i.e.
# sha384-RVFu8PJJCOSXwYTqH7FyWRSgsP1AAjcEa+VViddVTgtd9wYvZjQoQ8jmlFxwfFw+ protobuf-26.0-rc3.tar.gz
# sha384-JYSXGTSBfwUU6UzqazUTkT3lTZDzx10YdaNQYjojrT7X1Ro1fA+T4tjJw0e8UISV protobuf-26.0-rc3.zip
CHECKSUMS=$(mktemp)
for url in $(jq --arg version $VERSION --raw-output "$DOWNLOAD_URLS_FILTER" <$RELEASES); do
sha=$(curl -sSL $url | shasum -b -a 384 | awk "{ print \$1 }" | xxd -r -p | base64)
echo "sha384-${sha} $(basename $url)"
done | tee "$CHECKSUMS"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downloading an computing hashes doesn't feel very secure / the right thing to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's https://en.wikipedia.org/wiki/Trust_on_first_use - we assume that within 24 hours of a protobuf release, the files they are serving are still uncompromised.

I can leave a TODO here to use the checksums.txt file if the protobuf project starts publishing one. WDYT?

- uses: actions/checkout@v4
- run: |
./proto/private/protoc/mirror_protoc_releases.sh
npx @bazel/buildifier proto/private/protoc/versions.bzl
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be a separate step or can it be part of the script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be part of the script. The choice of npx here is technically tied to the software we know to be installed on the GHA runner machine, so if someone ran mirror_protoc_releases.sh locally, it might not be installed. However I don't expect anyone to run it locally, so I'm happy to relocate it if you prefer.

@comius
Copy link
Collaborator

comius commented Mar 14, 2024

cc @haberman @bellspice

@alexeagle
Copy link
Contributor Author

Note, main is already red before this PR, looks like copybara merged stuff out of google3 without running the OSS tests?

alexeagle added a commit to aspect-build/toolchains_protoc that referenced this pull request Mar 19, 2024
alexeagle added a commit to aspect-build/toolchains_protoc that referenced this pull request Mar 19, 2024
* chore: fix e2e

* chore: fix

* chore: copy code review improvements from upstream

bazelbuild/rules_proto#205
@comius comius closed this May 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants