Files
codex/.github/actions/setup-rusty-v8/action.yml
T
Ian MacLeod 0cc4569555 Avoid stale GitHub release asset redirects (#65127)
## Why

GitHub release asset URLs can return cached redirects whose signatures
have expired, causing dependency downloads to fail during CI setup and
packaging.

## What changed

Add a fresh `cache_bust` query parameter to rusty-v8 artifact downloads in
CI and packaging, the Windows voice setup's `pkgconf` MSI download, and
DotSlash archive downloads that use plain GitHub release asset URLs.

GitOrigin-RevId: 560bfdb5788032f6450920b986cd30363eda996e
2026-12-02 01:08:01 +00:00

67 lines
3.0 KiB
YAML

name: setup-rusty-v8
description: Download and verify Codex-built rusty_v8 artifacts for Cargo builds.
inputs:
target:
description: Rust target triple with Codex-built V8 release artifacts.
required: true
runs:
using: composite
steps:
- name: Configure rusty_v8 artifact overrides and verify checksums
shell: bash
env:
TARGET: ${{ inputs.target }}
run: |
set -euo pipefail
version="$(python3 "${GITHUB_WORKSPACE}/.github/scripts/rusty_v8_bazel.py" resolved-v8-crate-version)"
release_tag="rusty-v8-v${version}"
base_url="https://github.com/openai/codex/releases/download/${release_tag}"
binding_dir="${RUNNER_TEMP}/rusty_v8"
profile="ptrcomp_sandbox_release"
if [[ "$TARGET" == *-pc-windows-msvc ]]; then
archive_name="rusty_v8_${profile}_${TARGET}.lib.gz"
else
archive_name="librusty_v8_${profile}_${TARGET}.a.gz"
fi
binding_name="src_binding_${profile}_${TARGET}.rs"
checksums_name="rusty_v8_${profile}_${TARGET}.sha256"
archive_path="${binding_dir}/${archive_name}"
binding_path="${binding_dir}/${binding_name}"
checksums_path="${binding_dir}/${checksums_name}"
trusted_checksums="${GITHUB_WORKSPACE}/third_party/v8/rusty_v8_${version//./_}_release_manifests.sha256"
if command -v sha256sum >/dev/null 2>&1; then
checksum_command=(sha256sum --check -)
else
checksum_command=(shasum -a 256 --check -)
fi
# A fresh query avoids cached GitHub redirects with expired signatures.
query="cache_bust=$(date +%s)"
mkdir -p "${binding_dir}"
curl -fsSL "${base_url}/${checksums_name}?${query}" -o "${checksums_path}"
# Check the original manifest bytes even when either checksum file uses CRLF.
expected_manifest_checksum="$(grep -F " ${checksums_name}" "${trusted_checksums}" | cut -d ' ' -f 1)"
actual_manifest_checksum="$(python3 -c 'import hashlib, pathlib, sys; print(hashlib.sha256(pathlib.Path(sys.argv[1]).read_bytes()).hexdigest())' "${checksums_path}")"
if [[ "${actual_manifest_checksum}" != "${expected_manifest_checksum}" ]]; then
echo "Checksum mismatch for ${checksums_name}: expected ${expected_manifest_checksum}, got ${actual_manifest_checksum}" >&2
exit 1
fi
curl -fsSL "${base_url}/${archive_name}?${query}" -o "${archive_path}"
curl -fsSL "${base_url}/${binding_name}?${query}" -o "${binding_path}"
if [[ "$(wc -l < "${checksums_path}")" -ne 2 ]]; then
echo "Expected exactly two checksums for ${TARGET} in ${checksums_path}" >&2
exit 1
fi
# Existing Windows-built release manifests use CRLF line endings.
(cd "${binding_dir}" && tr -d '\r' < "${checksums_path}" | "${checksum_command[@]}")
echo "RUSTY_V8_ARCHIVE=${archive_path}" >> "${GITHUB_ENV}"
echo "RUSTY_V8_SRC_BINDING_PATH=${binding_path}" >> "${GITHUB_ENV}"