diff --git a/cli/internal/deploy.go b/cli/internal/deploy.go index 3d895128..b4a369ff 100644 --- a/cli/internal/deploy.go +++ b/cli/internal/deploy.go @@ -64,6 +64,15 @@ func NewVersionOverview( upperKind := strings.ToUpper(kind) + envVersion, err := recipe.GetEnvVersionRaw(app.Recipe.Name) + if err != nil { + return err + } + + if envVersion == "" { + envVersion = config.NO_VERSION_DEFAULT + } + rows := [][]string{ {"DOMAIN", domain}, {"RECIPE", app.Recipe.Name}, @@ -78,7 +87,7 @@ func NewVersionOverview( {"VERSION", formatter.BoldDirtyDefault(toDeployVersion)}, {fmt.Sprintf("%s.ENV", strings.ToUpper(app.Domain)), "---"}, - {"CURRENT VERSION", formatter.BoldDirtyDefault(app.Recipe.EnvVersion)}, + {"CURRENT VERSION", formatter.BoldDirtyDefault(envVersion)}, {"NEW VERSION", formatter.BoldDirtyDefault(toDeployVersion)}, } diff --git a/tests/integration/app_rollback.bats b/tests/integration/app_rollback.bats index 8658caa3..ac29270d 100644 --- a/tests/integration/app_rollback.bats +++ b/tests/integration/app_rollback.bats @@ -19,6 +19,7 @@ setup(){ } teardown(){ + _reset_app _undeploy_app _reset_recipe } diff --git a/tests/integration/app_rollback_overview.bats b/tests/integration/app_rollback_overview.bats index 9a739bfa..5f652980 100644 --- a/tests/integration/app_rollback_overview.bats +++ b/tests/integration/app_rollback_overview.bats @@ -19,6 +19,7 @@ setup(){ } teardown(){ + _reset_app _undeploy_app _reset_recipe } @@ -74,3 +75,30 @@ teardown(){ "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" assert_success } + +@test "app rollback no .env version" { + run $ABRA app deploy "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \ + --no-input --no-converge-checks + assert_success + + _wipe_env_version + + run $ABRA app rollback "$TEST_APP_DOMAIN" "0.1.0+1.20.0" \ + --no-input --no-converge-checks + assert_success + + # current deployment + assert_output --regexp 'VERSION.*' + "0.2.0+1.21.0" + assert_output --regexp 'CHAOS.*false' + + # rollback + assert_output --regexp 'VERSION.*' + "0.1.0+1.20.0" + + # env version + assert_output --regexp 'CURRENT VERSION.*N/A' + assert_output --regexp 'NEW VERSION.*' + "0.2.0+1.21.0" + + run grep -q "TYPE=$TEST_RECIPE:${latestRelease}" \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_success +} diff --git a/tests/integration/app_upgrade_overview.bats b/tests/integration/app_upgrade_overview.bats index a6bbc189..826ccc18 100644 --- a/tests/integration/app_upgrade_overview.bats +++ b/tests/integration/app_upgrade_overview.bats @@ -73,3 +73,33 @@ teardown(){ "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" assert_success } + +@test "app upgrade no .env version" { + latestRelease=$(_latest_release) + + run $ABRA app deploy "$TEST_APP_DOMAIN" "0.2.0+1.21.0" \ + --no-input --no-converge-checks + assert_success + + _wipe_env_version + + run $ABRA app upgrade "$TEST_APP_DOMAIN" \ + --no-input --no-converge-checks --force + assert_success + + # current deployment + assert_output --regexp 'VERSION.*' + "0.2.0+1.21.0" + assert_output --regexp 'CHAOS.*false' + + # upgrade + assert_output --regexp 'VERSION.*' + "0.2.0+1.21.0" + assert_output --regexp 'CHAOS.*false' + + # env version + assert_output --regexp 'CURRENT VERSION.*N/A' + assert_output --regexp 'NEW VERSION.*' + "0.2.0+1.21.0" + + run grep -q "TYPE=$TEST_RECIPE:${latestRelease}" \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_success +}