feat: template example domain in release notes
See toolshed/organising#521
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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 <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\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 ""
|
||||
|
@ -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 <chasqui@cryptolab.net>\n"
|
||||
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-"
|
||||
@ -380,7 +380,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 ""
|
||||
@ -437,7 +437,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 ""
|
||||
@ -1765,7 +1765,7 @@ msgstr "agregar [[server] | --local] [flags]"
|
||||
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 ""
|
||||
@ -2266,7 +2266,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 ""
|
||||
@ -4029,7 +4029,7 @@ msgstr ""
|
||||
msgid "publish new release?"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/app/app.go:424
|
||||
#: pkg/app/app.go:429
|
||||
msgid "querying remote servers..."
|
||||
msgstr ""
|
||||
|
||||
@ -4054,13 +4054,13 @@ 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/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 ""
|
||||
@ -4350,7 +4350,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 ""
|
||||
@ -4365,7 +4365,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 ""
|
||||
@ -4717,12 +4717,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 ""
|
||||
@ -5045,7 +5045,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 ""
|
||||
@ -5408,7 +5408,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 ""
|
||||
@ -5423,7 +5423,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 ""
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/envfile"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
@ -20,7 +21,7 @@ func (r Recipe) SampleEnv() (map[string]string, error) {
|
||||
}
|
||||
|
||||
// GetReleaseNotes prints release notes for the recipe version
|
||||
func (r Recipe) GetReleaseNotes(version string) (string, error) {
|
||||
func (r Recipe) GetReleaseNotes(version, appDomain string) (string, error) {
|
||||
if version == "" {
|
||||
return "", nil
|
||||
}
|
||||
@ -36,7 +37,14 @@ func (r Recipe) GetReleaseNotes(version string) (string, error) {
|
||||
title := formatter.BoldStyle.Render(i18n.G("%s release notes:", version))
|
||||
withTitle := fmt.Sprintf("%s\n%s\n", title, releaseNotes)
|
||||
|
||||
return withTitle, nil
|
||||
templatedDomain := strings.Replace(
|
||||
withTitle,
|
||||
fmt.Sprintf("%s.example.com", r.Name),
|
||||
appDomain,
|
||||
-1,
|
||||
)
|
||||
|
||||
return templatedDomain, nil
|
||||
}
|
||||
|
||||
return "", nil
|
||||
|
@ -205,6 +205,18 @@ teardown(){
|
||||
refute_output --partial 'release notes baz' # 0.2.0+1.21.0
|
||||
}
|
||||
|
||||
# bats test_tags=slow
|
||||
@test "template <recipe>.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
|
||||
|
Reference in New Issue
Block a user