feat: support overriding actor versions per-network
This commit is contained in:
parent
f44ad2682a
commit
1ced322310
@ -16,3 +16,11 @@ This will:
|
||||
|
||||
1. Download the actors bundles and pack them into the appropriate tarfile (`$VERSION.tar.zst`).
|
||||
2. Run `make bundle-gen` in the top-level directory to regenerate the bundle metadata file for _all_ network versions (all `*.tar.zst` files in this directory).
|
||||
|
||||
## Overriding
|
||||
|
||||
To build a bundle, but specify a different release/tag for a specific network, append `$network=$alternative_release` on the command line. For example:
|
||||
|
||||
```bash
|
||||
./pack.sh v8 dev/20220602 mainnet=v8.0.0 calibrationnet=v8.0.0-rc.1
|
||||
```
|
||||
|
@ -1,25 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
NETWORKS=(devnet mainnet caterpillarnet butterflynet testing testing-fake-proofs calibrationnet)
|
||||
|
||||
set -e
|
||||
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "expected two arguments, an actors version (e.g., v8) and an actors release"
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Usage: $0 VERSION RELEASE [NETWORK=RELEASE_OVERRIDE]..." >&2
|
||||
echo "expected at least two arguments, an actors version (e.g., v8), an actors release, and any number of release overrides." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$1" # actors version
|
||||
RELEASE="$2" # actors release name
|
||||
NETWORKS=(devnet mainnet caterpillarnet butterflynet testing testing-fake-proofs calibrationnet)
|
||||
RELEASE_OVERRIDES=("${@:3}")
|
||||
|
||||
echo "Downloading bundles for actors version ${VERSION}, release ${RELEASE}"
|
||||
echo "Downloading bundles for actors version ${VERSION} release ${RELEASE}"
|
||||
echo "With release overrides ${RELEASE_OVERRIDES[*]}"
|
||||
|
||||
TARGET_FILE="$(pwd)/${VERSION}.tar.zst"
|
||||
WORKDIR=$(mktemp -d -t "actor-bundles-${VERSION}.XXXXXXXXXX")
|
||||
trap 'rm -rf -- "$WORKDIR"' EXIT
|
||||
|
||||
encode_release() {
|
||||
jq -rn --arg release "$1" '$release | @uri'
|
||||
}
|
||||
|
||||
pushd "${WORKDIR}"
|
||||
encoded_release="$(jq -rn --arg release "$RELEASE" '$release | @uri')"
|
||||
for network in "${NETWORKS[@]}"; do
|
||||
release="$RELEASE"
|
||||
# Ideally, we'd use an associative array (map). But that's not supported on macos.
|
||||
for override in "${RELEASE_OVERRIDES[@]}"; do
|
||||
if [[ "${network}" = "${override%%=*}" ]]; then
|
||||
release="${override#*=}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
encoded_release="$(encode_release "$release")"
|
||||
echo "Downloading $release for network $network."
|
||||
wget "https://github.com/filecoin-project/builtin-actors/releases/download/${encoded_release}/builtin-actors-${network}"{.car,.sha256}
|
||||
done
|
||||
|
||||
@ -27,7 +44,6 @@ echo "Checking the checksums..."
|
||||
|
||||
sha256sum -c -- *.sha256
|
||||
|
||||
|
||||
echo "Packing..."
|
||||
|
||||
rm -f -- "$TARGET_FILE"
|
||||
|
Loading…
Reference in New Issue
Block a user