Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix manager pinned update source migration #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Ryson-32 merged 1 commit into main from ryan/dev
Jun 24, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions local/scripts/selfhost-shell.test.ts
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,95 @@ ENV
expect(result.stdout).toContain("SUBBOOST_MANAGER_URL=file://");
}, 10_000);

it("migrates old fixed official update sources to stable latest", () => {
const script = `
set -Eeuo pipefail
home="$(mktemp -d)"
trap 'rm -rf "$home"' EXIT
mkdir -p "$home/bin"
cat > "$home/.env" <<'ENV'
SUBBOOST_RELEASE_URL=https://github.com/SubBoost/subboost/releases/download/v2.4.0/release.json
SUBBOOST_IMAGE=old-image
POSTGRES_DB=subboost
POSTGRES_USER=subboost
POSTGRES_PASSWORD=password
DATABASE_URL=postgresql://subboost:password@db:5432/subboost?schema=public
ENCRYPTION_KEY=key
JWT_SECRET=jwt
CRON_SECRET=cron
APP_URL=http://127.0.0.1:31000
SUBBOOST_PORT=31000
ENV
: > "$home/docker-compose.yml"
export SUBBOOST_SCRIPT_SOURCE_ONLY=1
export SUBBOOST_HOME="$home"
export SUBBOOST_BIN="$home/bin/subboost"
export SUBBOOST_DOCTOR_HEALTH_ATTEMPTS=1
export SUBBOOST_DOCTOR_HEALTH_INTERVAL_SECONDS=0
source local/scripts/subboost.sh
sudo_do() { "$@"; }
install_secret_file() { cp "1ドル" "2ドル"; }
read_env_file() { cat "$ENV_FILE"; }
download_log="$home/download-log"
: > "$download_log"
download_to_temp() {
printf '%s\\n' "1ドル" >> "$download_log"
case "1ドル" in
*release.json)
cat > "2ドル" <<'JSON'
{"image":"new-image","composeUrl":"docker-compose.image.yml","managerUrl":"subboost-manager"}
JSON
;;
*)
printf 'asset\\n' > "2ドル"
;;
esac
}
docker_log="$home/docker-log"
: > "$docker_log"
docker() {
if [ "1ドル" = "info" ]; then return 0; fi
if [ "1ドル" = "compose" ]; then
case "$*" in
"compose version"*) return 0 ;;
*" config") return 0 ;;
*" pull")
printf 'pull_image=%s\\n' "\${SUBBOOST_IMAGE:-}" >> "$docker_log"
return 0
;;
*" up -d --remove-orphans") return 0 ;;
*" up -d --no-deps --force-recreate app") return 0 ;;
*" ps -q app") printf 'app-id\\n'; return 0 ;;
*" ps -q db") printf 'db-id\\n'; return 0 ;;
*" ps -q cron") printf 'cron-id\\n'; return 0 ;;
esac
fi
if [ "1ドル" = "inspect" ]; then
case "$*" in
*".State.Status"*) printf 'running\\n'; return 0 ;;
*".State.Health"*) printf 'healthy\\n'; return 0 ;;
esac
fi
return 0
}
curl() { return 0; }
update_cmd
cat "$download_log"
cat "$docker_log"
cat "$home/.env"
`;

const result = runBash(script);

expect(result.status).toBe(0);
expect(result.stdout).toContain("Detected old fixed release update source");
expect(result.stdout).toContain("https://github.com/SubBoost/subboost/releases/latest/download/release.json");
expect(result.stdout).toContain("pull_image=new-image");
expect(result.stdout).toContain(
"SUBBOOST_RELEASE_URL=https://github.com/SubBoost/subboost/releases/latest/download/release.json"
);
}, 10_000);

it("updates exact env keys without removing similarly prefixed names", () => {
const script = `
set -Eeuo pipefail
Expand Down
18 changes: 18 additions & 0 deletions local/scripts/subboost.sh
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -Eeuo pipefail

DEFAULT_HOME="/opt/subboost"
DEFAULT_STABLE_RELEASE_URL="https://github.com/SubBoost/subboost/releases/latest/download/release.json"
SUBBOOST_HOME="${SUBBOOST_HOME:-$DEFAULT_HOME}"
ENV_FILE="$SUBBOOST_HOME/.env"
COMPOSE_FILE="$SUBBOOST_HOME/docker-compose.yml"
Expand Down Expand Up @@ -138,6 +139,20 @@ write_runtime_env_value() {
export "$key=$value"
}

is_official_fixed_release_url() {
case "1ドル" in
https://github.com/SubBoost/subboost/releases/download/v[0-9]*.[0-9]*.[0-9]*/release.json) return 0 ;;

@chatgpt-codex-connector chatgpt-codex-connector Bot Jun 24, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Constrain migration to exact stable tags

For installations intentionally pinned to an official prerelease asset such as https://github.com/SubBoost/subboost/releases/download/v2.6.0-beta.1/release.json, this shell glob still matches because [0-9]* means "a digit followed by arbitrary characters," not "digits only." update_cmd then rewrites SUBBOOST_RELEASE_URL to the stable latest manifest before fetching, unexpectedly moving prerelease users off their selected channel instead of only migrating old fixed stable tags.

Useful? React with 👍 / 👎.

*) return 1 ;;
esac
}

migrate_update_release_url() {
local release_url="1ドル"
is_official_fixed_release_url "$release_url" || return 1
say "Detected old fixed release update source; switching updates to stable latest."
write_runtime_env_value SUBBOOST_RELEASE_URL "$DEFAULT_STABLE_RELEASE_URL"
}

install_file_from_url() {
local url="1ドル"
local destination="2ドル"
Expand Down Expand Up @@ -281,6 +296,9 @@ update_cmd() {
local release_file="$TMP_DIR/release.json"
local image compose_url manager_url
mkdir -p "$TMP_DIR"
if migrate_update_release_url "$release_url"; then

@chatgpt-codex-connector chatgpt-codex-connector Bot Jun 24, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid masking migration write failures

When an old fixed official URL is detected but .env cannot be rewritten (for example because sudo is unavailable or permissions changed), invoking the side-effecting migration from an if condition suppresses errexit inside that function, so a failed write_runtime_env_value just makes the condition false and update_cmd continues with the old pinned URL after printing the migration message. This can leave the installation unmigrated instead of failing clearly at the point where the release source could not be saved.

Useful? React with 👍 / 👎.

release_url="$DEFAULT_STABLE_RELEASE_URL"
fi
if [ -n "$release_url" ] && download_to_temp "$release_url" "$release_file" 2>/dev/null; then
image="$(json_get image "$release_file" || true)"
compose_url="$(resolve_url "$release_url" "$(json_get composeUrl "$release_file" || true)")"
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /