From 05b2f10beccb503e0359fbfcc28f5e2c56fd5fa1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 8 Mar 2021 17:08:07 +0100 Subject: [PATCH] [bug] unable to compile the assets during the upgrade This occurs only if the env file has some whitespaces around the equal sign --- CHANGELOG.md | 3 +++ setup/upgrade.sh | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5941302fe..39ec9c326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog Fab-manager +## Next release +- Fix a bug: unable to compile the assets during the upgrade, if the env file has some whitespaces around the equal sign + ## v4.7.4 2021 March 08 - Show remaining training credits in the dashboard - Allow writing short rich descriptions for each subscription plan diff --git a/setup/upgrade.sh b/setup/upgrade.sh index e6a865e46..4a99e2cef 100644 --- a/setup/upgrade.sh +++ b/setup/upgrade.sh @@ -95,6 +95,12 @@ add_environments() done } +clean_env_file() +{ + # docker run --env-file does not support whitespaces in the environment variables so we must clean the file + sed -ri 's/^([A-Z0-9_]+)\s*=\s*(.*)$/\1=\2/g' ./config/env +} + compile_assets() { IMAGE=$(yq eval '.services.*.image | select(. == "sleede/fab-manager*")' docker-compose.yml) @@ -106,6 +112,7 @@ compile_assets() exit 1 fi PG_NET_ID=$(docker inspect "$PG_ID" -f "{{json .NetworkSettings.Networks }}" | jq -r '.[] .NetworkID') + clean_env_file # shellcheck disable=SC2068 docker run --rm --env-file ./config/env ${ENV_ARGS[@]} --link "$PG_ID" --net "$PG_NET_ID" -v "${PWD}/public/new_packs:/usr/src/app/public/packs" "$IMAGE" bundle exec rake assets:precompile docker-compose down