forked from toolshed/abra
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) &&
|
if parsedVersion.IsGreaterThan(parsedDeployedVersion) &&
|
||||||
parsedVersion.IsLessThan(parsedChosenUpgrade) {
|
parsedVersion.IsLessThan(parsedChosenUpgrade) {
|
||||||
note, err := app.Recipe.GetReleaseNotes(version)
|
note, err := app.Recipe.GetReleaseNotes(version, app.Domain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,12 @@ func TemplateAppEnvSample(r recipe.Recipe, appName, server, domain string) error
|
|||||||
return err
|
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)
|
err = os.WriteFile(appEnvPath, []byte(newContents), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Project-Id-Version: \n"
|
msgstr "Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL\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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -366,7 +366,7 @@ msgstr ""
|
|||||||
msgid "%s recipe directory already exists?"
|
msgid "%s recipe directory already exists?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/recipe/files.go:36
|
#: ./pkg/recipe/files.go:37
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s release notes:"
|
msgid "%s release notes:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -421,7 +421,7 @@ msgstr ""
|
|||||||
msgid "%s: %s (retries: %v, healthcheck: %s)"
|
msgid "%s: %s (retries: %v, healthcheck: %s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:516
|
#: ./pkg/app/app.go:521
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s: %s: %s"
|
msgid "%s: %s: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -1609,7 +1609,7 @@ msgstr ""
|
|||||||
msgid "add release note? (leave empty to skip)"
|
msgid "add release note? (leave empty to skip)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:510
|
#: ./pkg/app/app.go:515
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "adding env vars to %s service config"
|
msgid "adding env vars to %s service config"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -2090,7 +2090,7 @@ msgstr ""
|
|||||||
msgid "coop-cloud.${STACK_NAME}.version=%s"
|
msgid "coop-cloud.${STACK_NAME}.version=%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:400
|
#: ./pkg/app/app.go:405
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "copied & templated %s to %s"
|
msgid "copied & templated %s to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -3800,7 +3800,7 @@ msgstr ""
|
|||||||
msgid "publish new release?"
|
msgid "publish new release?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:424
|
#: ./pkg/app/app.go:429
|
||||||
msgid "querying remote servers..."
|
msgid "querying remote servers..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -3823,12 +3823,12 @@ msgstr ""
|
|||||||
msgid "read %s as tags for recipe %s"
|
msgid "read %s as tags for recipe %s"
|
||||||
msgstr ""
|
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
|
#, c-format
|
||||||
msgid "read %s from %s"
|
msgid "read %s from %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:579
|
#: ./pkg/app/app.go:584
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "read 0 command names from %s"
|
msgid "read 0 command names from %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4116,7 +4116,7 @@ msgstr ""
|
|||||||
msgid "retrieved %s configs for %s"
|
msgid "retrieved %s configs for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:501
|
#: ./pkg/app/app.go:506
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "retrieved %s for %s"
|
msgid "retrieved %s for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4131,7 +4131,7 @@ msgstr ""
|
|||||||
msgid "retrieved %v servers: %s"
|
msgid "retrieved %v servers: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:487
|
#: ./pkg/app/app.go:492
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "retrieved app statuses: %s"
|
msgid "retrieved app statuses: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4475,12 +4475,12 @@ msgstr ""
|
|||||||
msgid "skipping generation of %s (generate=false)"
|
msgid "skipping generation of %s (generate=false)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:685
|
#: ./pkg/app/app.go:690
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "skipping version %s write as already exists in %s.env"
|
msgid "skipping version %s write as already exists in %s.env"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:679
|
#: ./pkg/app/app.go:684
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "skipping writing version %s because dry run"
|
msgid "skipping writing version %s because dry run"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4799,7 +4799,7 @@ msgstr ""
|
|||||||
msgid "unable to determine versioning semantics of %s, listing all tags"
|
msgid "unable to determine versioning semantics of %s, listing all tags"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/lint/recipe.go:261 ./pkg/recipe/files.go:17
|
#: ./pkg/lint/recipe.go:261 ./pkg/recipe/files.go:18
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "unable to discover .env.sample for %s"
|
msgid "unable to discover .env.sample for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -5153,7 +5153,7 @@ msgstr ""
|
|||||||
msgid "vendor config versions in an abra.sh"
|
msgid "vendor config versions in an abra.sh"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:683
|
#: ./pkg/app/app.go:688
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "version %s saved to %s.env"
|
msgid "version %s saved to %s.env"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -5168,7 +5168,7 @@ msgstr ""
|
|||||||
msgid "version seems invalid: %s"
|
msgid "version seems invalid: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ./pkg/app/app.go:622
|
#: ./pkg/app/app.go:627
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "version wiped from %s.env"
|
msgid "version wiped from %s.env"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -2,7 +2,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL\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"
|
"PO-Revision-Date: 2025-08-29 21:45+0000\n"
|
||||||
"Last-Translator: chasqui <chasqui@cryptolab.net>\n"
|
"Last-Translator: chasqui <chasqui@cryptolab.net>\n"
|
||||||
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-"
|
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-"
|
||||||
@ -380,7 +380,7 @@ msgstr ""
|
|||||||
msgid "%s recipe directory already exists?"
|
msgid "%s recipe directory already exists?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/recipe/files.go:36
|
#: pkg/recipe/files.go:37
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s release notes:"
|
msgid "%s release notes:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -437,7 +437,7 @@ msgstr ""
|
|||||||
msgid "%s: %s (retries: %v, healthcheck: %s)"
|
msgid "%s: %s (retries: %v, healthcheck: %s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:516
|
#: pkg/app/app.go:521
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "%s: %s: %s"
|
msgid "%s: %s: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -1765,7 +1765,7 @@ msgstr "agregar [[server] | --local] [flags]"
|
|||||||
msgid "add release note? (leave empty to skip)"
|
msgid "add release note? (leave empty to skip)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:510
|
#: pkg/app/app.go:515
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "adding env vars to %s service config"
|
msgid "adding env vars to %s service config"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -2266,7 +2266,7 @@ msgstr ""
|
|||||||
msgid "coop-cloud.${STACK_NAME}.version=%s"
|
msgid "coop-cloud.${STACK_NAME}.version=%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:400
|
#: pkg/app/app.go:405
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "copied & templated %s to %s"
|
msgid "copied & templated %s to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4029,7 +4029,7 @@ msgstr ""
|
|||||||
msgid "publish new release?"
|
msgid "publish new release?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:424
|
#: pkg/app/app.go:429
|
||||||
msgid "querying remote servers..."
|
msgid "querying remote servers..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -4054,13 +4054,13 @@ msgstr ""
|
|||||||
msgid "read %s as tags for recipe %s"
|
msgid "read %s as tags for recipe %s"
|
||||||
msgstr ""
|
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
|
#: pkg/envfile/envfile.go:80
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "read %s from %s"
|
msgid "read %s from %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:579
|
#: pkg/app/app.go:584
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "read 0 command names from %s"
|
msgid "read 0 command names from %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4350,7 +4350,7 @@ msgstr ""
|
|||||||
msgid "retrieved %s configs for %s"
|
msgid "retrieved %s configs for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:501
|
#: pkg/app/app.go:506
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "retrieved %s for %s"
|
msgid "retrieved %s for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4365,7 +4365,7 @@ msgstr ""
|
|||||||
msgid "retrieved %v servers: %s"
|
msgid "retrieved %v servers: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:487
|
#: pkg/app/app.go:492
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "retrieved app statuses: %s"
|
msgid "retrieved app statuses: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -4717,12 +4717,12 @@ msgstr ""
|
|||||||
msgid "skipping generation of %s (generate=false)"
|
msgid "skipping generation of %s (generate=false)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:685
|
#: pkg/app/app.go:690
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "skipping version %s write as already exists in %s.env"
|
msgid "skipping version %s write as already exists in %s.env"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:679
|
#: pkg/app/app.go:684
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "skipping writing version %s because dry run"
|
msgid "skipping writing version %s because dry run"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -5045,7 +5045,7 @@ msgstr ""
|
|||||||
msgid "unable to determine versioning semantics of %s, listing all tags"
|
msgid "unable to determine versioning semantics of %s, listing all tags"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/lint/recipe.go:261 pkg/recipe/files.go:17
|
#: pkg/lint/recipe.go:261 pkg/recipe/files.go:18
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "unable to discover .env.sample for %s"
|
msgid "unable to discover .env.sample for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -5408,7 +5408,7 @@ msgstr ""
|
|||||||
msgid "vendor config versions in an abra.sh"
|
msgid "vendor config versions in an abra.sh"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:683
|
#: pkg/app/app.go:688
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "version %s saved to %s.env"
|
msgid "version %s saved to %s.env"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -5423,7 +5423,7 @@ msgstr ""
|
|||||||
msgid "version seems invalid: %s"
|
msgid "version seems invalid: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: pkg/app/app.go:622
|
#: pkg/app/app.go:627
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "version wiped from %s.env"
|
msgid "version wiped from %s.env"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"coopcloud.tech/abra/pkg/envfile"
|
"coopcloud.tech/abra/pkg/envfile"
|
||||||
"coopcloud.tech/abra/pkg/formatter"
|
"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
|
// 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 == "" {
|
if version == "" {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
@ -36,7 +37,14 @@ func (r Recipe) GetReleaseNotes(version string) (string, error) {
|
|||||||
title := formatter.BoldStyle.Render(i18n.G("%s release notes:", version))
|
title := formatter.BoldStyle.Render(i18n.G("%s release notes:", version))
|
||||||
withTitle := fmt.Sprintf("%s\n%s\n", title, releaseNotes)
|
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
|
return "", nil
|
||||||
|
@ -205,6 +205,18 @@ teardown(){
|
|||||||
refute_output --partial 'release notes baz' # 0.2.0+1.21.0
|
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
|
# bats test_tags=slow
|
||||||
@test "show multiple release notes" {
|
@test "show multiple release notes" {
|
||||||
run $ABRA app deploy "$TEST_APP_DOMAIN" "0.1.0+1.20.0" --no-input --no-converge-checks
|
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