Skip to content
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

feat: mirror protoc releases to a Starlark constant #205

Closed
wants to merge 8 commits into from
Closed

Conversation

alexeagle
Copy link
Collaborator

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 comius and a team 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.
tools/protoc/versions.bzl Outdated Show resolved Hide resolved
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
Collaborator 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
Collaborator 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.

.github/workflows/mirror_protoc_release.yml Show resolved Hide resolved
@comius
Copy link
Collaborator

comius commented Mar 14, 2024

cc @haberman @bellspice

@alexeagle
Copy link
Collaborator 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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants