From 2d3c0d3940af1a0091ae08fbc410a8180bc60310 Mon Sep 17 00:00:00 2001 From: Jason Aragorn Tobias Lunn Date: Wed, 22 Jul 2026 11:01:18 -0700 Subject: [PATCH] Remove fallback behavior PiperOrigin-RevId: 952219463 --- .github/workflows/release_prep.sh | 29 ++------------------- .github/workflows/release_prep_test.sh | 36 ++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/release_prep.sh b/.github/workflows/release_prep.sh index 44f788e972..17dc1e696a 100755 --- a/.github/workflows/release_prep.sh +++ b/.github/workflows/release_prep.sh @@ -20,41 +20,16 @@ git archive --format=tar --prefix=${PREFIX}/ ${TAG} > $ARCHIVE_TMP # Delete the placeholder file tar --file $ARCHIVE_TMP --delete $INTEGRITY_FILE -# Use jq to translate GitHub Releases json into a Starlark object -filter_releases=$(cat <<'EOF' -# Read the file assets already present on the release -reduce .assets[] as $a ( - # Start with an empty dictionary, and for each asset, add - {}; . + { - # The format required in starlark, i.e. "release-name": "deadbeef123" - ($a.name): ($a.digest | sub("^sha256:"; "")) - } -) -EOF -) - mkdir -p "$(dirname "$INTEGRITY_FILE")" # Fetch release payload once RELEASE_API_URL="https://api.github.com/repos/protocolbuffers/protobuf/releases/tags/${TAG}" RELEASE_JSON=$(curl -sSL "$RELEASE_API_URL") -# Extract the download URL for tool_integrity.bzl if it exists +# Extract the download URL for tool_integrity.bzl INTEGRITY_ASSET_URL=$(echo "$RELEASE_JSON" | jq -r '.assets[] | select(.name=="tool_integrity.bzl") | .browser_download_url') -# Check if the asset was found (jq emits "null" or empty if missing) -if [[ -n "$INTEGRITY_ASSET_URL" && "$INTEGRITY_ASSET_URL" != "null" ]]; then - curl -sSL -o "${INTEGRITY_FILE}" "$INTEGRITY_ASSET_URL" -else - cat >"${INTEGRITY_FILE}" < "$TEST_DIR/.mock_bin/curl" <<'MOCK' #!/usr/bin/env bash -cat <<'JSON' +outfile="" +while [[ $# -gt 0 ]]; do + case "$1" in + -o) + outfile="$2" + shift 2 + ;; + *) + shift + ;; + esac +done + +if [[ -n "$outfile" ]]; then + cat <<'BZL' > "$outfile" +RELEASE_VERSION="v99.0" +RELEASED_BINARY_INTEGRITY = { + "protoc-99.0-linux-x86_64.zip": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "protoc-99.0-osx-aarch_64.zip": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "protoc-99.0-win64.zip": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", +} +BZL +else + cat <<'JSON' { "assets": [ { @@ -84,10 +111,15 @@ cat <<'JSON' { "name": "protoc-99.0-win64.zip", "digest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" + }, + { + "name": "tool_integrity.bzl", + "browser_download_url": "https://github.com/protocolbuffers/protobuf/releases/download/v99.0/tool_integrity.bzl" } ] } JSON +fi MOCK chmod +x "$TEST_DIR/.mock_bin/curl" export PATH="$TEST_DIR/.mock_bin:$PATH"