From 80ad6c6681a5c11e2a8d6e243c4031e764e10d21 Mon Sep 17 00:00:00 2001 From: p4u1 Date: Fri, 21 Mar 2025 10:25:46 +0000 Subject: [PATCH] fix(app): Properly detects release notes added after a release when upgrading an app (#523) Fixes https://git.coopcloud.tech/toolshed/abra/issues/488 Reviewed-on: https://git.coopcloud.tech/toolshed/abra/pulls/523 Reviewed-by: decentral1se Co-authored-by: p4u1 Co-committed-by: p4u1 --- cli/app/upgrade.go | 16 +++++++++++----- tests/integration/app_upgrade.bats | 12 ++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/cli/app/upgrade.go b/cli/app/upgrade.go index d05510e1..95ede821 100644 --- a/cli/app/upgrade.go +++ b/cli/app/upgrade.go @@ -14,6 +14,7 @@ import ( "coopcloud.tech/abra/pkg/formatter" "coopcloud.tech/abra/pkg/lint" "coopcloud.tech/abra/pkg/log" + "coopcloud.tech/abra/pkg/recipe" stack "coopcloud.tech/abra/pkg/upstream/stack" "coopcloud.tech/tagcmp" "github.com/AlecAivazis/survey/v2" @@ -69,7 +70,13 @@ beforehand. See "abra app backup" for more.`, app := internal.ValidateApp(args) - if err := app.Recipe.Ensure(internal.GetEnsureContext()); err != nil { + if err := app.Recipe.Ensure(recipe.EnsureContext{ + Chaos: internal.Chaos, + Offline: internal.Offline, + // Ignore the env version for now, to make sure we are at the latest commit. + // This enables us to get release notes, that were added after a release. + IgnoreEnvVersion: true, + }); err != nil { log.Fatal(err) } @@ -142,10 +149,9 @@ beforehand. See "abra app backup" for more.`, log.Debugf("choosing %s as version to upgrade", chosenUpgrade) - // NOTE(d1): if release notes written after git tag published, read them - // before we check out the tag and then they'll appear to be missing. this - // covers when we obviously will forget to write release notes before - // publishing + // Get the release notes before checking out the new version in the + // recipe. This enables us to get release notes, that were added after + // a release. if err := getReleaseNotes(app, versions, chosenUpgrade, deployMeta, &upgradeReleaseNotes); err != nil { log.Fatal(err) } diff --git a/tests/integration/app_upgrade.bats b/tests/integration/app_upgrade.bats index badf74bd..47cd22a3 100644 --- a/tests/integration/app_upgrade.bats +++ b/tests/integration/app_upgrade.bats @@ -204,6 +204,18 @@ teardown(){ assert_output --partial 'release notes baz' # 0.2.0+1.21.0 } +# bats test_tags=slow +@test "show release note added after release" { + run $ABRA app deploy "$TEST_APP_DOMAIN" "0.2.0+1.21.0" --no-input --no-converge-checks + assert_success + assert_output --partial '0.2.0+1.21.0' + + run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.3.0+1.21.0" --no-input --no-converge-checks + assert_success + assert_output --partial '0.3.0+1.21.0' + assert_output --partial 'A release note added after the release' +} + # bats test_tags=slow @test "upgrade commit deployment not possible" { tagHash=$(_get_tag_hash "0.1.0+1.20.0")