chore: allow install e2e previous override
This commit is contained in:
@@ -3,6 +3,8 @@ set -euo pipefail
|
|||||||
|
|
||||||
INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://clawd.bot/install.sh}"
|
INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://clawd.bot/install.sh}"
|
||||||
MODELS_MODE="${CLAWDBOT_E2E_MODELS:-both}" # both|openai|anthropic
|
MODELS_MODE="${CLAWDBOT_E2E_MODELS:-both}" # both|openai|anthropic
|
||||||
|
E2E_PREVIOUS_VERSION="${CLAWDBOT_INSTALL_E2E_PREVIOUS:-}"
|
||||||
|
SKIP_PREVIOUS="${CLAWDBOT_INSTALL_E2E_SKIP_PREVIOUS:-0}"
|
||||||
|
|
||||||
if [[ "$MODELS_MODE" != "both" && "$MODELS_MODE" != "openai" && "$MODELS_MODE" != "anthropic" ]]; then
|
if [[ "$MODELS_MODE" != "both" && "$MODELS_MODE" != "openai" && "$MODELS_MODE" != "anthropic" ]]; then
|
||||||
echo "ERROR: CLAWDBOT_E2E_MODELS must be one of: both|openai|anthropic" >&2
|
echo "ERROR: CLAWDBOT_E2E_MODELS must be one of: both|openai|anthropic" >&2
|
||||||
@@ -24,6 +26,9 @@ fi
|
|||||||
|
|
||||||
echo "==> Resolve npm versions"
|
echo "==> Resolve npm versions"
|
||||||
LATEST_VERSION="$(npm view clawdbot version)"
|
LATEST_VERSION="$(npm view clawdbot version)"
|
||||||
|
if [[ -n "$E2E_PREVIOUS_VERSION" ]]; then
|
||||||
|
PREVIOUS_VERSION="$E2E_PREVIOUS_VERSION"
|
||||||
|
else
|
||||||
PREVIOUS_VERSION="$(node - <<'NODE'
|
PREVIOUS_VERSION="$(node - <<'NODE'
|
||||||
const { execSync } = require("node:child_process");
|
const { execSync } = require("node:child_process");
|
||||||
const versions = JSON.parse(execSync("npm view clawdbot versions --json", { encoding: "utf8" }));
|
const versions = JSON.parse(execSync("npm view clawdbot versions --json", { encoding: "utf8" }));
|
||||||
@@ -31,10 +36,15 @@ if (!Array.isArray(versions) || versions.length === 0) process.exit(1);
|
|||||||
process.stdout.write(versions.length >= 2 ? versions[versions.length - 2] : versions[0]);
|
process.stdout.write(versions.length >= 2 ? versions[versions.length - 2] : versions[0]);
|
||||||
NODE
|
NODE
|
||||||
)"
|
)"
|
||||||
|
fi
|
||||||
echo "latest=$LATEST_VERSION previous=$PREVIOUS_VERSION"
|
echo "latest=$LATEST_VERSION previous=$PREVIOUS_VERSION"
|
||||||
|
|
||||||
|
if [[ "$SKIP_PREVIOUS" == "1" ]]; then
|
||||||
|
echo "==> Skip preinstall previous (CLAWDBOT_INSTALL_E2E_SKIP_PREVIOUS=1)"
|
||||||
|
else
|
||||||
echo "==> Preinstall previous (forces installer upgrade path; avoids read() prompt)"
|
echo "==> Preinstall previous (forces installer upgrade path; avoids read() prompt)"
|
||||||
npm install -g "clawdbot@${PREVIOUS_VERSION}"
|
npm install -g "clawdbot@${PREVIOUS_VERSION}"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Run official installer one-liner"
|
echo "==> Run official installer one-liner"
|
||||||
curl -fsSL "$INSTALL_URL" | bash
|
curl -fsSL "$INSTALL_URL" | bash
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ echo "==> Run E2E installer test"
|
|||||||
docker run --rm -t \
|
docker run --rm -t \
|
||||||
-e CLAWDBOT_INSTALL_URL="$INSTALL_URL" \
|
-e CLAWDBOT_INSTALL_URL="$INSTALL_URL" \
|
||||||
-e CLAWDBOT_E2E_MODELS="$CLAWDBOT_E2E_MODELS" \
|
-e CLAWDBOT_E2E_MODELS="$CLAWDBOT_E2E_MODELS" \
|
||||||
|
-e CLAWDBOT_INSTALL_E2E_PREVIOUS="${CLAWDBOT_INSTALL_E2E_PREVIOUS:-}" \
|
||||||
|
-e CLAWDBOT_INSTALL_E2E_SKIP_PREVIOUS="${CLAWDBOT_INSTALL_E2E_SKIP_PREVIOUS:-0}" \
|
||||||
-e OPENAI_API_KEY="$OPENAI_API_KEY" \
|
-e OPENAI_API_KEY="$OPENAI_API_KEY" \
|
||||||
-e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
|
-e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
|
||||||
"$IMAGE_NAME"
|
"$IMAGE_NAME"
|
||||||
|
|||||||
Reference in New Issue
Block a user