big refactor
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
2024-06-24 23:20:54 +02:00
parent b688ddc4b1
commit cbab9b5907
27 changed files with 411 additions and 324 deletions

View File

@ -62,28 +62,32 @@ recipes.
logrus.Fatal("cannot use <version> and --chaos together")
}
if !internal.Chaos {
if err := recipe.EnsureIsClean(app.Recipe); err != nil {
logrus.Fatal(err)
}
if !internal.Offline {
if err := recipe.EnsureUpToDate(app.Recipe); err != nil {
logrus.Fatal(err)
}
}
if err := recipe.EnsureLatest(app.Recipe); err != nil {
logrus.Fatal(err)
}
}
recipe, err := recipePkg.Get(app.Recipe, internal.Offline)
r, err := recipe.Get(app.Recipe)
if err != nil {
logrus.Fatal(err)
}
if err := lint.LintForErrors(recipe); err != nil {
if !internal.Chaos {
if err := r.EnsureIsClean(); err != nil {
logrus.Fatal(err)
}
if !internal.Offline {
if err := r.EnsureUpToDate(); err != nil {
logrus.Fatal(err)
}
}
if err := r.EnsureLatest(); err != nil {
logrus.Fatal(err)
}
}
if err := r.LoadConfig(); err != nil {
logrus.Fatal(err)
}
if err := lint.LintForErrors(r); err != nil {
logrus.Fatal(err)
}
@ -115,7 +119,7 @@ recipes.
if len(versions) == 0 && !internal.Chaos {
logrus.Warn("no published versions in catalogue, trying local recipe repository")
recipeVersions, err := recipePkg.GetRecipeVersions(app.Recipe, internal.Offline)
recipeVersions, err := r.GetVersions(internal.Offline)
if err != nil {
logrus.Warn(err)
}
@ -217,7 +221,7 @@ recipes.
}
if !internal.Chaos {
if err := recipePkg.EnsureVersion(app.Recipe, chosenUpgrade); err != nil {
if err := r.EnsureVersion(chosenUpgrade); err != nil {
logrus.Fatal(err)
}
}
@ -225,13 +229,13 @@ recipes.
if internal.Chaos {
logrus.Warn("chaos mode engaged")
var err error
chosenUpgrade, err = recipePkg.ChaosVersion(app.Recipe)
chosenUpgrade, err = r.ChaosVersion()
if err != nil {
logrus.Fatal(err)
}
}
abraShPath := fmt.Sprintf("%s/%s/%s", config.RECIPES_DIR, app.Recipe, "abra.sh")
abraShPath := fmt.Sprintf("%s/%s/%s", r.Dir, "abra.sh")
abraShEnv, err := config.ReadAbraShEnvVars(abraShPath)
if err != nil {
logrus.Fatal(err)