Skip to content

Commit

Permalink
fix: add nuvla downloader to updated script
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacio-penas committed May 13, 2024
1 parent 958f396 commit 9a0eea6
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions nuvlaedge-installer/commands/nuvlaedge-update
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on_update_failure=${on_update_failure:-$4}
environment=${environment:-$5}
project=${project:-$6}
github_releases=${github_releases:-${7:-"https://github.com/nuvlaedge/deployment/releases"}}
nuvla_releases=${nuvla_releases:-"https://nuvla.io"}
force_restart=${force_restart:-${8:-0}}
working_dir=${working_dir:-$9}
current_version=${current_version:-${10}}
Expand Down Expand Up @@ -38,16 +39,25 @@ then
fi
fi

source_code_url="${github_releases}/download/${target_version}"
# First, try downloading config files from Nuvla
nuvlaedge-printer "Downloading config files ${compose_files} from Nuvla for version ${target_version}"
download=$(nuvlaedge-download-nuvla-configs "${compose_files}" "${working_dir}" "${target_version}" 2>&1)

nuvlaedge-printer "Downloading config files ${compose_files} from ${source_code_url}" ${quiet} "INFO" "no"
# If fails, try Github assets
if [[ $? -ne 0 ]]
then
nuvlaedge-printer "Failed downloading compose files from Nuvla, trying Github assets: ${download}" 0 "WARNING" "no"
source_code_url="${github_releases}/download/${target_version}"

download=$(nuvlaedge-download-configs "${compose_files}" "${working_dir}" "${source_code_url}" 2>&1)
nuvlaedge-printer "Downloading config files ${compose_files} from ${source_code_url}" ${quiet} "INFO" "no"

if [[ $? -ne 0 ]]
then
nuvlaedge-printer "Update failed! Unable to retrieve files ${compose_files}: ${download}" 0 "ERROR" "no"
exit 1
download=$(nuvlaedge-download-configs "${compose_files}" "${working_dir}" "${source_code_url}" 2>&1)

if [[ $? -ne 0 ]]
then
nuvlaedge-printer "Update failed! Unable to retrieve files ${compose_files}: ${download}" 0 "ERROR" "no"
exit 1
fi
fi

nuvlaedge-printer "Preparing to update NuvlaEdge Engine running as project ${project}" ${quiet} "NONE" "yes"
Expand All @@ -61,11 +71,16 @@ then
then
down_dir="/tmp/down"
mkdir -p ${down_dir}
source_code_url_current="${github_releases}/download/${current_version}"
download=$(nuvlaedge-download-nuvla-configs "${compose_files}" "${down_dir}" "${current_version}" 2>&1)

nuvlaedge-printer "Downloading current config files ${compose_files} from ${source_code_url} for shutdown" ${quiet} "INFO" "no"
if [[ $? -ne 0 ]]
then
source_code_url_current="${github_releases}/download/${current_version}"

nuvlaedge-printer "Downloading current config files ${compose_files} from ${source_code_url} for shutdown" ${quiet} "INFO" "no"

download=$(nuvlaedge-download-configs "${compose_files}" "${down_dir}" "${source_code_url_current}" 2>&1)
download=$(nuvlaedge-download-configs "${compose_files}" "${down_dir}" "${source_code_url_current}" 2>&1)
fi

if [[ $? -ne 0 ]]
then
Expand Down

0 comments on commit 9a0eea6

Please sign in to comment.