updater

package
v0.0.0-...-b313b0a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2024 License: GPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const SERVER = "localhost"

Variables

View Source
var Notify = cli.Command{
	Name:      "notify",
	Aliases:   []string{"n"},
	Usage:     "Check for available upgrades",
	UsageText: "kadabra notify [options]",
	Flags: []cli.Flag{
		majorFlag,
	},
	Before: internal.SubCommandBefore,
	Description: `Notify on new versions for deployed apps.

If a new patch/minor version is available, a notification is printed.

Use "--major" to include new major versions.`,
	HideHelp: true,
	Action: func(ctx context.Context, cmd *cli.Command) error {
		cl, err := client.New("default")
		if err != nil {
			log.Fatal(err)
		}

		stacks, err := stack.GetStacks(cl)
		if err != nil {
			log.Fatal(err)
		}

		for _, stackInfo := range stacks {
			stackName := stackInfo.Name
			recipeName, err := getLabel(cl, stackName, "recipe")
			if err != nil {
				log.Fatal(err)
			}

			if recipeName != "" {
				_, err = getLatestUpgrade(cl, stackName, recipeName)
				if err != nil {
					log.Fatal(err)
				}
			}
		}

		return nil
	},
}

Notify checks for available upgrades

View Source
var UpgradeApp = cli.Command{
	Name:      "upgrade",
	Aliases:   []string{"u"},
	Usage:     "Upgrade apps",
	UsageText: "kadabra notify <stack> <recipe> [options]",
	Flags: []cli.Flag{
		internal.ChaosFlag,
		majorFlag,
		allFlag,
	},
	Before: internal.SubCommandBefore,
	Description: `Upgrade an app by specifying stack name and recipe. 

Use "--all" to upgrade every deployed app.

For each app with auto updates enabled, the deployed version is compared with
the current recipe catalogue version. If a new patch/minor version is
available, the app is upgraded.

To include major versions use the "--major" flag. You probably don't want that
as it will break things. Only apps that are not deployed with "--chaos" are
upgraded, to update chaos deployments use the "--chaos" flag. Use it with care.`,
	HideHelp: true,
	Action: func(ctx context.Context, cmd *cli.Command) error {
		cl, err := client.New("default")
		if err != nil {
			log.Fatal(err)
		}

		if !updateAll {
			stackName := cmd.Args().Get(0)
			recipeName := cmd.Args().Get(1)
			err = tryUpgrade(cl, stackName, recipeName)
			if err != nil {
				log.Fatal(err)
			}

			return nil
		}

		stacks, err := stack.GetStacks(cl)
		if err != nil {
			log.Fatal(err)
		}

		for _, stackInfo := range stacks {
			stackName := stackInfo.Name
			recipeName, err := getLabel(cl, stackName, "recipe")
			if err != nil {
				log.Fatal(err)
			}

			err = tryUpgrade(cl, stackName, recipeName)
			if err != nil {
				log.Fatal(err)
			}
		}

		return nil
	},
}

UpgradeApp upgrades apps.

Functions

func RunApp

func RunApp(version, commit string)

RunApp runs CLI abra app.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL