Release: cut over Echoion 2.0 components
Modular container CI / release-build (push) Has been cancelled
Modular container CI / release-build (push) Has been cancelled
This commit is contained in:
169 files changed
+3069
-32261
No files matched your search
@@ -762,6 +762,43 @@ printf '# changed privileged updater helper in 1.2.4\n' >> \
|
||||
python3 "$PACKAGING_DIR/../scripts/generate-release-manifest.py" \
|
||||
--root "$upgrade_payload" --version 1.2.4
|
||||
|
||||
v2_payload=$TEST_ROOT/v2-payload
|
||||
cp -a -- "$upgrade_payload" "$v2_payload"
|
||||
sed -i 's/"version": "1.2.4"/"version": "2.0.0"/' \
|
||||
"$v2_payload/manifest.json"
|
||||
python3 "$PACKAGING_DIR/../scripts/generate-release-manifest.py" \
|
||||
--root "$v2_payload" --version 2.0.0
|
||||
legacy_migration_prefix=$TEST_ROOT/legacy-migration
|
||||
legacy_config_home=$TEST_ROOT/legacy-home
|
||||
XDG_CONFIG_HOME=$legacy_config_home \
|
||||
"$payload/install.sh" --mode portable --prefix "$legacy_migration_prefix" \
|
||||
--register-service user --non-interactive >/dev/null
|
||||
printf 'preserved database bytes\n' \
|
||||
>"$legacy_migration_prefix/state/echoion.db"
|
||||
legacy_tree_hash=$(sha256sum -- \
|
||||
"$legacy_migration_prefix/current/bin/echoiond")
|
||||
legacy_tree_hash=${legacy_tree_hash%% *}
|
||||
: >"$SYSTEMCTL_LOG"
|
||||
XDG_CONFIG_HOME=$legacy_config_home \
|
||||
"$v2_payload/install.sh" --mode portable --prefix "$legacy_migration_prefix" \
|
||||
--register-service user --non-interactive >/dev/null
|
||||
[[ $(readlink -- "$legacy_migration_prefix/current") == versions/2.0.0 ]] ||
|
||||
fail 'v1 migration did not activate the initial v2 generation'
|
||||
assert_file "$legacy_migration_prefix/legacy/v1/tree/bin/echoiond"
|
||||
archived_tree_hash=$(sha256sum -- \
|
||||
"$legacy_migration_prefix/legacy/v1/tree/bin/echoiond")
|
||||
archived_tree_hash=${archived_tree_hash%% *}
|
||||
[[ $archived_tree_hash == "$legacy_tree_hash" ]] ||
|
||||
fail 'v1 migration did not preserve the complete legacy executable tree'
|
||||
assert_file "$legacy_migration_prefix/legacy/v1/service/echoion.service"
|
||||
assert_file \
|
||||
"$legacy_migration_prefix/state/updates/pending-install-generation"
|
||||
assert_file "$legacy_migration_prefix/state/echoion.db"
|
||||
assert_contains "$legacy_migration_prefix/.echoion-install" \
|
||||
'legacy_rollback=legacy/v1'
|
||||
assert_contains "$SYSTEMCTL_LOG" '--user stop echoion.service'
|
||||
"$legacy_migration_prefix/uninstall.sh" --purge --non-interactive >/dev/null
|
||||
|
||||
bootstrap_upgrade_prefix=$TEST_ROOT/bootstrap-upgrade
|
||||
"$payload/install.sh" --mode portable --prefix "$bootstrap_upgrade_prefix" \
|
||||
--register-service none --non-interactive >/dev/null
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# != 2 ]]; then
|
||||
echo "usage: $0 ECHOION_UPDATER SOURCE_ROOT" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
updater=$(realpath -e -- "$1")
|
||||
source_root=$(realpath -e -- "$2")
|
||||
temporary=$(mktemp -d "${TMPDIR:-/tmp}/echoion-updater-test.XXXXXX")
|
||||
trap 'rm -rf -- "$temporary"' EXIT
|
||||
root=$temporary/root
|
||||
stable_helper=$root/libexec/updater/installer/bin/echoion-updater
|
||||
mkdir -p "$root/versions" "$root/state" "$(dirname -- "$stable_helper")"
|
||||
install -m 0755 "$updater" "$stable_helper"
|
||||
stable_helper_sha=$(sha256sum "$stable_helper")
|
||||
stable_helper_sha=${stable_helper_sha%% *}
|
||||
|
||||
make_release() {
|
||||
local destination=$1
|
||||
local version=$2
|
||||
mkdir -p "$destination/bin" "$destination/lib" "$destination/service" \
|
||||
"$destination/share/echoion/web" "$destination/share/echoion/tools" \
|
||||
"$destination/share/echoion/certs"
|
||||
install -m 0755 /bin/true "$destination/bin/echoiond"
|
||||
install -m 0755 "$updater" "$destination/bin/echoion-updater"
|
||||
printf 'core %s\n' "$version" >"$destination/lib/Echoion.ts"
|
||||
install -m 0644 "$source_root/packaging/service/echoion.service.in" \
|
||||
"$destination/service/echoion.service.in"
|
||||
install -m 0644 "$source_root/packaging/service/echoion-updater.service.in" \
|
||||
"$destination/service/echoion-updater.service.in"
|
||||
install -m 0644 "$source_root/packaging/service/echoion-updater.timer.in" \
|
||||
"$destination/service/echoion-updater.timer.in"
|
||||
install -m 0755 "$source_root/scripts/validate-release-manifest.py" \
|
||||
"$destination/share/echoion/tools/validate-release-manifest.py"
|
||||
printf '{}\n' >"$destination/share/echoion/config.example.json"
|
||||
printf '<!doctype html>\n' >"$destination/share/echoion/web/index.html"
|
||||
printf 'test trust bundle\n' \
|
||||
>"$destination/share/echoion/certs/ca-certificates.crt"
|
||||
python3 "$source_root/scripts/generate-release-manifest.py" \
|
||||
--root "$destination" --version "$version"
|
||||
}
|
||||
|
||||
make_release "$root/versions/1.0.0" 1.0.0
|
||||
make_release "$root/versions/1.1.0" 1.1.0
|
||||
ln -s versions/1.1.0 "$root/current"
|
||||
cat >"$root/.echoion-install" <<EOF
|
||||
format=1
|
||||
prefix=$root
|
||||
version=1.1.0
|
||||
state_dir=$root/state
|
||||
EOF
|
||||
cat >"$root/install.json" <<EOF
|
||||
{"schemaVersion":1,"version":"1.1.0","stateDir":"$root/state"}
|
||||
EOF
|
||||
install -m 0644 /dev/null "$root/.update.lock"
|
||||
printf 'P 1.0.0\nH 1.0.0\nP 1.1.0\nH 1.1.0\n' >"$root/health.log"
|
||||
chmod 0644 "$root/health.log"
|
||||
|
||||
status=$("$updater" --root "$root" status --json)
|
||||
[[ $status == *'"current":"1.1.0"'* ]]
|
||||
[[ $status == *'"1.0.0"'* ]]
|
||||
|
||||
make_release "$root/versions/0.9.0" 0.9.0
|
||||
if "$updater" --root "$root" rollback-runtime --version 0.9.0 \
|
||||
--retain 2 >/dev/null 2>&1; then
|
||||
echo "updater accepted a runtime without durable healthy state" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ $(readlink -- "$root/current") == versions/1.1.0 ]]
|
||||
rm -rf -- "$root/versions/0.9.0"
|
||||
|
||||
history_victim=$temporary/history-victim
|
||||
printf '%s\n' 'must remain unchanged' >"$history_victim"
|
||||
chmod 0600 "$history_victim"
|
||||
mkdir -p "$root/state/updates"
|
||||
ln -s "$history_victim" "$root/state/updates/history.jsonl"
|
||||
if "$updater" --root "$root" request rollback-runtime --version 1.0.0 \
|
||||
--retain 2 --origin test >/dev/null 2>&1; then
|
||||
echo "updater followed a symlink while opening privileged history" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ $(<"$history_victim") == 'must remain unchanged' ]]
|
||||
[[ $(stat -c '%a' -- "$history_victim") == 600 ]]
|
||||
rm -- "$root/state/updates/history.jsonl"
|
||||
rm -f -- "$root/state/updates/privileged-requests/"*.json
|
||||
|
||||
queue_victim=$temporary/queue-victim
|
||||
mkdir "$queue_victim"
|
||||
mv "$root/state/updates/privileged-requests" \
|
||||
"$root/state/updates/privileged-requests.safe"
|
||||
ln -s "$queue_victim" "$root/state/updates/privileged-requests"
|
||||
if "$updater" --root "$root" request rollback-runtime --version 1.0.0 \
|
||||
--retain 2 --origin test >/dev/null 2>&1; then
|
||||
echo "updater accepted a symlinked privileged request directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ -z $(find "$queue_victim" -mindepth 1 -print -quit) ]]
|
||||
rm -- "$root/state/updates/privileged-requests"
|
||||
mv "$root/state/updates/privileged-requests.safe" \
|
||||
"$root/state/updates/privileged-requests"
|
||||
|
||||
if "$updater" --root "$root" check >/dev/null 2>&1 ||
|
||||
[[ -e $root/state/updates/requests ]]; then
|
||||
echo "updater still exposes the dead generic request queue" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if "$updater" --root "$root" request rollback-runtime \
|
||||
--version '../escape' --retain 2 >/dev/null 2>&1; then
|
||||
echo "updater accepted an unsafe request identifier" >&2
|
||||
exit 1
|
||||
fi
|
||||
if "$updater" --root "$root" request rollback-runtime \
|
||||
--version 1.0.0 --retain 0 >/dev/null 2>&1; then
|
||||
echo "updater accepted an out-of-range retention count" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
candidate=$root/state/updates/staged/runtime-1-2-0
|
||||
make_release "$candidate" 1.2.0
|
||||
# Candidate runtime code must never replace the stable privileged helper.
|
||||
install -m 0755 /bin/false "$candidate/bin/echoion-updater"
|
||||
python3 "$source_root/scripts/generate-release-manifest.py" \
|
||||
--root "$candidate" --version 1.2.0
|
||||
manifest_sha=$(sha256sum "$candidate/manifest.json")
|
||||
manifest_sha=${manifest_sha%% *}
|
||||
pending_victim=$temporary/pending-victim
|
||||
printf '%s\n' 'must remain unchanged' >"$pending_victim"
|
||||
ln -s "$pending_victim" "$root/state/updates/pending-runtime.json"
|
||||
privileged=$("$updater" --root "$root" request activate-runtime \
|
||||
--staging runtime-1-2-0 --version 1.2.0 \
|
||||
--manifest-sha256 "$manifest_sha" --retain 3 --origin test)
|
||||
[[ $privileged == "$root/state/updates/privileged-requests/"*.json ]]
|
||||
if "$updater" --root "$root" consume >/dev/null 2>&1; then
|
||||
echo "updater accepted a symlinked pending-runtime journal" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ $(<"$pending_victim") == 'must remain unchanged' ]]
|
||||
[[ $(readlink -- "$root/current") == versions/1.1.0 ]]
|
||||
[[ -d $candidate ]]
|
||||
rm -- "$root/state/updates/pending-runtime.json"
|
||||
"$updater" --root "$root" consume >/dev/null
|
||||
[[ $(<"$pending_victim") == 'must remain unchanged' ]]
|
||||
[[ $(readlink -- "$root/current") == versions/1.2.0 ]]
|
||||
[[ ! -e $candidate ]]
|
||||
[[ $(sha256sum "$stable_helper") == "$stable_helper_sha "* ]]
|
||||
[[ $(sha256sum "$root/current/bin/echoion-updater") != "$stable_helper_sha "* ]]
|
||||
grep -F '"version": "1.2.0"' "$root/state/updates/activated-runtime.json" >/dev/null
|
||||
grep -F '"manifestPath": "versions/1.2.0/manifest.json"' \
|
||||
"$root/state/updates/activated-runtime.json" >/dev/null
|
||||
grep -F '"retainHealthyVersions": 3' \
|
||||
"$root/state/updates/activated-runtime.json" >/dev/null
|
||||
grep -F '"state": "pending"' "$root/state/updates/pending-runtime.json" >/dev/null
|
||||
grep -F '"retainHealthyVersions": 3' \
|
||||
"$root/state/updates/pending-runtime.json" >/dev/null
|
||||
grep -F 'version=1.2.0' "$root/.echoion-install" >/dev/null
|
||||
grep -F '"version":"1.2.0"' "$root/install.json" >/dev/null
|
||||
|
||||
rm -- "$root/state/updates/status.json"
|
||||
mkdir "$root/state/updates/status.json"
|
||||
"$updater" --root "$root" request commit-runtime --version 1.2.0 \
|
||||
--retain 3 --origin daemon >/dev/null
|
||||
"$updater" --root "$root" consume >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.2.0 ]]
|
||||
[[ ! -e $root/state/updates/pending-runtime.json ]]
|
||||
[[ -f $root/state/updates/committed-runtime.json ]]
|
||||
grep -F '"state": "committed"' \
|
||||
"$root/state/updates/activated-runtime.json" >/dev/null
|
||||
grep -F 'H 1.2.0' "$root/health.log" >/dev/null
|
||||
[[ ! -e $root/staging ]]
|
||||
rmdir "$root/state/updates/status.json"
|
||||
|
||||
candidate=$root/state/updates/staged/runtime-1-3-0
|
||||
make_release "$candidate" 1.3.0
|
||||
manifest_sha=$(sha256sum "$candidate/manifest.json")
|
||||
manifest_sha=${manifest_sha%% *}
|
||||
"$updater" --root "$root" request activate-runtime \
|
||||
--staging runtime-1-3-0 --version 1.3.0 \
|
||||
--manifest-sha256 "$manifest_sha" --retain 3 --origin test >/dev/null
|
||||
"$updater" --root "$root" consume >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.3.0 ]]
|
||||
[[ -f $root/state/updates/pending-runtime.json ]]
|
||||
|
||||
# A helper pass inside the durable health grace period must not race the
|
||||
# daemon's 30-second health confirmation.
|
||||
"$updater" --root "$root" consume >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.3.0 ]]
|
||||
[[ -f $root/state/updates/pending-runtime.json ]]
|
||||
|
||||
# Once the durable deadline has expired, a pass with no matching confirmation
|
||||
# restores the previous version and records the failed candidate.
|
||||
sed -i 's/"activatedAt": "[^"]*"/"activatedAt": "2000-01-01T00:00:00Z"/' \
|
||||
"$root/state/updates/pending-runtime.json"
|
||||
"$updater" --root "$root" consume >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.2.0 ]]
|
||||
[[ ! -e $root/state/updates/pending-runtime.json ]]
|
||||
grep -F '"version": "1.3.0"' \
|
||||
"$root/state/updates/failed-runtime.json" >/dev/null
|
||||
grep -F '"state": "rolled-back"' \
|
||||
"$root/state/updates/activated-runtime.json" >/dev/null
|
||||
grep -F 'F 1.3.0' "$root/health.log" >/dev/null
|
||||
[[ ! -e $root/versions/1.3.0 ]]
|
||||
|
||||
"$updater" --root "$root" request rollback-runtime --version 1.1.0 \
|
||||
--retain 3 --origin test >/dev/null
|
||||
"$updater" --root "$root" consume >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.1.0 ]]
|
||||
grep -F '"version": "1.1.0"' "$root/state/updates/activated-runtime.json" >/dev/null
|
||||
|
||||
"$updater" --root "$root" rollback-runtime --version 1.0.0 \
|
||||
--retain 3 >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.0.0 ]]
|
||||
grep -F '"operation":"rollback-runtime"' "$root/state/updates/history.jsonl" >/dev/null
|
||||
|
||||
if "$updater" --root "$root" rollback-runtime --version '../../tmp' \
|
||||
>/dev/null 2>&1; then
|
||||
echo "updater accepted an unsafe rollback target" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ $(readlink -- "$root/current") == versions/1.0.0 ]]
|
||||
|
||||
"$updater" --root "$root" reconcile >/dev/null
|
||||
grep -F '"current": "1.0.0"' "$root/state/updates/status.json" >/dev/null
|
||||
[[ $(sha256sum "$stable_helper") == "$stable_helper_sha "* ]]
|
||||
|
||||
# Retention is evaluated only after a committed health confirmation or an
|
||||
# explicit validated rollback. Active plus one previous healthy version is
|
||||
# retained; known failed and older healthy versions are eligible for pruning.
|
||||
"$updater" --root "$root" rollback-runtime --version 1.2.0 \
|
||||
--retain 1 >/dev/null
|
||||
[[ $(readlink -- "$root/current") == versions/1.2.0 ]]
|
||||
[[ -d $root/versions/1.0.0 ]]
|
||||
[[ ! -e $root/versions/1.1.0 ]]
|
||||
[[ ! -e $root/versions/1.3.0 ]]
|
||||
[[ ! -e $root/staging ]]
|
||||
|
||||
echo "updater lifecycle tests passed"
|
||||
Reference in new issue
Block a user