forked from toolshed/abra
refactor(recipe): use method or variable for .env.sample
This commit is contained in:
@ -12,6 +12,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/git"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@ -55,6 +56,7 @@ recipe and domain in the sample environment config).
|
||||
`,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipeName := c.Args().First()
|
||||
r := recipe.Get2(recipeName)
|
||||
|
||||
if recipeName == "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("no recipe name provided"))
|
||||
@ -80,7 +82,7 @@ recipe and domain in the sample environment config).
|
||||
|
||||
toParse := []string{
|
||||
path.Join(config.RECIPES_DIR, recipeName, "README.md"),
|
||||
path.Join(config.RECIPES_DIR, recipeName, ".env.sample"),
|
||||
r.SampleEnvPath,
|
||||
}
|
||||
for _, path := range toParse {
|
||||
tpl, err := template.ParseFiles(path)
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
gitPkg "coopcloud.tech/abra/pkg/git"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
||||
"coopcloud.tech/tagcmp"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/go-git/go-git/v5"
|
||||
@ -44,6 +45,7 @@ local file system.
|
||||
BashComplete: autocomplete.RecipeNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipe := internal.ValidateRecipe(c)
|
||||
r := recipePkg.Get2(recipe.Name)
|
||||
|
||||
mainApp, err := internal.GetMainAppImage(recipe)
|
||||
if err != nil {
|
||||
@ -192,7 +194,7 @@ likely to change.
|
||||
mainService := "app"
|
||||
label := fmt.Sprintf("coop-cloud.${STACK_NAME}.version=%s", nextTag)
|
||||
if !internal.Dry {
|
||||
if err := recipe.UpdateLabel("compose.y*ml", mainService, label); err != nil {
|
||||
if err := r.UpdateLabel("compose.y*ml", mainService, label); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
} else {
|
||||
|
@ -294,7 +294,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
||||
}
|
||||
}
|
||||
if upgradeTag != "skip" {
|
||||
ok, err := recipe.UpdateTag(image, upgradeTag)
|
||||
ok, err := r.UpdateTag(image, upgradeTag)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@ -42,16 +42,16 @@ var recipeVersionCommand = cli.Command{
|
||||
|
||||
catl, err := recipePkg.ReadRecipeCatalogue(internal.Offline)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
recipeMeta, ok := catl[recipe.Name]
|
||||
if !ok {
|
||||
log.Fatalf("%s is not published on the catalogue?", recipe.Name)
|
||||
logrus.Fatalf("%s is not published on the catalogue?", recipe.Name)
|
||||
}
|
||||
|
||||
if len(recipeMeta.Versions) == 0 {
|
||||
log.Fatalf("%s has no catalogue published versions?", recipe.Name)
|
||||
logrus.Fatalf("%s has no catalogue published versions?", recipe.Name)
|
||||
}
|
||||
|
||||
tableCols := []string{"version", "service", "image", "tag"}
|
||||
|
Reference in New Issue
Block a user