From c3a2048eba010a30afada889cc44d75a61ebf5ee Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 4 Nov 2025 14:48:46 +0100 Subject: [PATCH] fix: throw away unknown version See https://git.coopcloud.tech/toolshed/abra/issues/715 --- pkg/app/app.go | 5 +++++ pkg/app/app_test.go | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/pkg/app/app.go b/pkg/app/app.go index dc91797c5..2b723f9fd 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -633,6 +633,11 @@ func (a App) WipeRecipeVersion() error { // WriteRecipeVersion writes the recipe version to the app .env file. func (a App) WriteRecipeVersion(version string, dryRun bool) error { + if version == config.UNKNOWN_DEFAULT { + log.Debug(i18n.G("version is unknown, skipping env write")) + return nil + } + file, err := os.Open(a.Path) if err != nil { return err diff --git a/pkg/app/app_test.go b/pkg/app/app_test.go index 038ce2946..a9de601ca 100644 --- a/pkg/app/app_test.go +++ b/pkg/app/app_test.go @@ -224,3 +224,16 @@ func TestWriteRecipeVersionOverwrite(t *testing.T) { assert.Equal(t, "foo", app.Recipe.EnvVersion) } + +func TestWriteRecipeVersionUnknown(t *testing.T) { + app, err := appPkg.GetApp(testPkg.ExpectedAppFiles, testPkg.AppName) + if err != nil { + t.Fatal(err) + } + + if err := app.WriteRecipeVersion(config.UNKNOWN_DEFAULT, false); err != nil { + t.Fatal(err) + } + + assert.NotEqual(t, config.UNKNOWN_DEFAULT, app.Recipe.EnvVersion) +}