diff --git a/tools/carto-download-customer-package.sh b/tools/carto-download-customer-package.sh index 4af0c8e..8f35200 100755 --- a/tools/carto-download-customer-package.sh +++ b/tools/carto-download-customer-package.sh @@ -164,15 +164,18 @@ if ( gcloud auth activate-service-account "${CARTO_SERVICE_ACCOUNT_EMAIL}" --key fi # Get latest customer package version -CUSTOMER_PACKAGE_FILE_LATEST="$(gsutil ls "gs://${CLIENT_STORAGE_BUCKET}/${CUSTOMER_PACKAGE_FOLDER}/${CUSTOMER_PACKAGE_NAME_PREFIX}-${CLIENT_ID}-*-*-*.zip")" +CUSTOMER_PACKAGE_FILE_LATEST="$(gsutil ls "gs://${CLIENT_STORAGE_BUCKET}/${CUSTOMER_PACKAGE_FOLDER}/${CUSTOMER_PACKAGE_NAME_PREFIX}-${CLIENT_ID}-*-*-*.zip" | grep -v '\-rc\-')" SELFHOSTED_VERSION_LATEST="$(echo "${CUSTOMER_PACKAGE_FILE_LATEST}" | grep -Eo "${CLIENT_ID}-[0-9]+-[0-9]+-[0-9]+")" SELFHOSTED_VERSION_LATEST="${SELFHOSTED_VERSION_LATEST/#${CLIENT_ID}-}" +_info "latest version: ${SELFHOSTED_VERSION_LATEST}" + # Check if exist the latest stable release STABLE_CUSTOMER_PACKAGE_DOWNLOAD_URL="gs://${CLIENT_STORAGE_BUCKET}/${CUSTOMER_PACKAGE_FOLDER}/${CUSTOMER_PACKAGE_NAME_PREFIX}-${CLIENT_ID}-${SELFHOSTED_VERSION_LATEST}.zip" if _check_gsutil_file ${STABLE_CUSTOMER_PACKAGE_DOWNLOAD_URL} then CUSTOMER_PACKAGE_DOWNLOAD_URL=${STABLE_CUSTOMER_PACKAGE_DOWNLOAD_URL} + _info "download file: ${CUSTOMER_PACKAGE_DOWNLOAD_URL}" else _error "stable version ${SELFHOSTED_VERSION_LATEST} not found: ${STABLE_CUSTOMER_PACKAGE_DOWNLOAD_URL}" 404 fi