From 4c9abbf92569e8f291993c893a82834878cfb2ab Mon Sep 17 00:00:00 2001 From: decentral1se Date: Sat, 30 Aug 2025 12:45:48 +0200 Subject: [PATCH] feat: template example domain in release notes See https://git.coopcloud.tech/toolshed/organising/issues/521 --- cli/app/upgrade.go | 2 +- pkg/app/app.go | 7 ++++++- pkg/i18n/locales/abra.pot | 30 +++++++++++++++--------------- pkg/i18n/locales/es.po | 30 +++++++++++++++--------------- pkg/recipe/files.go | 12 ++++++++++-- tests/integration/app_upgrade.bats | 12 ++++++++++++ 6 files changed, 59 insertions(+), 34 deletions(-) diff --git a/cli/app/upgrade.go b/cli/app/upgrade.go index de97b0b3..65611016 100644 --- a/cli/app/upgrade.go +++ b/cli/app/upgrade.go @@ -335,7 +335,7 @@ func getReleaseNotes( if parsedVersion.IsGreaterThan(parsedDeployedVersion) && parsedVersion.IsLessThan(parsedChosenUpgrade) { - note, err := app.Recipe.GetReleaseNotes(version) + note, err := app.Recipe.GetReleaseNotes(version, app.Domain) if err != nil { return err } diff --git a/pkg/app/app.go b/pkg/app/app.go index cca0e1ca..a2ffe46a 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -390,7 +390,12 @@ func TemplateAppEnvSample(r recipe.Recipe, appName, server, domain string) error return err } - newContents := strings.Replace(string(read), r.Name+".example.com", domain, -1) + newContents := strings.Replace( + string(read), + fmt.Sprintf("%s.example.com", r.Name), + domain, + -1, + ) err = os.WriteFile(appEnvPath, []byte(newContents), 0) if err != nil { diff --git a/pkg/i18n/locales/abra.pot b/pkg/i18n/locales/abra.pot index a17fb9de..1b2f494b 100644 --- a/pkg/i18n/locales/abra.pot +++ b/pkg/i18n/locales/abra.pot @@ -7,7 +7,7 @@ msgid "" msgstr "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" - "POT-Creation-Date: 2025-08-30 12:27+0200\n" + "POT-Creation-Date: 2025-08-30 12:43+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -366,7 +366,7 @@ msgstr "" msgid "%s recipe directory already exists?" msgstr "" -#: ./pkg/recipe/files.go:36 +#: ./pkg/recipe/files.go:37 #, c-format msgid "%s release notes:" msgstr "" @@ -421,7 +421,7 @@ msgstr "" msgid "%s: %s (retries: %v, healthcheck: %s)" msgstr "" -#: ./pkg/app/app.go:516 +#: ./pkg/app/app.go:521 #, c-format msgid "%s: %s: %s" msgstr "" @@ -1609,7 +1609,7 @@ msgstr "" msgid "add release note? (leave empty to skip)" msgstr "" -#: ./pkg/app/app.go:510 +#: ./pkg/app/app.go:515 #, c-format msgid "adding env vars to %s service config" msgstr "" @@ -2090,7 +2090,7 @@ msgstr "" msgid "coop-cloud.${STACK_NAME}.version=%s" msgstr "" -#: ./pkg/app/app.go:400 +#: ./pkg/app/app.go:405 #, c-format msgid "copied & templated %s to %s" msgstr "" @@ -3800,7 +3800,7 @@ msgstr "" msgid "publish new release?" msgstr "" -#: ./pkg/app/app.go:424 +#: ./pkg/app/app.go:429 msgid "querying remote servers..." msgstr "" @@ -3823,12 +3823,12 @@ msgstr "" msgid "read %s as tags for recipe %s" msgstr "" -#: ./pkg/app/app.go:577 ./pkg/config/env.go:50 ./pkg/envfile/envfile.go:42 ./pkg/envfile/envfile.go:80 +#: ./pkg/app/app.go:582 ./pkg/config/env.go:50 ./pkg/envfile/envfile.go:42 ./pkg/envfile/envfile.go:80 #, c-format msgid "read %s from %s" msgstr "" -#: ./pkg/app/app.go:579 +#: ./pkg/app/app.go:584 #, c-format msgid "read 0 command names from %s" msgstr "" @@ -4116,7 +4116,7 @@ msgstr "" msgid "retrieved %s configs for %s" msgstr "" -#: ./pkg/app/app.go:501 +#: ./pkg/app/app.go:506 #, c-format msgid "retrieved %s for %s" msgstr "" @@ -4131,7 +4131,7 @@ msgstr "" msgid "retrieved %v servers: %s" msgstr "" -#: ./pkg/app/app.go:487 +#: ./pkg/app/app.go:492 #, c-format msgid "retrieved app statuses: %s" msgstr "" @@ -4475,12 +4475,12 @@ msgstr "" msgid "skipping generation of %s (generate=false)" msgstr "" -#: ./pkg/app/app.go:685 +#: ./pkg/app/app.go:690 #, c-format msgid "skipping version %s write as already exists in %s.env" msgstr "" -#: ./pkg/app/app.go:679 +#: ./pkg/app/app.go:684 #, c-format msgid "skipping writing version %s because dry run" msgstr "" @@ -4799,7 +4799,7 @@ msgstr "" msgid "unable to determine versioning semantics of %s, listing all tags" msgstr "" -#: ./pkg/lint/recipe.go:261 ./pkg/recipe/files.go:17 +#: ./pkg/lint/recipe.go:261 ./pkg/recipe/files.go:18 #, c-format msgid "unable to discover .env.sample for %s" msgstr "" @@ -5153,7 +5153,7 @@ msgstr "" msgid "vendor config versions in an abra.sh" msgstr "" -#: ./pkg/app/app.go:683 +#: ./pkg/app/app.go:688 #, c-format msgid "version %s saved to %s.env" msgstr "" @@ -5168,7 +5168,7 @@ msgstr "" msgid "version seems invalid: %s" msgstr "" -#: ./pkg/app/app.go:622 +#: ./pkg/app/app.go:627 #, c-format msgid "version wiped from %s.env" msgstr "" diff --git a/pkg/i18n/locales/es.po b/pkg/i18n/locales/es.po index cfbaf835..11c2327f 100644 --- a/pkg/i18n/locales/es.po +++ b/pkg/i18n/locales/es.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: EMAIL\n" -"POT-Creation-Date: 2025-08-30 12:27+0200\n" +"POT-Creation-Date: 2025-08-30 12:43+0200\n" "PO-Revision-Date: 2025-08-29 21:45+0000\n" "Last-Translator: chasqui \n" "Language-Team: Spanish .example.com in release note" { + run $ABRA app deploy "$TEST_APP_DOMAIN" "0.3.4+1.21.0" --no-input --no-converge-checks + assert_success + assert_output --partial '0.3.4+1.21.0' + + run $ABRA app upgrade "$TEST_APP_DOMAIN" "0.3.5+1.21.0" --no-input --no-converge-checks + assert_success + assert_output --partial '0.3.5+1.21.0' + refute_output --partial 'abra-test-recipe.local' # 0.3.5+1.21.0 +} + # bats test_tags=slow @test "show multiple release notes" { run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks