forked from toolshed/abra
refactor: create compose package
This commit is contained in:
@ -8,8 +8,9 @@ import (
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/catalogue"
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/client/stack"
|
||||
"coopcloud.tech/abra/pkg/compose"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"coopcloud.tech/tagcmp"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/docker/distribution/reference"
|
||||
@ -35,25 +36,15 @@ This is step 1 of upgrading a recipe. Step 2 is running "abra recipe sync
|
||||
`,
|
||||
ArgsUsage: "<recipe>",
|
||||
Action: func(c *cli.Context) error {
|
||||
recipe := internal.ValidateRecipe(c)
|
||||
recipeName := internal.ValidateRecipe(c)
|
||||
|
||||
appFiles, err := config.LoadAppFiles("")
|
||||
composeConfig, err := recipe.GetComposeConfig(recipeName)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
appEnv, err := config.GetApp(appFiles, recipe)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
compose, err := config.GetAppComposeConfig(recipe, stack.Deploy{}, appEnv.Env)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
for _, service := range compose.Services {
|
||||
catlVersions, err := catalogue.VersionsOfService(recipe, service.Name)
|
||||
for _, service := range composeConfig.Services {
|
||||
catlVersions, err := catalogue.VersionsOfService(recipeName, service.Name)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
@ -138,7 +129,8 @@ This is step 1 of upgrading a recipe. Step 2 is running "abra recipe sync
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
if err := config.UpdateAppComposeTag(recipe, image, upgradeTag, appEnv.Env); err != nil {
|
||||
pattern := fmt.Sprintf("%s/%s/compose**yml", config.APPS_DIR, recipeName)
|
||||
if err := compose.UpdateTag(pattern, image, upgradeTag); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user