fix(app): Properly detects release notes added after a release when upgrading an app (#523)
All checks were successful
continuous-integration/drone/push Build is passing

Fixes #488

Reviewed-on: #523
Reviewed-by: decentral1se <decentral1se@noreply.git.coopcloud.tech>
Co-authored-by: p4u1 <p4u1_f4u1@riseup.net>
Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
This commit is contained in:
p4u1 2025-03-21 10:25:46 +00:00 committed by p4u1
parent cb63cfe9c2
commit 80ad6c6681
2 changed files with 23 additions and 5 deletions

View File

@ -14,6 +14,7 @@ import (
"coopcloud.tech/abra/pkg/formatter" "coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/lint" "coopcloud.tech/abra/pkg/lint"
"coopcloud.tech/abra/pkg/log" "coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
stack "coopcloud.tech/abra/pkg/upstream/stack" stack "coopcloud.tech/abra/pkg/upstream/stack"
"coopcloud.tech/tagcmp" "coopcloud.tech/tagcmp"
"github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2"
@ -69,7 +70,13 @@ beforehand. See "abra app backup" for more.`,
app := internal.ValidateApp(args) 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) log.Fatal(err)
} }
@ -142,10 +149,9 @@ beforehand. See "abra app backup" for more.`,
log.Debugf("choosing %s as version to upgrade", chosenUpgrade) log.Debugf("choosing %s as version to upgrade", chosenUpgrade)
// NOTE(d1): if release notes written after git tag published, read them // Get the release notes before checking out the new version in the
// before we check out the tag and then they'll appear to be missing. this // recipe. This enables us to get release notes, that were added after
// covers when we obviously will forget to write release notes before // a release.
// publishing
if err := getReleaseNotes(app, versions, chosenUpgrade, deployMeta, &upgradeReleaseNotes); err != nil { if err := getReleaseNotes(app, versions, chosenUpgrade, deployMeta, &upgradeReleaseNotes); err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -204,6 +204,18 @@ teardown(){
assert_output --partial 'release notes baz' # 0.2.0+1.21.0 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 # bats test_tags=slow
@test "upgrade commit deployment not possible" { @test "upgrade commit deployment not possible" {
tagHash=$(_get_tag_hash "0.1.0+1.20.0") tagHash=$(_get_tag_hash "0.1.0+1.20.0")