Skip to content
Open
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
9 changes: 6 additions & 3 deletions deployments/cli/community/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions deployments/swarm/community/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Loading