diff --git a/cli/app/list.go b/cli/app/list.go index aeba022d0..26b58711e 100644 --- a/cli/app/list.go +++ b/cli/app/list.go @@ -3,22 +3,17 @@ package app import ( "encoding/json" "fmt" - "slices" "sort" + "strconv" "strings" "coopcloud.tech/abra/cli/internal" appPkg "coopcloud.tech/abra/pkg/app" "coopcloud.tech/abra/pkg/autocomplete" + "coopcloud.tech/abra/pkg/formatter" "coopcloud.tech/abra/pkg/i18n" "coopcloud.tech/abra/pkg/log" - "coopcloud.tech/abra/pkg/recipe" "coopcloud.tech/tagcmp" - "github.com/charmbracelet/bubbles/key" - "github.com/charmbracelet/bubbles/spinner" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" - "github.com/evertras/bubble-table/table" "github.com/spf13/cobra" ) @@ -80,7 +75,7 @@ Use "--status/-S" flag to query all servers for the live deployment status.`), sort.Sort(appPkg.ByServerAndRecipe(apps)) statuses := make(map[string]map[string]string) - if status && internal.MachineReadable { + if status { alreadySeen := make(map[string]bool) for _, app := range apps { if _, ok := alreadySeen[app.Server]; !ok { @@ -118,7 +113,7 @@ Use "--status/-S" flag to query all servers for the live deployment status.`), stats.AppCount++ totalAppsCount++ - if status && internal.MachineReadable { + if status { status := i18n.G("unknown") version := i18n.G("unknown") chaos := i18n.G("unknown") @@ -221,8 +216,73 @@ Use "--status/-S" flag to query all servers for the live deployment status.`), return } - if err := runTable(apps); err != nil { - log.Fatal(err) + alreadySeen := make(map[string]bool) + for _, app := range apps { + if _, ok := alreadySeen[app.Server]; ok { + continue + } + + serverStat := allStats[app.Server] + + headers := []string{i18n.G("RECIPE"), i18n.G("DOMAIN"), i18n.G("SERVER")} + if status { + headers = append(headers, []string{ + i18n.G("STATUS"), + i18n.G("CHAOS"), + i18n.G("VERSION"), + i18n.G("UPGRADE"), + i18n.G("AUTOUPDATE"), + }..., + ) + } + + table, err := formatter.CreateTable() + if err != nil { + log.Fatal(err) + } + + table.Headers(headers...) + + var rows [][]string + for _, appStat := range serverStat.Apps { + row := []string{appStat.Recipe, appStat.Domain, appStat.Server} + if status { + chaosStatus := appStat.Chaos + if chaosStatus != "unknown" { + chaosEnabled, err := strconv.ParseBool(chaosStatus) + if err != nil { + log.Fatal(err) + } + if chaosEnabled && appStat.ChaosVersion != "unknown" { + chaosStatus = appStat.ChaosVersion + } + } + + row = append(row, []string{ + appStat.Status, + chaosStatus, + appStat.Version, + appStat.Upgrade, + appStat.AutoUpdate}..., + ) + } + + rows = append(rows, row) + } + + table.Rows(rows...) + + if len(rows) > 0 { + if err := formatter.PrintTable(table); err != nil { + log.Fatal(err) + } + + if len(allStats) > 1 && len(rows) > 0 { + fmt.Println() // newline separator for multiple servers + } + } + + alreadySeen[app.Server] = true } }, } @@ -280,321 +340,3 @@ func init() { }, ) } - -func getNumServersAndRecipes(apps []appPkg.App) (int, int) { - var ( - servers []string - recipes []string - ) - - for _, app := range apps { - if !slices.Contains(servers, app.Server) { - servers = append(servers, app.Server) - } - if !slices.Contains(recipes, app.Recipe.Name) { - recipes = append(recipes, app.Recipe.Name) - } - } - - return len(servers), len(recipes) -} - -type errorMsg struct{ err error } - -func (e errorMsg) Error() string { return e.err.Error() } - -type appsDeployStatusMsg map[string]map[string]string - -func getAppsDeployStatus(m model) tea.Msg { - var apps []appPkg.App - - for _, row := range m.table.GetVisibleRows() { - apps = append(apps, row.Data["app"].(appPkg.App)) - } - - statuses, err := appPkg.GetAppStatuses(apps, true) - if err != nil { - return errorMsg{err} - } - - catl, err := recipe.ReadRecipeCatalogue(true) - if err != nil { - return errorMsg{err} - } - - for _, app := range apps { - var newUpdates []string - if status, ok := statuses[app.StackName()]; ok { - if version, ok := status["version"]; ok { - updates, err := recipe.GetRecipeCatalogueVersions(app.Recipe.Name, catl) - if err != nil { - return errorMsg{err} - } - - parsedVersion, err := tagcmp.Parse(version) - if err != nil { - continue - } - - for _, update := range updates { - parsedUpdate, err := tagcmp.Parse(update) - if err != nil { - continue - } - - if update != version && parsedUpdate.IsGreaterThan(parsedVersion) { - newUpdates = append(newUpdates, update) - } - } - - if len(newUpdates) != 0 { - statuses[app.StackName()]["updates"] = strings.Join(newUpdates, "\n") - } - } - } - } - - return appsDeployStatusMsg(statuses) -} - -func renderAppsDeployStatus(m *model, appStatuses appsDeployStatusMsg) table.Model { - for _, row := range m.table.GetVisibleRows() { - app := row.Data["app"].(appPkg.App) - appStatus := appStatuses[app.StackName()] - var ( - version = appStatus["version"] - updates = appStatus["updates"] - status = appStatus["status"] - chaos = appStatus["chaos"] - chaosVersion = appStatus["chaosVersion"] - autoUpdate = appStatus["autoUpdate"] - ) - - if status != "" { - row.Data["status"] = status - } - - if version != "" { - row.Data["version"] = version - row.Data["updates"] = updates - } - - if chaos != "" { - if chaosVersion != "" { - row.Data["chaos-version"] = chaosVersion - } - } - - if autoUpdate != "" { - row.Data["autoUpdate"] = autoUpdate - } - } - return m.table -} - -type initTableMsg struct{ table table.Model } - -func initTable(m model) tea.Msg { - var rows []table.Row - - for _, app := range m.apps { - rows = append(rows, table.NewRow(table.RowData{ - "domain": app.Domain, - "server": app.Server, - "recipe": app.Recipe.Name, - "app": app, - })) - } - - colStyle := lipgloss.NewStyle().Align(lipgloss.Left) - columns := []table.Column{ - table.NewFlexColumn("domain", "DOMAIN", 2).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("server", "SERVER", 1).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("recipe", "RECIPE", 1).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("status", "STATUS", 1).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("version", "VERSION", 1).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("updates", "UPDATES", 1).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("chaos-version", "CHAOS", 1).WithFiltered(true).WithStyle(colStyle), - table.NewFlexColumn("auto-update", "AUTO-UPDATE", 1).WithFiltered(true).WithStyle(colStyle), - } - - keymap := table.DefaultKeyMap() - keymap.Filter = key.NewBinding(key.WithKeys("/", "f")) - keymap.PageDown = key.NewBinding(key.WithKeys("right", "l", "pgdown", "ctrl+d")) - keymap.PageUp = key.NewBinding(key.WithKeys("left", "h", "pgup", "ctrl+u")) - - t := table. - New(columns). - Filtered(true). - Focused(true). - WithRows([]table.Row(rows)). - WithKeyMap(keymap). - WithMultiline(true). - WithFuzzyFilter(). - SortByAsc("domain"). - WithNoPagination(). - WithMissingDataIndicatorStyled(table.StyledCell{ - Style: lipgloss.NewStyle().Foreground(lipgloss.Color("#faa")), - Data: "-", - }) - - return initTableMsg{table: t} -} - -type model struct { - apps []appPkg.App - - numApps int - numServers int - numRecipes int - - numFilteredApps int - numFilteredServers int - numFilteredRecipes int - - initStatusGather bool - - table table.Model - spinner spinner.Model - pollingStatus bool - - width int - height int - - err error -} - -func (m model) getFilteredApps() []appPkg.App { - var servers []appPkg.App - for _, row := range m.table.GetVisibleRows() { - servers = append(servers, row.Data["app"].(appPkg.App)) - } - return servers -} - -func (m *model) updateCount() { - if m.table.GetIsFilterActive() { - apps := m.getFilteredApps() - m.numFilteredApps = len(apps) - m.numFilteredServers, m.numFilteredRecipes = getNumServersAndRecipes(apps) - } else { - m.numFilteredApps = m.numApps - m.numFilteredServers = m.numServers - m.numFilteredRecipes = m.numRecipes - } -} - -func (m model) Init() tea.Cmd { - return tea.Batch( - func() tea.Msg { return initTable(m) }, - m.spinner.Tick, - ) -} - -func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - var cmd tea.Cmd - var cmds []tea.Cmd - - switch msg := msg.(type) { - case tea.KeyMsg: - m.updateCount() - - switch msg.String() { - case "q": - return m, tea.Quit - case "s": - if !m.table.GetIsFilterInputFocused() { - m.pollingStatus = true - return m, func() tea.Msg { return getAppsDeployStatus(m) } - } - } - case initTableMsg: - m.table = msg.table - - m.table = m.table.WithTargetWidth(m.width) - m.table = m.table.WithPageSize(calculateHeight(m)) - - if m.initStatusGather { - m.pollingStatus = true - return m, func() tea.Msg { return getAppsDeployStatus(m) } - } - case appsDeployStatusMsg: - m.pollingStatus = false - m.table = renderAppsDeployStatus(&m, msg) - case tea.WindowSizeMsg: - m.width = msg.Width - m.height = msg.Height - - m.table = m.table.WithTargetWidth(m.width) - m.table = m.table.WithPageSize(calculateHeight(m)) - case errorMsg: - m.err = msg - } - - m.table, cmd = m.table.Update(msg) - cmds = append(cmds, cmd) - - m.spinner, cmd = m.spinner.Update(msg) - cmds = append(cmds, cmd) - - return m, tea.Batch(cmds...) -} - -func calculateHeight(m model) int { - return m.height/2 - 5 -} - -func (m model) View() string { - if m.err != nil { - return fmt.Sprintf("FATA: %v", m.err) - } - - body := strings.Builder{} - - body.WriteString(m.table.View() + "\n") - - stats := fmt.Sprintf( - "[servers] %v • [apps] %v • [recipes] %v", - m.numFilteredServers, m.numFilteredApps, m.numFilteredRecipes, - ) - - help := "[q] quit • [/] filter • [s] status • [ctrl+u/d] page up/down" - - body.WriteString(lipgloss.JoinHorizontal(lipgloss.Center, stats, " | ", help)) - - if m.pollingStatus { - body.WriteString(fmt.Sprintf(" | %s querying app status", m.spinner.View())) - } else { - body.WriteString(" | -") - } - - return body.String() -} - -func runTable(apps []appPkg.App) error { - s := spinner.New() - s.Spinner = spinner.Dot - s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205")) - - numServers, numRecipes := getNumServersAndRecipes(apps) - numApps := len(apps) - - m := model{ - apps: apps, - numApps: numApps, - numServers: numServers, - numRecipes: numRecipes, - numFilteredApps: numApps, - numFilteredServers: numServers, - numFilteredRecipes: numRecipes, - spinner: s, - initStatusGather: status, - } - - p := tea.NewProgram(m, tea.WithAltScreen()) - if _, err := p.Run(); err != nil { - return fmt.Errorf("oops, app list tui exploded: %s", err) - } - - return nil -} diff --git a/pkg/app/app.go b/pkg/app/app.go index a73a853db..a2ffe46a3 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -644,9 +644,6 @@ func (a App) WriteRecipeVersion(version string, dryRun bool) error { scanner = bufio.NewScanner(file) ) - // NOTE(d1): don't care at this point if there is a git failure - isDirty, _ := a.Recipe.IsDirty() - for scanner.Scan() { line := scanner.Text() if !strings.HasPrefix(line, "RECIPE=") && !strings.HasPrefix(line, "TYPE=") { @@ -659,7 +656,7 @@ func (a App) WriteRecipeVersion(version string, dryRun bool) error { continue } - if strings.Contains(line, version) && !isDirty && !strings.HasSuffix(line, config.DIRTY_DEFAULT) { + if strings.Contains(line, version) && !a.Recipe.Dirty && !strings.HasSuffix(line, config.DIRTY_DEFAULT) { skipped = true lines = append(lines, line) continue @@ -672,16 +669,16 @@ func (a App) WriteRecipeVersion(version string, dryRun bool) error { } if err := scanner.Err(); err != nil { - return err + log.Fatal(err) } - if isDirty && dirtyVersion != "" { + if a.Recipe.Dirty && dirtyVersion != "" { version = dirtyVersion } if !dryRun { if err := os.WriteFile(a.Path, []byte(strings.Join(lines, "\n")), os.ModePerm); err != nil { - return err + log.Fatal(err) } } else { log.Debug(i18n.G("skipping writing version %s because dry run", version)) diff --git a/pkg/i18n/locales/abra.pot b/pkg/i18n/locales/abra.pot index d670a6d7f..a7933ab8a 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-10-03 20:35+0200\n" + "POT-Creation-Date: 2025-10-01 21:13+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -65,7 +65,7 @@ msgid " # insert regular secret\n" " echo \"mmySuperSecret\" | abra app secret insert 1312.net my_secret v1" msgstr "" -#: ./cli/app/list.go:60 +#: ./cli/app/list.go:55 msgid " # list apps of all servers without live status\n" " abra app ls\n" "\n" @@ -411,7 +411,7 @@ msgstr "" msgid "%s sanitised as %s for new app" msgstr "" -#: ./pkg/recipe/git.go:435 +#: ./pkg/recipe/git.go:434 #, c-format msgid "%s service is missing image tag?" msgstr "" @@ -481,12 +481,12 @@ msgstr "" msgid "%s: ? (missing version)" msgstr "" -#: ./pkg/recipe/recipe.go:228 +#: ./pkg/recipe/recipe.go:237 #, c-format msgid "%s: attempt recipe metadata parse" msgstr "" -#: ./pkg/recipe/recipe.go:359 +#: ./pkg/recipe/recipe.go:368 #, c-format msgid "%s: end marker %s not found" msgstr "" @@ -501,17 +501,17 @@ msgstr "" msgid "%s: ignoring unsupported options: %s" msgstr "" -#: ./pkg/recipe/recipe.go:316 +#: ./pkg/recipe/recipe.go:325 #, c-format msgid "%s: image meta has incorrect format: %s" msgstr "" -#: ./pkg/recipe/recipe.go:321 +#: ./pkg/recipe/recipe.go:330 #, c-format msgid "%s: image meta is empty?" msgstr "" -#: ./pkg/recipe/recipe.go:352 +#: ./pkg/recipe/recipe.go:361 #, c-format msgid "%s: marker string %s not found" msgstr "" @@ -580,6 +580,10 @@ msgstr "" msgid "ALERTA ALERTA: deleting %s data and config (local/remote)" msgstr "" +#: ./cli/app/list.go:234 +msgid "AUTOUPDATE" +msgstr "" + #. translators: Short description for `server add` command #: ./cli/server/add.go:30 msgid "Add a new server" @@ -612,7 +616,7 @@ msgstr "" msgid "C" msgstr "" -#: ./cli/app/ps.go:189 +#: ./cli/app/list.go:231 ./cli/app/ps.go:189 msgid "CHAOS" msgstr "" @@ -766,7 +770,7 @@ msgstr "" msgid "DEPLOYED LABELS" msgstr "" -#: ./cli/internal/deploy.go:78 ./cli/internal/deploy.go:208 +#: ./cli/app/list.go:227 ./cli/internal/deploy.go:78 ./cli/internal/deploy.go:208 msgid "DOMAIN" msgstr "" @@ -859,7 +863,7 @@ msgid "Generate a new copy of the recipe catalogue.\n" " ssh-add ~/.ssh/" msgstr "" -#: ./cli/app/list.go:57 +#: ./cli/app/list.go:52 msgid "Generate a report of all managed apps.\n" "\n" "Use \"--status/-S\" flag to query all servers for the live deployment status." @@ -955,7 +959,7 @@ msgid "List all available commands" msgstr "" #. translators: Short description for `app list` command -#: ./cli/app/list.go:56 +#: ./cli/app/list.go:51 msgid "List all managed apps" msgstr "" @@ -1121,7 +1125,7 @@ msgstr "" msgid "README.md metadata filled in" msgstr "" -#: ./cli/internal/deploy.go:79 ./cli/internal/deploy.go:209 +#: ./cli/app/list.go:227 ./cli/internal/deploy.go:79 ./cli/internal/deploy.go:209 msgid "RECIPE" msgstr "" @@ -1237,7 +1241,7 @@ msgstr "" msgid "Run app commands" msgstr "" -#: ./cli/app/backup.go:303 ./cli/app/list.go:240 ./cli/app/logs.go:109 ./cli/app/new.go:389 +#: ./cli/app/backup.go:303 ./cli/app/list.go:300 ./cli/app/logs.go:109 ./cli/app/new.go:389 msgid "S" msgstr "" @@ -1249,7 +1253,7 @@ msgstr "" msgid "SECRETS OVERVIEW" msgstr "" -#: ./cli/internal/deploy.go:80 +#: ./cli/app/list.go:227 ./cli/internal/deploy.go:80 msgid "SERVER" msgstr "" @@ -1274,7 +1278,7 @@ msgstr "" msgid "SSO" msgstr "" -#: ./cli/app/ps.go:186 +#: ./cli/app/list.go:230 ./cli/app/ps.go:186 msgid "STATUS" msgstr "" @@ -1469,7 +1473,7 @@ msgstr "" msgid "UNDEPLOY" msgstr "" -#: ./cli/internal/deploy.go:174 +#: ./cli/app/list.go:233 ./cli/internal/deploy.go:174 msgid "UPGRADE" msgstr "" @@ -1587,7 +1591,7 @@ msgstr "" msgid "VALUE" msgstr "" -#: ./cli/app/ps.go:188 ./cli/app/secret.go:481 ./cli/recipe/version.go:69 ./cli/recipe/version.go:110 +#: ./cli/app/list.go:232 ./cli/app/ps.go:188 ./cli/app/secret.go:481 ./cli/recipe/version.go:69 ./cli/recipe/version.go:110 msgid "VERSION" msgstr "" @@ -1740,7 +1744,7 @@ msgstr "" msgid "abra version: %s, commit: %s, lang: %s" msgstr "" -#: ./pkg/recipe/recipe.go:199 +#: ./pkg/recipe/recipe.go:208 #, c-format msgid "abra.sh: %s}" msgstr "" @@ -2107,7 +2111,7 @@ msgstr "" msgid "chk" msgstr "" -#: ./pkg/recipe/recipe.go:73 +#: ./pkg/recipe/recipe.go:74 #, c-format msgid "choosing %s as latest version of %s" msgstr "" @@ -2142,7 +2146,7 @@ msgstr "" msgid "cmd" msgstr "" -#: ./pkg/recipe/git.go:459 +#: ./pkg/recipe/git.go:458 #, c-format msgid "collected %s for %s" msgstr "" @@ -2156,7 +2160,7 @@ msgstr "" msgid "collecting metadata from %v servers: %s" msgstr "" -#: ./pkg/recipe/recipe.go:540 +#: ./pkg/recipe/recipe.go:549 msgid "collecting recipe listing" msgstr "" @@ -2203,7 +2207,7 @@ msgstr "" msgid "compose file contains unsupported options: %s" msgstr "" -#: ./pkg/recipe/recipe.go:196 +#: ./pkg/recipe/recipe.go:205 #, c-format msgid "compose: %s, " msgstr "" @@ -2468,7 +2472,7 @@ msgstr "" msgid "destination directory does not exist" msgstr "" -#: ./pkg/recipe/git.go:368 +#: ./pkg/recipe/git.go:367 #, c-format msgid "detected %s as tags for recipe %s" msgstr "" @@ -2487,7 +2491,7 @@ msgstr "" msgid "detected potential upgradable tags %s for %s" msgstr "" -#: ./pkg/recipe/recipe.go:426 +#: ./pkg/recipe/recipe.go:435 #, c-format msgid "detected versions %s for %s" msgstr "" @@ -2521,7 +2525,7 @@ msgstr "" msgid "different versions for secret '%s', '%s' and %s'" msgstr "" -#: ./pkg/recipe/recipe.go:193 +#: ./pkg/recipe/recipe.go:202 #, c-format msgid "dir: %s, " msgstr "" @@ -2531,6 +2535,11 @@ msgstr "" msgid "directory is empty: %s" msgstr "" +#: ./pkg/recipe/recipe.go:201 +#, c-format +msgid "dirty: %v, " +msgstr "" + #: ./cli/app/deploy.go:420 ./cli/app/rollback.go:368 ./cli/app/upgrade.go:478 msgid "disable converge logic checks" msgstr "" @@ -2782,7 +2791,12 @@ msgstr "" msgid "failed to add release notes: %s" msgstr "" -#: ./pkg/git/branch.go:95 ./pkg/recipe/git.go:225 ./pkg/recipe/git.go:407 +#: ./pkg/recipe/recipe.go:175 +#, c-format +msgid "failed to check git status of %s: %s" +msgstr "" + +#: ./pkg/git/branch.go:95 ./pkg/recipe/git.go:225 ./pkg/recipe/git.go:406 #, c-format msgid "failed to check out %s in %s" msgstr "" @@ -2977,7 +2991,7 @@ msgstr "" msgid "fetching latest recipes..." msgstr "" -#: ./pkg/recipe/recipe.go:546 +#: ./pkg/recipe/recipe.go:555 #, c-format msgid "fetching repo metadata from %s" msgstr "" @@ -3086,7 +3100,7 @@ msgstr "" msgid "git changes pushed" msgstr "" -#: ./pkg/recipe/git.go:411 +#: ./pkg/recipe/git.go:410 #, c-format msgid "git checkout: %s in %s" msgstr "" @@ -3144,7 +3158,7 @@ msgstr "" msgid "git tags pushed" msgstr "" -#: ./pkg/recipe/recipe.go:194 +#: ./pkg/recipe/recipe.go:203 #, c-format msgid "git url: %s, " msgstr "" @@ -3166,7 +3180,7 @@ msgstr "" msgid "git.coopcloud.tech repo exists" msgstr "" -#: ./pkg/recipe/git.go:379 +#: ./pkg/recipe/git.go:378 #, c-format msgid "git: opening repository in %s" msgstr "" @@ -3383,7 +3397,7 @@ msgstr "" msgid "invalid option %s for flag --resolve-image" msgstr "" -#: ./pkg/recipe/recipe.go:146 +#: ./pkg/recipe/recipe.go:147 #, c-format msgid "invalid recipe: %s" msgstr "" @@ -3420,7 +3434,7 @@ msgstr "" msgid "labels [flags]" msgstr "" -#: ./cli/app/deploy.go:425 ./cli/app/list.go:193 +#: ./cli/app/deploy.go:425 ./cli/app/list.go:188 msgid "latest" msgstr "" @@ -3469,7 +3483,7 @@ msgstr "" #. translators: `app list` command #. translators: `server list` command -#: ./cli/app/list.go:53 ./cli/server/list.go:23 +#: ./cli/app/list.go:48 ./cli/server/list.go:23 msgid "list [flags]" msgstr "" @@ -3535,7 +3549,7 @@ msgstr "" #. aliases with no spaces in between #. translators: `abra server list` aliases. use a comma separated list of #. aliases with no spaces in between -#: ./cli/app/backup.go:17 ./cli/app/cmd.go:203 ./cli/app/list.go:49 ./cli/app/secret.go:453 ./cli/app/volume.go:21 ./cli/recipe/list.go:19 ./cli/server/list.go:19 +#: ./cli/app/backup.go:17 ./cli/app/cmd.go:203 ./cli/app/list.go:44 ./cli/app/secret.go:453 ./cli/app/volume.go:21 ./cli/recipe/list.go:19 ./cli/server/list.go:19 msgid "ls" msgstr "" @@ -3543,11 +3557,11 @@ msgstr "" #. with no spaces in between #. translators: `abra man` aliases. use a comma separated list of aliases #. with no spaces in between -#: ./cli/app/list.go:263 ./cli/app/move.go:34 ./cli/app/ps.go:205 ./cli/app/secret.go:553 ./cli/app/secret.go:649 ./cli/recipe/list.go:104 ./cli/recipe/upgrade.go:376 ./cli/recipe/version.go:139 ./cli/run.go:152 ./cli/server/list.go:106 ./cli/updater/updater.go:546 +#: ./cli/app/list.go:323 ./cli/app/move.go:34 ./cli/app/ps.go:205 ./cli/app/secret.go:553 ./cli/app/secret.go:649 ./cli/recipe/list.go:104 ./cli/recipe/upgrade.go:376 ./cli/recipe/version.go:139 ./cli/run.go:152 ./cli/server/list.go:106 ./cli/updater/updater.go:546 msgid "m" msgstr "" -#: ./cli/app/list.go:262 ./cli/app/ps.go:204 ./cli/app/secret.go:552 ./cli/app/secret.go:648 ./cli/recipe/list.go:103 ./cli/recipe/upgrade.go:375 ./cli/recipe/version.go:138 ./cli/server/list.go:105 +#: ./cli/app/list.go:322 ./cli/app/ps.go:204 ./cli/app/secret.go:552 ./cli/app/secret.go:648 ./cli/recipe/list.go:103 ./cli/recipe/upgrade.go:375 ./cli/recipe/version.go:138 ./cli/server/list.go:105 msgid "machine" msgstr "" @@ -4068,7 +4082,7 @@ msgstr "" msgid "previous git tags detected, assuming new semver release" msgstr "" -#: ./cli/app/list.go:265 ./cli/app/ps.go:207 ./cli/app/secret.go:555 ./cli/app/secret.go:651 ./cli/recipe/list.go:106 ./cli/recipe/upgrade.go:378 ./cli/recipe/version.go:141 ./cli/server/list.go:108 +#: ./cli/app/list.go:325 ./cli/app/ps.go:207 ./cli/app/secret.go:555 ./cli/app/secret.go:651 ./cli/recipe/list.go:106 ./cli/recipe/upgrade.go:378 ./cli/recipe/version.go:141 ./cli/server/list.go:108 msgid "print machine-readable output" msgstr "" @@ -4076,7 +4090,7 @@ msgstr "" msgid "proceed?" msgstr "" -#: ./pkg/recipe/git.go:399 +#: ./pkg/recipe/git.go:398 #, c-format msgid "processing %s for %s" msgstr "" @@ -4128,7 +4142,7 @@ msgstr "" #. with no spaces in between #. translators: `abra recipe` aliases. use a comma separated list of aliases #. with no spaces in between -#: ./cli/app/backup.go:327 ./cli/app/list.go:248 ./cli/app/move.go:346 ./cli/app/run.go:23 ./cli/app/upgrade.go:484 ./cli/catalogue/catalogue.go:302 ./cli/recipe/recipe.go:12 ./cli/recipe/release.go:649 ./cli/recipe/sync.go:272 +#: ./cli/app/backup.go:327 ./cli/app/list.go:308 ./cli/app/move.go:346 ./cli/app/run.go:23 ./cli/app/upgrade.go:484 ./cli/catalogue/catalogue.go:302 ./cli/recipe/recipe.go:12 ./cli/recipe/release.go:649 ./cli/recipe/sync.go:272 msgid "r" msgstr "" @@ -4171,7 +4185,7 @@ msgstr "" msgid "read global ignore paths: %s" msgstr "" -#: ./pkg/recipe/recipe.go:397 +#: ./pkg/recipe/recipe.go:406 #, c-format msgid "read recipe catalogue from file system cache in %s" msgstr "" @@ -4200,17 +4214,17 @@ msgstr "" msgid "reading secret from file: %s" msgstr "" -#: ./pkg/recipe/recipe.go:197 +#: ./pkg/recipe/recipe.go:206 #, c-format msgid "readme: %s, " msgstr "" #. translators: `abra recipe` command for autocompletion -#: ./cli/app/list.go:247 ./cli/app/list.go:254 ./cli/run.go:99 +#: ./cli/app/list.go:307 ./cli/app/list.go:314 ./cli/run.go:99 msgid "recipe" msgstr "" -#: ./pkg/recipe/recipe.go:449 +#: ./pkg/recipe/recipe.go:458 #, c-format msgid "recipe %s does not exist?" msgstr "" @@ -4226,7 +4240,7 @@ msgstr "" msgid "recipe [cmd] [args] [flags]" msgstr "" -#: ./pkg/recipe/recipe.go:453 +#: ./pkg/recipe/recipe.go:462 #, c-format msgid "recipe metadata retrieved for %s" msgstr "" @@ -4299,7 +4313,7 @@ msgstr "" msgid "removed .git repo in %s" msgstr "" -#: ./pkg/recipe/recipe.go:137 +#: ./pkg/recipe/recipe.go:138 #, c-format msgid "removed dirty suffix from .env version: %s -> %s" msgstr "" @@ -4480,7 +4494,7 @@ msgstr "" msgid "retrieving docker auth token: failed create docker cli: %s" msgstr "" -#: ./pkg/recipe/recipe.go:650 +#: ./pkg/recipe/recipe.go:659 msgid "retrieving recipes" msgstr "" @@ -4591,11 +4605,11 @@ msgstr "" #. aliases with no spaces in between #. translators: `abra server` aliases. use a comma separated list of aliases #. with no spaces in between -#: ./cli/app/backup.go:198 ./cli/app/backup.go:263 ./cli/app/backup.go:287 ./cli/app/list.go:271 ./cli/app/logs.go:101 ./cli/app/new.go:358 ./cli/app/restore.go:114 ./cli/app/secret.go:535 ./cli/catalogue/catalogue.go:27 ./cli/catalogue/catalogue.go:310 ./cli/recipe/fetch.go:130 ./cli/recipe/sync.go:24 ./cli/server/server.go:12 +#: ./cli/app/backup.go:198 ./cli/app/backup.go:263 ./cli/app/backup.go:287 ./cli/app/list.go:331 ./cli/app/logs.go:101 ./cli/app/new.go:358 ./cli/app/restore.go:114 ./cli/app/secret.go:535 ./cli/catalogue/catalogue.go:27 ./cli/catalogue/catalogue.go:310 ./cli/recipe/fetch.go:130 ./cli/recipe/sync.go:24 ./cli/server/server.go:12 msgid "s" msgstr "" -#: ./pkg/recipe/recipe.go:198 +#: ./pkg/recipe/recipe.go:207 #, c-format msgid "sample env: %s, " msgstr "" @@ -4658,7 +4672,7 @@ msgid "secrets are %s shown again, please save them %s" msgstr "" #. translators: `abra server` command for autocompletion -#: ./cli/app/list.go:270 ./cli/app/list.go:277 ./cli/app/new.go:357 ./cli/app/new.go:364 ./cli/run.go:101 +#: ./cli/app/list.go:330 ./cli/app/list.go:337 ./cli/app/new.go:357 ./cli/app/new.go:364 ./cli/run.go:101 msgid "server" msgstr "" @@ -4771,15 +4785,15 @@ msgstr "" msgid "show all paths" msgstr "" -#: ./cli/app/list.go:242 +#: ./cli/app/list.go:302 msgid "show app deployment status" msgstr "" -#: ./cli/app/list.go:250 +#: ./cli/app/list.go:310 msgid "show apps of a specific recipe" msgstr "" -#: ./cli/app/list.go:273 +#: ./cli/app/list.go:333 msgid "show apps of a specific server" msgstr "" @@ -4848,12 +4862,12 @@ msgstr "" msgid "skipping generation of %s (generate=false)" msgstr "" -#: ./pkg/app/app.go:693 +#: ./pkg/app/app.go:690 #, c-format msgid "skipping version %s write as already exists in %s.env" msgstr "" -#: ./pkg/app/app.go:687 +#: ./pkg/app/app.go:684 #, c-format msgid "skipping writing version %s because dry run" msgstr "" @@ -4903,7 +4917,7 @@ msgstr "" msgid "ssh host connection is not valid" msgstr "" -#: ./pkg/recipe/recipe.go:195 +#: ./pkg/recipe/recipe.go:204 #, c-format msgid "ssh url: %s, " msgstr "" @@ -4916,7 +4930,7 @@ msgstr "" msgid "ssh: SSH_AUTH_SOCK missing, --publish/-p will fail. see \"abra catalogue generate --help\"" msgstr "" -#: ./cli/app/list.go:239 ./cli/recipe/list.go:45 +#: ./cli/app/list.go:299 ./cli/recipe/list.go:45 msgid "status" msgstr "" @@ -5128,7 +5142,7 @@ msgstr "" msgid "unable to clean up git clone of %s: %s" msgstr "" -#: ./cli/app/list.go:159 +#: ./cli/app/list.go:154 #, c-format msgid "unable to clone %s: %s" msgstr "" @@ -5241,7 +5255,7 @@ msgstr "" msgid "unable to parse %s, skipping" msgstr "" -#: ./cli/app/list.go:174 +#: ./cli/app/list.go:169 #, c-format msgid "unable to parse %s, skipping as upgrade option" msgstr "" @@ -5311,7 +5325,7 @@ msgstr "" msgid "unable to retrieve %s resources on %s: %s" msgstr "" -#: ./cli/app/list.go:164 +#: ./cli/app/list.go:159 #, c-format msgid "unable to retrieve tags for %s: %s" msgstr "" @@ -5395,7 +5409,7 @@ msgstr "" msgid "unimplemented call: SetWriteDeadline(%v)" msgstr "" -#: ./cli/app/labels.go:78 ./cli/app/list.go:122 ./cli/app/list.go:123 ./cli/app/list.go:124 ./cli/app/list.go:125 ./cli/app/list.go:126 ./cli/app/list.go:191 ./cli/app/ps.go:125 ./cli/app/ps.go:126 ./cli/app/ps.go:127 ./cli/app/ps.go:128 ./cli/app/ps.go:129 ./cli/server/list.go:65 ./cli/server/list.go:77 +#: ./cli/app/labels.go:78 ./cli/app/list.go:117 ./cli/app/list.go:118 ./cli/app/list.go:119 ./cli/app/list.go:120 ./cli/app/list.go:121 ./cli/app/list.go:186 ./cli/app/ps.go:125 ./cli/app/ps.go:126 ./cli/app/ps.go:127 ./cli/app/ps.go:128 ./cli/app/ps.go:129 ./cli/server/list.go:65 ./cli/server/list.go:77 msgid "unknown" msgstr "" @@ -5564,7 +5578,7 @@ msgstr "" msgid "version" msgstr "" -#: ./pkg/app/app.go:691 +#: ./pkg/app/app.go:688 #, c-format msgid "version %s saved to %s.env" msgstr "" @@ -5574,7 +5588,7 @@ msgstr "" msgid "version '%s' appears to be a chaos commit, but --chaos/-C was not provided" msgstr "" -#: ./pkg/recipe/recipe.go:192 +#: ./pkg/recipe/recipe.go:200 #, c-format msgid "version : %s, " msgstr "" @@ -5583,7 +5597,7 @@ msgstr "" msgid "version for abra" msgstr "" -#: ./pkg/recipe/recipe.go:129 +#: ./pkg/recipe/recipe.go:130 #, c-format msgid "version seems invalid: %s" msgstr "" @@ -5770,7 +5784,7 @@ msgstr "" msgid "{decoder: %v, " msgstr "" -#: ./pkg/recipe/recipe.go:191 +#: ./pkg/recipe/recipe.go:199 #, c-format msgid "{name: %s, " msgstr "" diff --git a/pkg/i18n/locales/es.po b/pkg/i18n/locales/es.po index 27d81970a..03f4c0ea6 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-10-03 20:35+0200\n" +"POT-Creation-Date: 2025-10-01 21:13+0200\n" "PO-Revision-Date: 2025-09-04 08:14+0000\n" "Last-Translator: chasqui \n" "Language-Team: Spanish " msgstr "" -#: cli/app/list.go:57 +#: cli/app/list.go:52 msgid "" "Generate a report of all managed apps.\n" "\n" @@ -1025,7 +1029,7 @@ msgid "List all available commands" msgstr "📋 Listar todos los comandos disponibles" #. translators: Short description for `app list` command -#: cli/app/list.go:56 +#: cli/app/list.go:51 msgid "List all managed apps" msgstr "📋 Listar todas plataformas 🚀 administradas" @@ -1201,7 +1205,7 @@ msgstr "" msgid "README.md metadata filled in" msgstr "" -#: cli/internal/deploy.go:79 cli/internal/deploy.go:209 +#: cli/app/list.go:227 cli/internal/deploy.go:79 cli/internal/deploy.go:209 msgid "RECIPE" msgstr "" @@ -1336,7 +1340,7 @@ msgstr "" msgid "Run app commands" msgstr "💻 Ejecutar comandos en una plataforma 🚀" -#: cli/app/backup.go:303 cli/app/list.go:240 cli/app/logs.go:109 +#: cli/app/backup.go:303 cli/app/list.go:300 cli/app/logs.go:109 #: cli/app/new.go:389 msgid "S" msgstr "" @@ -1349,7 +1353,7 @@ msgstr "" msgid "SECRETS OVERVIEW" msgstr "" -#: cli/internal/deploy.go:80 +#: cli/app/list.go:227 cli/internal/deploy.go:80 msgid "SERVER" msgstr "" @@ -1375,7 +1379,7 @@ msgstr "" msgid "SSO" msgstr "" -#: cli/app/ps.go:186 +#: cli/app/list.go:230 cli/app/ps.go:186 msgid "STATUS" msgstr "" @@ -1588,7 +1592,7 @@ msgstr "" msgid "UNDEPLOY" msgstr "" -#: cli/internal/deploy.go:174 +#: cli/app/list.go:233 cli/internal/deploy.go:174 msgid "UPGRADE" msgstr "" @@ -1732,8 +1736,8 @@ msgstr "" msgid "VALUE" msgstr "" -#: cli/app/ps.go:188 cli/app/secret.go:481 cli/recipe/version.go:69 -#: cli/recipe/version.go:110 +#: cli/app/list.go:232 cli/app/ps.go:188 cli/app/secret.go:481 +#: cli/recipe/version.go:69 cli/recipe/version.go:110 msgid "VERSION" msgstr "" @@ -1902,7 +1906,7 @@ msgstr "" msgid "abra version: %s, commit: %s, lang: %s" msgstr "" -#: pkg/recipe/recipe.go:199 +#: pkg/recipe/recipe.go:208 #, c-format msgid "abra.sh: %s}" msgstr "" @@ -2287,7 +2291,7 @@ msgstr "" msgid "chk" msgstr "" -#: pkg/recipe/recipe.go:73 +#: pkg/recipe/recipe.go:74 #, c-format msgid "choosing %s as latest version of %s" msgstr "" @@ -2322,7 +2326,7 @@ msgstr "" msgid "cmd" msgstr "" -#: pkg/recipe/git.go:459 +#: pkg/recipe/git.go:458 #, c-format msgid "collected %s for %s" msgstr "" @@ -2336,7 +2340,7 @@ msgstr "" msgid "collecting metadata from %v servers: %s" msgstr "" -#: pkg/recipe/recipe.go:540 +#: pkg/recipe/recipe.go:549 msgid "collecting recipe listing" msgstr "" @@ -2389,7 +2393,7 @@ msgstr "" msgid "compose file contains unsupported options: %s" msgstr "" -#: pkg/recipe/recipe.go:196 +#: pkg/recipe/recipe.go:205 #, c-format msgid "compose: %s, " msgstr "" @@ -2656,7 +2660,7 @@ msgstr "" msgid "destination directory does not exist" msgstr "" -#: pkg/recipe/git.go:368 +#: pkg/recipe/git.go:367 #, c-format msgid "detected %s as tags for recipe %s" msgstr "" @@ -2675,7 +2679,7 @@ msgstr "" msgid "detected potential upgradable tags %s for %s" msgstr "" -#: pkg/recipe/recipe.go:426 +#: pkg/recipe/recipe.go:435 #, c-format msgid "detected versions %s for %s" msgstr "" @@ -2709,7 +2713,7 @@ msgstr "" msgid "different versions for secret '%s', '%s' and %s'" msgstr "" -#: pkg/recipe/recipe.go:193 +#: pkg/recipe/recipe.go:202 #, c-format msgid "dir: %s, " msgstr "" @@ -2719,6 +2723,11 @@ msgstr "" msgid "directory is empty: %s" msgstr "" +#: pkg/recipe/recipe.go:201 +#, c-format +msgid "dirty: %v, " +msgstr "" + #: cli/app/deploy.go:420 cli/app/rollback.go:368 cli/app/upgrade.go:478 msgid "disable converge logic checks" msgstr "" @@ -2979,7 +2988,12 @@ msgstr "" msgid "failed to add release notes: %s" msgstr "" -#: pkg/git/branch.go:95 pkg/recipe/git.go:225 pkg/recipe/git.go:407 +#: pkg/recipe/recipe.go:175 +#, c-format +msgid "failed to check git status of %s: %s" +msgstr "" + +#: pkg/git/branch.go:95 pkg/recipe/git.go:225 pkg/recipe/git.go:406 #, c-format msgid "failed to check out %s in %s" msgstr "" @@ -3174,7 +3188,7 @@ msgstr "" msgid "fetching latest recipes..." msgstr "" -#: pkg/recipe/recipe.go:546 +#: pkg/recipe/recipe.go:555 #, c-format msgid "fetching repo metadata from %s" msgstr "" @@ -3284,7 +3298,7 @@ msgstr "" msgid "git changes pushed" msgstr "" -#: pkg/recipe/git.go:411 +#: pkg/recipe/git.go:410 #, c-format msgid "git checkout: %s in %s" msgstr "" @@ -3342,7 +3356,7 @@ msgstr "" msgid "git tags pushed" msgstr "" -#: pkg/recipe/recipe.go:194 +#: pkg/recipe/recipe.go:203 #, c-format msgid "git url: %s, " msgstr "" @@ -3364,7 +3378,7 @@ msgstr "" msgid "git.coopcloud.tech repo exists" msgstr "" -#: pkg/recipe/git.go:379 +#: pkg/recipe/git.go:378 #, c-format msgid "git: opening repository in %s" msgstr "" @@ -3590,7 +3604,7 @@ msgstr "" msgid "invalid option %s for flag --resolve-image" msgstr "" -#: pkg/recipe/recipe.go:146 +#: pkg/recipe/recipe.go:147 #, c-format msgid "invalid recipe: %s" msgstr "" @@ -3628,7 +3642,7 @@ msgstr "" msgid "labels [flags]" msgstr "etiquetas [flags]" -#: cli/app/deploy.go:425 cli/app/list.go:193 +#: cli/app/deploy.go:425 cli/app/list.go:188 msgid "latest" msgstr "" @@ -3677,7 +3691,7 @@ msgstr "listar [flags]" #. translators: `app list` command #. translators: `server list` command -#: cli/app/list.go:53 cli/server/list.go:23 +#: cli/app/list.go:48 cli/server/list.go:23 msgid "list [flags]" msgstr "listar [flags]" @@ -3743,7 +3757,7 @@ msgstr "" #. aliases with no spaces in between #. translators: `abra server list` aliases. use a comma separated list of #. aliases with no spaces in between -#: cli/app/backup.go:17 cli/app/cmd.go:203 cli/app/list.go:49 +#: cli/app/backup.go:17 cli/app/cmd.go:203 cli/app/list.go:44 #: cli/app/secret.go:453 cli/app/volume.go:21 cli/recipe/list.go:19 #: cli/server/list.go:19 msgid "ls" @@ -3753,14 +3767,14 @@ msgstr "plataformas" #. with no spaces in between #. translators: `abra man` aliases. use a comma separated list of aliases #. with no spaces in between -#: cli/app/list.go:263 cli/app/move.go:34 cli/app/ps.go:205 +#: cli/app/list.go:323 cli/app/move.go:34 cli/app/ps.go:205 #: cli/app/secret.go:553 cli/app/secret.go:649 cli/recipe/list.go:104 #: cli/recipe/upgrade.go:376 cli/recipe/version.go:139 cli/run.go:152 #: cli/server/list.go:106 cli/updater/updater.go:546 msgid "m" msgstr "" -#: cli/app/list.go:262 cli/app/ps.go:204 cli/app/secret.go:552 +#: cli/app/list.go:322 cli/app/ps.go:204 cli/app/secret.go:552 #: cli/app/secret.go:648 cli/recipe/list.go:103 cli/recipe/upgrade.go:375 #: cli/recipe/version.go:138 cli/server/list.go:105 msgid "machine" @@ -4307,7 +4321,7 @@ msgstr "" msgid "previous git tags detected, assuming new semver release" msgstr "" -#: cli/app/list.go:265 cli/app/ps.go:207 cli/app/secret.go:555 +#: cli/app/list.go:325 cli/app/ps.go:207 cli/app/secret.go:555 #: cli/app/secret.go:651 cli/recipe/list.go:106 cli/recipe/upgrade.go:378 #: cli/recipe/version.go:141 cli/server/list.go:108 msgid "print machine-readable output" @@ -4317,7 +4331,7 @@ msgstr "" msgid "proceed?" msgstr "" -#: pkg/recipe/git.go:399 +#: pkg/recipe/git.go:398 #, c-format msgid "processing %s for %s" msgstr "" @@ -4369,7 +4383,7 @@ msgstr "" #. with no spaces in between #. translators: `abra recipe` aliases. use a comma separated list of aliases #. with no spaces in between -#: cli/app/backup.go:327 cli/app/list.go:248 cli/app/move.go:346 +#: cli/app/backup.go:327 cli/app/list.go:308 cli/app/move.go:346 #: cli/app/run.go:23 cli/app/upgrade.go:484 cli/catalogue/catalogue.go:302 #: cli/recipe/recipe.go:12 cli/recipe/release.go:649 cli/recipe/sync.go:272 msgid "r" @@ -4415,7 +4429,7 @@ msgstr "" msgid "read global ignore paths: %s" msgstr "" -#: pkg/recipe/recipe.go:397 +#: pkg/recipe/recipe.go:406 #, c-format msgid "read recipe catalogue from file system cache in %s" msgstr "" @@ -4444,17 +4458,17 @@ msgstr "" msgid "reading secret from file: %s" msgstr "" -#: pkg/recipe/recipe.go:197 +#: pkg/recipe/recipe.go:206 #, c-format msgid "readme: %s, " msgstr "" #. translators: `abra recipe` command for autocompletion -#: cli/app/list.go:247 cli/app/list.go:254 cli/run.go:99 +#: cli/app/list.go:307 cli/app/list.go:314 cli/run.go:99 msgid "recipe" msgstr "" -#: pkg/recipe/recipe.go:449 +#: pkg/recipe/recipe.go:458 #, c-format msgid "recipe %s does not exist?" msgstr "" @@ -4471,7 +4485,7 @@ msgstr "" msgid "recipe [cmd] [args] [flags]" msgstr "receta [cmd] [args] [flags]" -#: pkg/recipe/recipe.go:453 +#: pkg/recipe/recipe.go:462 #, c-format msgid "recipe metadata retrieved for %s" msgstr "" @@ -4544,7 +4558,7 @@ msgstr "" msgid "removed .git repo in %s" msgstr "" -#: pkg/recipe/recipe.go:137 +#: pkg/recipe/recipe.go:138 #, c-format msgid "removed dirty suffix from .env version: %s -> %s" msgstr "" @@ -4726,7 +4740,7 @@ msgstr "" msgid "retrieving docker auth token: failed create docker cli: %s" msgstr "" -#: pkg/recipe/recipe.go:650 +#: pkg/recipe/recipe.go:659 msgid "retrieving recipes" msgstr "" @@ -4839,14 +4853,14 @@ msgstr "" #. translators: `abra server` aliases. use a comma separated list of aliases #. with no spaces in between #: cli/app/backup.go:198 cli/app/backup.go:263 cli/app/backup.go:287 -#: cli/app/list.go:271 cli/app/logs.go:101 cli/app/new.go:358 +#: cli/app/list.go:331 cli/app/logs.go:101 cli/app/new.go:358 #: cli/app/restore.go:114 cli/app/secret.go:535 cli/catalogue/catalogue.go:27 #: cli/catalogue/catalogue.go:310 cli/recipe/fetch.go:130 cli/recipe/sync.go:24 #: cli/server/server.go:12 msgid "s" msgstr "" -#: pkg/recipe/recipe.go:198 +#: pkg/recipe/recipe.go:207 #, c-format msgid "sample env: %s, " msgstr "" @@ -4909,7 +4923,7 @@ msgid "secrets are %s shown again, please save them %s" msgstr "" #. translators: `abra server` command for autocompletion -#: cli/app/list.go:270 cli/app/list.go:277 cli/app/new.go:357 +#: cli/app/list.go:330 cli/app/list.go:337 cli/app/new.go:357 #: cli/app/new.go:364 cli/run.go:101 msgid "server" msgstr "" @@ -5025,15 +5039,15 @@ msgstr "" msgid "show all paths" msgstr "" -#: cli/app/list.go:242 +#: cli/app/list.go:302 msgid "show app deployment status" msgstr "" -#: cli/app/list.go:250 +#: cli/app/list.go:310 msgid "show apps of a specific recipe" msgstr "" -#: cli/app/list.go:273 +#: cli/app/list.go:333 msgid "show apps of a specific server" msgstr "" @@ -5102,12 +5116,12 @@ msgstr "" msgid "skipping generation of %s (generate=false)" msgstr "" -#: pkg/app/app.go:693 +#: pkg/app/app.go:690 #, c-format msgid "skipping version %s write as already exists in %s.env" msgstr "" -#: pkg/app/app.go:687 +#: pkg/app/app.go:684 #, c-format msgid "skipping writing version %s because dry run" msgstr "" @@ -5157,7 +5171,7 @@ msgstr "" msgid "ssh host connection is not valid" msgstr "" -#: pkg/recipe/recipe.go:195 +#: pkg/recipe/recipe.go:204 #, c-format msgid "ssh url: %s, " msgstr "" @@ -5172,7 +5186,7 @@ msgid "" "generate --help\"" msgstr "" -#: cli/app/list.go:239 cli/recipe/list.go:45 +#: cli/app/list.go:299 cli/recipe/list.go:45 msgid "status" msgstr "" @@ -5386,7 +5400,7 @@ msgstr "" msgid "unable to clean up git clone of %s: %s" msgstr "" -#: cli/app/list.go:159 +#: cli/app/list.go:154 #, c-format msgid "unable to clone %s: %s" msgstr "" @@ -5500,7 +5514,7 @@ msgstr "" msgid "unable to parse %s, skipping" msgstr "" -#: cli/app/list.go:174 +#: cli/app/list.go:169 #, c-format msgid "unable to parse %s, skipping as upgrade option" msgstr "" @@ -5573,7 +5587,7 @@ msgstr "" msgid "unable to retrieve %s resources on %s: %s" msgstr "" -#: cli/app/list.go:164 +#: cli/app/list.go:159 #, c-format msgid "unable to retrieve tags for %s: %s" msgstr "" @@ -5657,9 +5671,9 @@ msgstr "" msgid "unimplemented call: SetWriteDeadline(%v)" msgstr "" -#: cli/app/labels.go:78 cli/app/list.go:122 cli/app/list.go:123 -#: cli/app/list.go:124 cli/app/list.go:125 cli/app/list.go:126 -#: cli/app/list.go:191 cli/app/ps.go:125 cli/app/ps.go:126 cli/app/ps.go:127 +#: cli/app/labels.go:78 cli/app/list.go:117 cli/app/list.go:118 +#: cli/app/list.go:119 cli/app/list.go:120 cli/app/list.go:121 +#: cli/app/list.go:186 cli/app/ps.go:125 cli/app/ps.go:126 cli/app/ps.go:127 #: cli/app/ps.go:128 cli/app/ps.go:129 cli/server/list.go:65 #: cli/server/list.go:77 msgid "unknown" @@ -5831,7 +5845,7 @@ msgstr "" msgid "version" msgstr "" -#: pkg/app/app.go:691 +#: pkg/app/app.go:688 #, c-format msgid "version %s saved to %s.env" msgstr "" @@ -5842,7 +5856,7 @@ msgid "" "version '%s' appears to be a chaos commit, but --chaos/-C was not provided" msgstr "" -#: pkg/recipe/recipe.go:192 +#: pkg/recipe/recipe.go:200 #, c-format msgid "version : %s, " msgstr "" @@ -5851,7 +5865,7 @@ msgstr "" msgid "version for abra" msgstr "" -#: pkg/recipe/recipe.go:129 +#: pkg/recipe/recipe.go:130 #, c-format msgid "version seems invalid: %s" msgstr "" @@ -6042,7 +6056,7 @@ msgstr "" msgid "{decoder: %v, " msgstr "" -#: pkg/recipe/recipe.go:191 +#: pkg/recipe/recipe.go:199 #, c-format msgid "{name: %s, " msgstr "" diff --git a/pkg/recipe/git.go b/pkg/recipe/git.go index 9eb03dbb0..e487e0116 100644 --- a/pkg/recipe/git.go +++ b/pkg/recipe/git.go @@ -305,7 +305,6 @@ func (r *Recipe) ChaosVersion() (string, error) { if err != nil { return "", err } - if dirty { return fmt.Sprintf("%s%s", version, config.DIRTY_DEFAULT), nil } diff --git a/pkg/recipe/git_test.go b/pkg/recipe/git_test.go index 22926a308..32197b83c 100644 --- a/pkg/recipe/git_test.go +++ b/pkg/recipe/git_test.go @@ -15,12 +15,7 @@ func TestIsDirty(t *testing.T) { t.Fatal(err) } - isDirty, err := r.IsDirty() - if err != nil { - t.Fatal(err) - } - - assert.False(t, isDirty) + assert.False(t, r.Dirty) fpath := filepath.Join(r.Dir, "foo.txt") f, err := os.Create(fpath) diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 0128a3240..592e24529 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -13,6 +13,7 @@ import ( "strings" "coopcloud.tech/abra/pkg/i18n" + "github.com/go-git/go-git/v5" "coopcloud.tech/abra/pkg/catalogue" "coopcloud.tech/abra/pkg/config" @@ -169,6 +170,12 @@ func Get(name string) Recipe { AbraShPath: path.Join(dir, "abra.sh"), } + dirty, err := r.IsDirty() + if err != nil && !errors.Is(err, git.ErrRepositoryNotExists) { + log.Fatal(i18n.G("failed to check git status of %s: %s", r.Name, err)) + } + r.Dirty = dirty + return r } @@ -176,6 +183,7 @@ type Recipe struct { Name string EnvVersion string EnvVersionRaw string + Dirty bool // NOTE(d1): git terminology for unstaged changes Dir string GitURL string SSHURL string @@ -190,6 +198,7 @@ type Recipe struct { func (r Recipe) String() string { out := i18n.G("{name: %s, ", r.Name) out += i18n.G("version : %s, ", r.EnvVersion) + out += i18n.G("dirty: %v, ", r.Dirty) out += i18n.G("dir: %s, ", r.Dir) out += i18n.G("git url: %s, ", r.GitURL) out += i18n.G("ssh url: %s, ", r.SSHURL) diff --git a/tests/integration/app_list.bats b/tests/integration/app_list.bats index 7c753bd84..21aaf3f66 100644 --- a/tests/integration/app_list.bats +++ b/tests/integration/app_list.bats @@ -45,6 +45,78 @@ teardown(){ fi } +@test "list without status" { + run $ABRA app ls + assert_success + assert_output --partial "$TEST_SERVER" + assert_output --partial "$TEST_APP_DOMAIN" +} + +# bats test_tags=slow +@test "list with status" { + run $ABRA app ls --status + assert_success + assert_output --partial "$TEST_SERVER" + assert_output --partial "$TEST_APP_DOMAIN" + assert_output --partial "unknown" + + _deploy_app + + run $ABRA app ls --status + assert_success + assert_output --partial "$TEST_SERVER" + assert_output --partial "$TEST_APP_DOMAIN" + assert_output --partial "deployed" +} + +@test "filter by server" { + run mkdir -p "$ABRA_DIR/servers/foo.com" + assert_success + assert_exists "$ABRA_DIR/servers/foo.com" + + run cp \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" \ + "$ABRA_DIR/servers/foo.com/app.foo.com.env" + assert_exists "$ABRA_DIR/servers/foo.com/app.foo.com.env" + + run $ABRA app ls + assert_success + assert_output --partial "$TEST_SERVER" + assert_output --partial "foo.com" + + run rm -rf "$ABRA_DIR/servers/foo.com" + assert_success + assert_not_exists "$ABRA_DIR/servers/foo.com" +} + +@test "filter by recipe" { + run mkdir -p "$ABRA_DIR/servers/foo.com" + assert_success + assert_exists "$ABRA_DIR/servers/foo.com" + + run cp \ + "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" \ + "$ABRA_DIR/servers/foo.com/app.foo.com.env" + assert_exists "$ABRA_DIR/servers/foo.com/app.foo.com.env" + + run sed -i "s/TYPE=$TEST_RECIPE/TYPE=foo-recipe/g" "$ABRA_DIR/servers/foo.com/app.foo.com.env" + assert grep -q "TYPE=foo-recipe" "$ABRA_DIR/servers/foo.com/app.foo.com.env" + + run $ABRA app ls + assert_success + assert_output --partial "$TEST_RECIPE" + assert_output --partial "foo-recipe" + + run $ABRA app ls --recipe foo-recipe + assert_success + refute_output --partial "$TEST_RECIPE" + assert_output --partial "foo-recipe" + + run rm -rf "$ABRA_DIR/servers/foo.com" + assert_success + assert_not_exists "$ABRA_DIR/servers/foo.com" +} + @test "output is machine readable" { run $ABRA app ls --machine @@ -54,3 +126,84 @@ teardown(){ assert_output --partial "$expectedOutput" } + +# bats test_tags=slow +@test "list with status fetches recipe" { + _deploy_app + + run $ABRA app ls --status + assert_success + + run rm -rf "$ABRA_DIR/recipes/$TEST_RECIPE" + assert_success + + run $ABRA app ls --status + assert_success +} + +# bats test_tags=slow +@test "list with chaos version" { + run bash -c "echo foo >> $ABRA_DIR/recipes/$TEST_RECIPE/foo" + assert_success + assert_exists "$ABRA_DIR/recipes/$TEST_RECIPE/foo" + + run $ABRA app deploy "$TEST_APP_DOMAIN" \ + --no-input --no-converge-checks --chaos + assert_success + + run $ABRA app ls --status + assert_success + assert_output --partial "+U" + + run rm -rf "$ABRA_DIR/servers/foo.com" + assert_success + assert_not_exists "$ABRA_DIR/servers/foo.com" +} + +@test "list with status skips unknown servers" { + if [[ ! -d "$ABRA_DIR/servers/foo" ]]; then + run mkdir -p "$ABRA_DIR/servers/foo" + assert_success + assert_exists "$ABRA_DIR/servers/foo" + + run cp "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" \ + "$ABRA_DIR/servers/foo/$TEST_APP_DOMAIN.env" + assert_success + assert_exists "$ABRA_DIR/servers/foo/$TEST_APP_DOMAIN.env" + fi + + run $ABRA app ls --status + assert_success + assert_output --partial "unknown server" +} + +# bats test_tags=slow +@test "list does not fail if missing .env" { + _deploy_app + + run $ABRA app ls --status + assert_success + + run rm -rf "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + assert_success + assert_not_exists "$ABRA_DIR/servers/$TEST_SERVER/$TEST_APP_DOMAIN.env" + + output=$("$ABRA" app ls --server "$TEST_SERVER" --status --machine) + run diff \ + <(jq -S "." <(echo "$output")) \ + <(jq -S "." <(echo '{}')) + assert_success +} + +# bats test_tags=slow +@test "list ignores borked tags" { + run git -C "$ABRA_DIR/recipes/$TEST_RECIPE" tag \ + -a "2.4.8_1" -m "feat: completely borked tag" + assert_success + + _deploy_app + + run $ABRA app ls --status --debug + assert_success + assert_output --partial "unable to parse 2.4.8_1" +}