Compare commits
5 Commits
0.12.0-bet
...
732
| Author | SHA1 | Date | |
|---|---|---|---|
| 42f9e6d458 | |||
| 9e7bc31d4d | |||
| b79c4f33b6 | |||
| cc87d5b3da | |||
| 8b5e3f3c78 |
@ -1,6 +1,7 @@
|
||||
package recipe
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -19,6 +20,9 @@ import (
|
||||
"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
|
||||
// aliases with no spaces in between
|
||||
var recipeSyncAliases = i18n.G("s")
|
||||
@ -121,20 +125,18 @@ likely to change.
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
versions, err := recipePkg.GetRecipeCatalogueVersions(recipe.Name, catl)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
changesTable, err := formatter.CreateTable()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
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"))
|
||||
|
||||
latestRecipeVersion := versions[len(versions)-1]
|
||||
allRecipeVersions := catl[recipe.Name].Versions
|
||||
for _, recipeVersion := range allRecipeVersions {
|
||||
if serviceVersions, ok := recipeVersion[latestRecipeVersion]; ok {
|
||||
@ -298,3 +300,14 @@ func init() {
|
||||
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
|
||||
make a seclection. Use the "?" key to see more help on navigating this
|
||||
interface.
|
||||
|
||||
You may invoke this command in "wizard" mode and be prompted for input.`),
|
||||
interface.`),
|
||||
Args: cobra.RangeArgs(0, 1),
|
||||
ValidArgsFunction: func(
|
||||
cmd *cobra.Command,
|
||||
|
||||
@ -1500,9 +1500,7 @@ msgid "Upgrade a given <recipe> configuration.\n"
|
||||
"\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"
|
||||
"interface.\n"
|
||||
"\n"
|
||||
"You may invoke this command in \"wizard\" mode and be prompted for input."
|
||||
"interface."
|
||||
msgstr ""
|
||||
|
||||
#. translators: Short description for `upgrade` command
|
||||
|
||||
Binary file not shown.
@ -3,7 +3,7 @@ msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\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"
|
||||
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-cloud/abra/es/>\n"
|
||||
"Language: es\n"
|
||||
@ -1272,12 +1272,12 @@ msgstr "▶️ Restaurar una captura o instantánea 📸"
|
||||
#. translators: Short description for `app rollback` command
|
||||
#: cli/app/rollback.go:34
|
||||
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
|
||||
#: cli/app/run.go:30
|
||||
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
|
||||
msgid ""
|
||||
@ -1296,7 +1296,7 @@ msgstr ""
|
||||
#. translators: Short description for `app cmd` command
|
||||
#: cli/app/cmd.go:30
|
||||
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/new.go:389
|
||||
@ -1399,7 +1399,7 @@ msgstr ""
|
||||
#. translators: Short description for `app logs` command
|
||||
#: cli/app/logs.go:27
|
||||
msgid "Tail app logs"
|
||||
msgstr "📋 Seguir logs 📈 de la plataforma 🚀"
|
||||
msgstr "📋 Seguir logs 📈 de la aplicación 🚀"
|
||||
|
||||
#. translators: Short description for `abra` binary
|
||||
#: cli/run.go:80
|
||||
@ -1551,9 +1551,7 @@ msgid ""
|
||||
"\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"
|
||||
"interface.\n"
|
||||
"\n"
|
||||
"You may invoke this command in \"wizard\" mode and be prompted for input."
|
||||
"interface."
|
||||
msgstr ""
|
||||
|
||||
#. translators: Short description for `upgrade` command
|
||||
@ -1575,7 +1573,7 @@ msgstr ""
|
||||
#. translators: Short description for `app upgrade` command
|
||||
#: cli/app/upgrade.go:36
|
||||
msgid "Upgrade an app"
|
||||
msgstr "📨 Actualizar una plataforma 🚀"
|
||||
msgstr "📨 Actualizar una aplicación 🚀"
|
||||
|
||||
#: cli/app/upgrade.go:37
|
||||
msgid ""
|
||||
@ -1863,12 +1861,12 @@ msgstr ""
|
||||
#. translators: `abra app` command for autocompletion
|
||||
#: cli/run.go:91
|
||||
msgid "app"
|
||||
msgstr "plataforma"
|
||||
msgstr "aplicacion"
|
||||
|
||||
#. translators: `app` command group
|
||||
#: cli/app/app.go:16
|
||||
msgid "app [cmd] [args] [flags]"
|
||||
msgstr "plataforma [cmd] [args] [flags]"
|
||||
msgstr "aplicacion [cmd] [args] [flags]"
|
||||
|
||||
#: pkg/dns/dns.go:52
|
||||
#, c-format
|
||||
@ -4621,7 +4619,7 @@ msgstr ""
|
||||
#. translators: `app run` command
|
||||
#: cli/app/run.go:27
|
||||
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
|
||||
msgid "run command as user"
|
||||
@ -5509,7 +5507,7 @@ msgstr ""
|
||||
#. translators: `app undeploy` command
|
||||
#: cli/app/undeploy.go:28
|
||||
msgid "undeploy <domain> [flags]"
|
||||
msgstr "desarmar <domain> [flags]"
|
||||
msgstr "recoger <domain> [flags]"
|
||||
|
||||
#: cli/app/undeploy.go:117
|
||||
msgid "undeploy succeeded 🟢"
|
||||
|
||||
Reference in New Issue
Block a user