forked from toolshed/abra
		
	fix: only update when really needed
This commit is contained in:
		| @ -46,6 +46,10 @@ recipes. | |||||||
| 		app := internal.ValidateApp(c) | 		app := internal.ValidateApp(c) | ||||||
| 		stackName := app.StackName() | 		stackName := app.StackName() | ||||||
|  |  | ||||||
|  | 		if err := recipe.EnsureUpToDate(app.Type); err != nil { | ||||||
|  | 			logrus.Fatal(err) | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		r, err := recipe.Get(app.Type) | 		r, err := recipe.Get(app.Type) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			logrus.Fatal(err) | 			logrus.Fatal(err) | ||||||
|  | |||||||
| @ -50,6 +50,10 @@ recipes. | |||||||
| 		app := internal.ValidateApp(c) | 		app := internal.ValidateApp(c) | ||||||
| 		stackName := app.StackName() | 		stackName := app.StackName() | ||||||
|  |  | ||||||
|  | 		if err := recipe.EnsureUpToDate(app.Type); err != nil { | ||||||
|  | 			logrus.Fatal(err) | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		r, err := recipe.Get(app.Type) | 		r, err := recipe.Get(app.Type) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			logrus.Fatal(err) | 			logrus.Fatal(err) | ||||||
|  | |||||||
| @ -23,6 +23,10 @@ func DeployAction(c *cli.Context) error { | |||||||
| 	app := ValidateApp(c) | 	app := ValidateApp(c) | ||||||
| 	stackName := app.StackName() | 	stackName := app.StackName() | ||||||
|  |  | ||||||
|  | 	if err := recipe.EnsureUpToDate(app.Type); err != nil { | ||||||
|  | 		logrus.Fatal(err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	r, err := recipe.Get(app.Type) | 	r, err := recipe.Get(app.Type) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		logrus.Fatal(err) | 		logrus.Fatal(err) | ||||||
|  | |||||||
| @ -7,6 +7,7 @@ import ( | |||||||
| 	abraFormatter "coopcloud.tech/abra/cli/formatter" | 	abraFormatter "coopcloud.tech/abra/cli/formatter" | ||||||
| 	"coopcloud.tech/abra/pkg/config" | 	"coopcloud.tech/abra/pkg/config" | ||||||
| 	"coopcloud.tech/abra/pkg/recipe" | 	"coopcloud.tech/abra/pkg/recipe" | ||||||
|  | 	recipePkg "coopcloud.tech/abra/pkg/recipe" | ||||||
| 	"coopcloud.tech/abra/pkg/secret" | 	"coopcloud.tech/abra/pkg/secret" | ||||||
| 	"coopcloud.tech/abra/pkg/ssh" | 	"coopcloud.tech/abra/pkg/ssh" | ||||||
| 	"github.com/AlecAivazis/survey/v2" | 	"github.com/AlecAivazis/survey/v2" | ||||||
| @ -111,6 +112,10 @@ func ensureAppNameFlag() error { | |||||||
| func NewAction(c *cli.Context) error { | func NewAction(c *cli.Context) error { | ||||||
| 	recipe := ValidateRecipeWithPrompt(c) | 	recipe := ValidateRecipeWithPrompt(c) | ||||||
|  |  | ||||||
|  | 	if err := recipePkg.EnsureUpToDate(recipe.Name); err != nil { | ||||||
|  | 		logrus.Fatal(err) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if err := ensureServerFlag(); err != nil { | 	if err := ensureServerFlag(); err != nil { | ||||||
| 		logrus.Fatal(err) | 		logrus.Fatal(err) | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -37,10 +37,6 @@ func ValidateRecipe(c *cli.Context) recipe.Recipe { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if err := recipe.EnsureUpToDate(recipeName); err != nil { |  | ||||||
| 		logrus.Fatal(err) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	logrus.Debugf("validated %s as recipe argument", recipeName) | 	logrus.Debugf("validated %s as recipe argument", recipeName) | ||||||
|  |  | ||||||
| 	return chosenRecipe | 	return chosenRecipe | ||||||
| @ -102,10 +98,6 @@ func ValidateRecipeWithPrompt(c *cli.Context) recipe.Recipe { | |||||||
| 		logrus.Fatal(err) | 		logrus.Fatal(err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if err := recipe.EnsureUpToDate(chosenRecipe.Name); err != nil { |  | ||||||
| 		logrus.Fatal(err) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	logrus.Debugf("validated %s as recipe argument", recipeName) | 	logrus.Debugf("validated %s as recipe argument", recipeName) | ||||||
|  |  | ||||||
| 	return chosenRecipe | 	return chosenRecipe | ||||||
| @ -133,10 +125,6 @@ func ValidateApp(c *cli.Context) config.App { | |||||||
| 		logrus.Fatal(err) | 		logrus.Fatal(err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if err := recipe.EnsureUpToDate(app.Type); err != nil { |  | ||||||
| 		logrus.Fatal(err) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if err := ssh.EnsureHostKey(app.Server); err != nil { | 	if err := ssh.EnsureHostKey(app.Server); err != nil { | ||||||
| 		logrus.Fatal(err) | 		logrus.Fatal(err) | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -7,6 +7,7 @@ import ( | |||||||
| 	"coopcloud.tech/abra/cli/internal" | 	"coopcloud.tech/abra/cli/internal" | ||||||
| 	"coopcloud.tech/abra/pkg/autocomplete" | 	"coopcloud.tech/abra/pkg/autocomplete" | ||||||
| 	"coopcloud.tech/abra/pkg/lint" | 	"coopcloud.tech/abra/pkg/lint" | ||||||
|  | 	recipePkg "coopcloud.tech/abra/pkg/recipe" | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| 	"github.com/urfave/cli/v2" | 	"github.com/urfave/cli/v2" | ||||||
| ) | ) | ||||||
| @ -21,6 +22,10 @@ var recipeLintCommand = &cli.Command{ | |||||||
| 	Action: func(c *cli.Context) error { | 	Action: func(c *cli.Context) error { | ||||||
| 		recipe := internal.ValidateRecipe(c) | 		recipe := internal.ValidateRecipe(c) | ||||||
|  |  | ||||||
|  | 		if err := recipePkg.EnsureUpToDate(recipe.Name); err != nil { | ||||||
|  | 			logrus.Fatal(err) | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		tableCol := []string{"ref", "rule", "satisfied", "severity", "resolve"} | 		tableCol := []string{"ref", "rule", "satisfied", "severity", "resolve"} | ||||||
| 		table := formatter.CreateTable(tableCol) | 		table := formatter.CreateTable(tableCol) | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user