From 02ceaac7782e1e5938f84636ccbac1d749e226e1 Mon Sep 17 00:00:00 2001 From: akshat5302 Date: Tue, 29 Sep 2026 18:33:16 +0530 Subject: [PATCH] fix(deployments): find the latest release when the GitHub API returns compact JSON install.sh and swarm.sh grep for '"tag_name": "' with a space, but the GitHub API now returns '"tag_name":"v1.4.2"', so the lookup is empty. Allow optional whitespace after the colon. The exit 1 in checkLatestRelease runs inside $(...), so it only left the subshell and install carried on with an empty APP_RELEASE ("invalid reference format"). Exit at the call sites when the lookup fails. Co-Authored-By: WOZCODE --- deployments/cli/community/install.sh | 9 ++++++--- deployments/swarm/community/swarm.sh | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/deployments/cli/community/install.sh b/deployments/cli/community/install.sh index accd89c812d..bae937673dc 100755 --- a/deployments/cli/community/install.sh +++ b/deployments/cli/community/install.sh @@ -57,7 +57,7 @@ function spinner() { function checkLatestRelease(){ echo "Checking for the latest release..." >&2 - local latest_release=$(curl -sSL https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": "[^"]*"' | sed 's/"tag_name": "//;s/"//g') + local latest_release=$(curl -sSL https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": *"[^"]*"' | sed 's/"tag_name": *"//;s/"//g') if [ -z "$latest_release" ]; then echo "Failed to check for the latest release. Exiting..." >&2 exit 1 @@ -217,7 +217,9 @@ function install() { echo "" if [ "$APP_RELEASE" == "stable" ]; then - export APP_RELEASE=$(checkLatestRelease) + # exit inside checkLatestRelease only leaves the $(...) subshell + APP_RELEASE=$(checkLatestRelease) || exit 1 + export APP_RELEASE fi local build_image=$(initialize) @@ -424,7 +426,8 @@ function restartServices() { startServices } function upgrade() { - local latest_release=$(checkLatestRelease) + local latest_release + latest_release=$(checkLatestRelease) || exit 1 echo "" echo "Current release: $APP_RELEASE" diff --git a/deployments/swarm/community/swarm.sh b/deployments/swarm/community/swarm.sh index 02f170f4d37..8a1da47b1ad 100755 --- a/deployments/swarm/community/swarm.sh +++ b/deployments/swarm/community/swarm.sh @@ -38,7 +38,7 @@ EOF function checkLatestRelease(){ echo "Checking for the latest release..." >&2 - local latest_release=$(curl -s https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": "[^"]*"' | sed 's/"tag_name": "//;s/"//g') + local latest_release=$(curl -s https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": *"[^"]*"' | sed 's/"tag_name": *"//;s/"//g') if [ -z "$latest_release" ]; then echo "Failed to check for the latest release. Exiting..." >&2 exit 1 @@ -220,7 +220,7 @@ function deployStack() { if [ ! -f "$DOCKER_FILE_PATH" ] || [ ! -f "$DOCKER_ENV_PATH" ]; then echo "Configuration files not found" echo "Downloading it now......" - APP_RELEASE=$(checkLatestRelease) + APP_RELEASE=$(checkLatestRelease) || exit 1 download fi if [ -z "$stack_name" ]; then @@ -335,7 +335,8 @@ function upgrade() { exit 1 fi - local latest_release=$(checkLatestRelease) + local latest_release + latest_release=$(checkLatestRelease) || exit 1 echo "" echo "Current release: $APP_RELEASE"