updater

package
v0.0.0-...-004cd70 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: GPL-2.0 Imports: 19 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",
	Flags: []cli.Flag{
		internal.DebugFlag,
		majorFlag,
		internal.OfflineFlag,
	},
	Before: internal.SubCommandBefore,
	Description: `
It reads the deployed app versions and looks for new versions in the recipe
catalogue. If a new patch/minor version is available, a notification is
printed. To include major versions use the --major flag.
`,
	Action: func(c *cli.Context) error {
		cl, err := client.New("default")
		if err != nil {
			logrus.Fatal(err)
		}

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

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

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

		return nil
	},
}

Notify checks for available upgrades

View Source
var UpgradeApp = cli.Command{
	Name:      "upgrade",
	Aliases:   []string{"u"},
	Usage:     "Upgrade apps",
	ArgsUsage: "<stack-name> <recipe>",
	Flags: []cli.Flag{
		internal.DebugFlag,
		internal.ChaosFlag,
		majorFlag,
		allFlag,
		internal.OfflineFlag,
	},
	Before: internal.SubCommandBefore,
	Description: `
Upgrade an app by specifying its stack name and recipe. By passing "--all"
instead, every deployed app is upgraded. For each apps with enabled auto
updates 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. Don't do that, it will probably
break things. Only apps that are not deployed with "--chaos" are upgraded, to
update chaos deployments use the "--chaos" flag. Use it with care.
`,
	Action: func(c *cli.Context) error {
		cl, err := client.New("default")
		if err != nil {
			logrus.Fatal(err)
		}

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

			return nil
		}

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

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

			err = tryUpgrade(cl, stackName, recipeName)
			if err != nil {
				logrus.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