Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 42f9e6d458 | |||
| 9e7bc31d4d | |||
| b79c4f33b6 | |||
| cc87d5b3da | |||
| 8b5e3f3c78 |
@ -1,6 +1,7 @@
|
|||||||
package recipe
|
package recipe
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -19,6 +20,9 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
var emptyVersionsInCatalogue = errors.New("Catalogue versions list is empty (unexpectedly!)")
|
||||||
|
|
||||||
// translators: `abra recipe reset` aliases. use a comma separated list of
|
// translators: `abra recipe reset` aliases. use a comma separated list of
|
||||||
// aliases with no spaces in between
|
// aliases with no spaces in between
|
||||||
var recipeSyncAliases = i18n.G("s")
|
var recipeSyncAliases = i18n.G("s")
|
||||||
@ -121,20 +125,18 @@ likely to change.
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
versions, err := recipePkg.GetRecipeCatalogueVersions(recipe.Name, catl)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
changesTable, err := formatter.CreateTable()
|
changesTable, err := formatter.CreateTable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
latestRelease := tags[len(tags)-1]
|
latestRelease := tags[len(tags)-1]
|
||||||
|
latestRecipeVersion, err := getLatestVersion(recipe, catl)
|
||||||
|
if err != nil && err != emptyVersionsInCatalogue {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
changesTable.Headers(i18n.G("SERVICE"), latestRelease, i18n.G("PROPOSED CHANGES"))
|
changesTable.Headers(i18n.G("SERVICE"), latestRelease, i18n.G("PROPOSED CHANGES"))
|
||||||
|
|
||||||
latestRecipeVersion := versions[len(versions)-1]
|
|
||||||
allRecipeVersions := catl[recipe.Name].Versions
|
allRecipeVersions := catl[recipe.Name].Versions
|
||||||
for _, recipeVersion := range allRecipeVersions {
|
for _, recipeVersion := range allRecipeVersions {
|
||||||
if serviceVersions, ok := recipeVersion[latestRecipeVersion]; ok {
|
if serviceVersions, ok := recipeVersion[latestRecipeVersion]; ok {
|
||||||
@ -298,3 +300,14 @@ func init() {
|
|||||||
i18n.G("increase the patch part of the version"),
|
i18n.G("increase the patch part of the version"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getLatestVersion(recipe recipePkg.Recipe, catl recipePkg.RecipeCatalogue) (string, error) {
|
||||||
|
versions, err := recipePkg.GetRecipeCatalogueVersions(recipe.Name, catl)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if len(versions) > 0 {
|
||||||
|
return versions[len(versions)-1], nil
|
||||||
|
}
|
||||||
|
return "", emptyVersionsInCatalogue
|
||||||
|
}
|
||||||
|
|||||||
33
cli/recipe/sync_test.go
Normal file
33
cli/recipe/sync_test.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package recipe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetLatestVersionReturnsErrorWhenVersionsIsEmpty(t *testing.T) {
|
||||||
|
recipe := recipePkg.Recipe{}
|
||||||
|
catalogue := recipePkg.RecipeCatalogue{}
|
||||||
|
_, err := getLatestVersion(recipe, catalogue)
|
||||||
|
assert.Equal(t, err, emptyVersionsInCatalogue)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetLatestVersionReturnsLastVersion(t *testing.T) {
|
||||||
|
recipe := recipePkg.Recipe{
|
||||||
|
Name: "test",
|
||||||
|
}
|
||||||
|
versions := []map[string]map[string]recipePkg.ServiceMeta{
|
||||||
|
make(map[string]map[string]recipePkg.ServiceMeta),
|
||||||
|
make(map[string]map[string]recipePkg.ServiceMeta),
|
||||||
|
}
|
||||||
|
versions[0]["0.0.3"] = make(map[string]recipePkg.ServiceMeta)
|
||||||
|
versions[1]["0.0.2"] = make(map[string]recipePkg.ServiceMeta)
|
||||||
|
catalogue := make(recipePkg.RecipeCatalogue)
|
||||||
|
catalogue["test"] = recipePkg.RecipeMeta{
|
||||||
|
Versions: versions,
|
||||||
|
}
|
||||||
|
version, _ := getLatestVersion(recipe, catalogue)
|
||||||
|
assert.Equal(t, version, "0.0.3")
|
||||||
|
}
|
||||||
@ -57,9 +57,7 @@ is up to the end-user to decide.
|
|||||||
|
|
||||||
The command is interactive and will show a select input which allows you to
|
The command is interactive and will show a select input which allows you to
|
||||||
make a seclection. Use the "?" key to see more help on navigating this
|
make a seclection. Use the "?" key to see more help on navigating this
|
||||||
interface.
|
interface.`),
|
||||||
|
|
||||||
You may invoke this command in "wizard" mode and be prompted for input.`),
|
|
||||||
Args: cobra.RangeArgs(0, 1),
|
Args: cobra.RangeArgs(0, 1),
|
||||||
ValidArgsFunction: func(
|
ValidArgsFunction: func(
|
||||||
cmd *cobra.Command,
|
cmd *cobra.Command,
|
||||||
|
|||||||
@ -1500,9 +1500,7 @@ msgid "Upgrade a given <recipe> configuration.\n"
|
|||||||
"\n"
|
"\n"
|
||||||
"The command is interactive and will show a select input which allows you to\n"
|
"The command is interactive and will show a select input which allows you to\n"
|
||||||
"make a seclection. Use the \"?\" key to see more help on navigating this\n"
|
"make a seclection. Use the \"?\" key to see more help on navigating this\n"
|
||||||
"interface.\n"
|
"interface."
|
||||||
"\n"
|
|
||||||
"You may invoke this command in \"wizard\" mode and be prompted for input."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. translators: Short description for `upgrade` command
|
#. translators: Short description for `upgrade` command
|
||||||
|
|||||||
Binary file not shown.
@ -3,7 +3,7 @@ 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-11-04 15:34+0100\n"
|
"POT-Creation-Date: 2025-11-04 15:34+0100\n"
|
||||||
"PO-Revision-Date: 2025-09-04 08:14+0000\n"
|
"PO-Revision-Date: 2025-12-10 01:43+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-cloud/abra/es/>\n"
|
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-cloud/abra/es/>\n"
|
||||||
"Language: es\n"
|
"Language: es\n"
|
||||||
@ -1272,12 +1272,12 @@ msgstr "▶️ Restaurar una captura o instantánea 📸"
|
|||||||
#. translators: Short description for `app rollback` command
|
#. translators: Short description for `app rollback` command
|
||||||
#: cli/app/rollback.go:34
|
#: cli/app/rollback.go:34
|
||||||
msgid "Roll an app back to a previous version"
|
msgid "Roll an app back to a previous version"
|
||||||
msgstr "⏪ Revertir una plataforma 🚀 una versión anterior"
|
msgstr "⏪ Revertir una aplicación 🚀 una versión anterior"
|
||||||
|
|
||||||
#. translators: Short description for `app run` command
|
#. translators: Short description for `app run` command
|
||||||
#: cli/app/run.go:30
|
#: cli/app/run.go:30
|
||||||
msgid "Run a command inside a service container"
|
msgid "Run a command inside a service container"
|
||||||
msgstr "💻 Ejecuta un comando dentro de un contenedor 🐋 creado solo para esa tarea"
|
msgstr "💻 Crea una instancia temporal de un contenedor 🐋 para ejecutar el comando especificado"
|
||||||
|
|
||||||
#: cli/app/cmd.go:31
|
#: cli/app/cmd.go:31
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -1296,7 +1296,7 @@ msgstr ""
|
|||||||
#. translators: Short description for `app cmd` command
|
#. translators: Short description for `app cmd` command
|
||||||
#: cli/app/cmd.go:30
|
#: cli/app/cmd.go:30
|
||||||
msgid "Run app commands"
|
msgid "Run app commands"
|
||||||
msgstr "💻 Ejecutar comandos en una plataforma 🚀"
|
msgstr "💻 Ejecutar comandos en una aplicación 🚀"
|
||||||
|
|
||||||
#: cli/app/backup.go:303 cli/app/list.go:292 cli/app/logs.go:109
|
#: cli/app/backup.go:303 cli/app/list.go:292 cli/app/logs.go:109
|
||||||
#: cli/app/new.go:389
|
#: cli/app/new.go:389
|
||||||
@ -1399,7 +1399,7 @@ msgstr ""
|
|||||||
#. translators: Short description for `app logs` command
|
#. translators: Short description for `app logs` command
|
||||||
#: cli/app/logs.go:27
|
#: cli/app/logs.go:27
|
||||||
msgid "Tail app logs"
|
msgid "Tail app logs"
|
||||||
msgstr "📋 Seguir logs 📈 de la plataforma 🚀"
|
msgstr "📋 Seguir logs 📈 de la aplicación 🚀"
|
||||||
|
|
||||||
#. translators: Short description for `abra` binary
|
#. translators: Short description for `abra` binary
|
||||||
#: cli/run.go:80
|
#: cli/run.go:80
|
||||||
@ -1551,9 +1551,7 @@ msgid ""
|
|||||||
"\n"
|
"\n"
|
||||||
"The command is interactive and will show a select input which allows you to\n"
|
"The command is interactive and will show a select input which allows you to\n"
|
||||||
"make a seclection. Use the \"?\" key to see more help on navigating this\n"
|
"make a seclection. Use the \"?\" key to see more help on navigating this\n"
|
||||||
"interface.\n"
|
"interface."
|
||||||
"\n"
|
|
||||||
"You may invoke this command in \"wizard\" mode and be prompted for input."
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. translators: Short description for `upgrade` command
|
#. translators: Short description for `upgrade` command
|
||||||
@ -1575,7 +1573,7 @@ msgstr ""
|
|||||||
#. translators: Short description for `app upgrade` command
|
#. translators: Short description for `app upgrade` command
|
||||||
#: cli/app/upgrade.go:36
|
#: cli/app/upgrade.go:36
|
||||||
msgid "Upgrade an app"
|
msgid "Upgrade an app"
|
||||||
msgstr "📨 Actualizar una plataforma 🚀"
|
msgstr "📨 Actualizar una aplicación 🚀"
|
||||||
|
|
||||||
#: cli/app/upgrade.go:37
|
#: cli/app/upgrade.go:37
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -1863,12 +1861,12 @@ msgstr ""
|
|||||||
#. translators: `abra app` command for autocompletion
|
#. translators: `abra app` command for autocompletion
|
||||||
#: cli/run.go:91
|
#: cli/run.go:91
|
||||||
msgid "app"
|
msgid "app"
|
||||||
msgstr "plataforma"
|
msgstr "aplicacion"
|
||||||
|
|
||||||
#. translators: `app` command group
|
#. translators: `app` command group
|
||||||
#: cli/app/app.go:16
|
#: cli/app/app.go:16
|
||||||
msgid "app [cmd] [args] [flags]"
|
msgid "app [cmd] [args] [flags]"
|
||||||
msgstr "plataforma [cmd] [args] [flags]"
|
msgstr "aplicacion [cmd] [args] [flags]"
|
||||||
|
|
||||||
#: pkg/dns/dns.go:52
|
#: pkg/dns/dns.go:52
|
||||||
#, c-format
|
#, c-format
|
||||||
@ -4621,7 +4619,7 @@ msgstr ""
|
|||||||
#. translators: `app run` command
|
#. translators: `app run` command
|
||||||
#: cli/app/run.go:27
|
#: cli/app/run.go:27
|
||||||
msgid "run <domain> <service> <cmd> [[args] [flags] | [flags] -- [args]]"
|
msgid "run <domain> <service> <cmd> [[args] [flags] | [flags] -- [args]]"
|
||||||
msgstr "lanzar <domain> <service> <cmd> [[args] [flags] | [flags] -- [args]]"
|
msgstr "correr <domain> <service> <cmd> [[args] [flags] | [flags] -- [args]]"
|
||||||
|
|
||||||
#: cli/app/run.go:120
|
#: cli/app/run.go:120
|
||||||
msgid "run command as user"
|
msgid "run command as user"
|
||||||
@ -5509,7 +5507,7 @@ msgstr ""
|
|||||||
#. translators: `app undeploy` command
|
#. translators: `app undeploy` command
|
||||||
#: cli/app/undeploy.go:28
|
#: cli/app/undeploy.go:28
|
||||||
msgid "undeploy <domain> [flags]"
|
msgid "undeploy <domain> [flags]"
|
||||||
msgstr "desarmar <domain> [flags]"
|
msgstr "recoger <domain> [flags]"
|
||||||
|
|
||||||
#: cli/app/undeploy.go:117
|
#: cli/app/undeploy.go:117
|
||||||
msgid "undeploy succeeded 🟢"
|
msgid "undeploy succeeded 🟢"
|
||||||
|
|||||||
Reference in New Issue
Block a user