0
0
#!/usr/bin/env bash
# promote-rehearse.sh <src url> <src sha256> <main commit> <release url> <release sha256>: on a VM with the release image
# (docs/ci-debug.md "Promote, by hand"), as root: the checkout from a source tarball (its tests/ and rust/ trees are
# <main commit>'s, which release published), then promote.yml's step as `promote.sh --dry-run`: the test host, meshd and
# the page (ci-test.sh host), the prod target without its secret files, the pinned tools (their shared libraries by apt),
# the previous rc, the heartbeats, and the test host's dry run of every prod composition as r2. The checkout is under
# /var/tmp: r2 reads it.
set -euo pipefail
src=$1 src_sha=$2 commit=$3
export RELEASE_URL=$4 RELEASE_SHA256=$5
w=/var/tmp/promote-rehearse
rm -rf "$w" && mkdir -p "$w" && cd "$w"
curl -fsSL --retry 3 -o src.tar.gz "$src"
echo "$src_sha src.tar.gz" | sha256sum -c --quiet
tar xzf src.tar.gz && rm src.tar.gz
git init -q && git add -A && git -c user.name=rehearse -c user.email=rehearse@localhost commit -qm src
bash scripts/promote.sh prepare
bash scripts/ci-test.sh host
install -d -o r2 /home/r2
echo "sha:$commit" > /home/r2/requester.spec
bash scripts/promote.sh --dry-run
echo "==> rehearsal done"