refactor(recipe): remove remaining usage of old recipe struct
This commit is contained in:
parent
c1b03bcbd7
commit
5617a9ba07
@ -7,7 +7,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/autocomplete"
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
"coopcloud.tech/abra/pkg/client"
|
"coopcloud.tech/abra/pkg/client"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,8 +46,7 @@ var appBackupListCommand = cli.Command{
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,24 +92,23 @@ var appBackupDownloadCommand = cli.Command{
|
|||||||
BashComplete: autocomplete.AppNameComplete,
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
if err := r.EnsureExists(); err != nil {
|
if err := app.Recipe.EnsureExists(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureIsClean(); err != nil {
|
if err := app.Recipe.EnsureIsClean(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Offline {
|
if !internal.Offline {
|
||||||
if err := r.EnsureUpToDate(); err != nil {
|
if err := app.Recipe.EnsureUpToDate(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.EnsureLatest(); err != nil {
|
if err := app.Recipe.EnsureLatest(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,24 +162,23 @@ var appBackupCreateCommand = cli.Command{
|
|||||||
BashComplete: autocomplete.AppNameComplete,
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
if err := r.EnsureExists(); err != nil {
|
if err := app.Recipe.EnsureExists(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureIsClean(); err != nil {
|
if err := app.Recipe.EnsureIsClean(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Offline {
|
if !internal.Offline {
|
||||||
if err := r.EnsureUpToDate(); err != nil {
|
if err := app.Recipe.EnsureUpToDate(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.EnsureLatest(); err != nil {
|
if err := app.Recipe.EnsureLatest(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,24 +220,23 @@ var appBackupSnapshotsCommand = cli.Command{
|
|||||||
BashComplete: autocomplete.AppNameComplete,
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
if err := r.EnsureExists(); err != nil {
|
if err := app.Recipe.EnsureExists(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureIsClean(); err != nil {
|
if err := app.Recipe.EnsureIsClean(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Offline {
|
if !internal.Offline {
|
||||||
if err := r.EnsureUpToDate(); err != nil {
|
if err := app.Recipe.EnsureUpToDate(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.EnsureLatest(); err != nil {
|
if err := app.Recipe.EnsureLatest(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/autocomplete"
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
"coopcloud.tech/abra/pkg/formatter"
|
"coopcloud.tech/abra/pkg/formatter"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,8 +36,7 @@ ${FOO:<default>} syntax). "check" does not confirm or deny this for you.`,
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +60,7 @@ Example:
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ Example:
|
|||||||
|
|
||||||
hasCmdArgs, parsedCmdArgs := parseCmdArgs(c.Args(), internal.LocalCmd)
|
hasCmdArgs, parsedCmdArgs := parseCmdArgs(c.Args(), internal.LocalCmd)
|
||||||
|
|
||||||
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
|
abraSh := path.Join(config.RECIPES_DIR, app.Recipe.Name, "abra.sh")
|
||||||
if _, err := os.Stat(abraSh); err != nil {
|
if _, err := os.Stat(abraSh); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
log.Fatalf("%s does not exist for %s?", abraSh, app.Name)
|
log.Fatalf("%s does not exist for %s?", abraSh, app.Name)
|
||||||
@ -85,7 +84,7 @@ Example:
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmdName := c.Args().Get(1)
|
cmdName := c.Args().Get(1)
|
||||||
if err := internal.EnsureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
if err := internal.EnsureCommand(abraSh, app.Recipe.Name, cmdName); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +122,7 @@ Example:
|
|||||||
targetServiceName := c.Args().Get(1)
|
targetServiceName := c.Args().Get(1)
|
||||||
|
|
||||||
cmdName := c.Args().Get(2)
|
cmdName := c.Args().Get(2)
|
||||||
if err := internal.EnsureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
if err := internal.EnsureCommand(abraSh, app.Recipe.Name, cmdName); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +58,11 @@ recipes.
|
|||||||
log.Fatal("cannot use <version> and --chaos together")
|
log.Fatal("cannot use <version> and --chaos together")
|
||||||
}
|
}
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := lint.LintForErrors(r); err != nil {
|
if err := lint.LintForErrors(app.Recipe); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ recipes.
|
|||||||
if specificVersion != "" {
|
if specificVersion != "" {
|
||||||
version = specificVersion
|
version = specificVersion
|
||||||
log.Debugf("choosing %s as version to deploy", version)
|
log.Debugf("choosing %s as version to deploy", version)
|
||||||
if err := r.EnsureVersion(version); err != nil {
|
if err := app.Recipe.EnsureVersion(version); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,14 +115,14 @@ recipes.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
versions, err := recipe.GetRecipeCatalogueVersions(app.Recipe, catl)
|
versions, err := recipe.GetRecipeCatalogueVersions(app.Recipe.Name, catl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(versions) == 0 && !internal.Chaos {
|
if len(versions) == 0 && !internal.Chaos {
|
||||||
log.Warn("no published versions in catalogue, trying local recipe repository")
|
log.Warn("no published versions in catalogue, trying local recipe repository")
|
||||||
recipeVersions, err := r.GetRecipeVersions(internal.Offline)
|
recipeVersions, err := app.Recipe.GetRecipeVersions(internal.Offline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
}
|
}
|
||||||
@ -137,11 +136,11 @@ recipes.
|
|||||||
if len(versions) > 0 && !internal.Chaos {
|
if len(versions) > 0 && !internal.Chaos {
|
||||||
version = versions[len(versions)-1]
|
version = versions[len(versions)-1]
|
||||||
log.Debugf("choosing %s as version to deploy", version)
|
log.Debugf("choosing %s as version to deploy", version)
|
||||||
if err := r.EnsureVersion(version); err != nil {
|
if err := app.Recipe.EnsureVersion(version); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
head, err := git.GetRecipeHead(app.Recipe)
|
head, err := git.GetRecipeHead(app.Recipe.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -153,7 +152,7 @@ recipes.
|
|||||||
if internal.Chaos {
|
if internal.Chaos {
|
||||||
log.Warnf("chaos mode engaged")
|
log.Warnf("chaos mode engaged")
|
||||||
var err error
|
var err error
|
||||||
version, err = r.ChaosVersion()
|
version, err = app.Recipe.ChaosVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -168,7 +167,7 @@ recipes.
|
|||||||
app.Env[k] = v
|
app.Env[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
composeFiles, err := app.Recipe.GetComposeFiles(app.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -186,7 +185,7 @@ recipes.
|
|||||||
}
|
}
|
||||||
|
|
||||||
appPkg.ExposeAllEnv(stackName, compose, app.Env)
|
appPkg.ExposeAllEnv(stackName, compose, app.Env)
|
||||||
appPkg.SetRecipeLabel(compose, stackName, app.Recipe)
|
appPkg.SetRecipeLabel(compose, stackName, app.Recipe.Name)
|
||||||
appPkg.SetChaosLabel(compose, stackName, internal.Chaos)
|
appPkg.SetChaosLabel(compose, stackName, internal.Chaos)
|
||||||
appPkg.SetChaosVersionLabel(compose, stackName, version)
|
appPkg.SetChaosVersionLabel(compose, stackName, version)
|
||||||
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
||||||
|
@ -16,28 +16,34 @@ import (
|
|||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var status bool
|
var (
|
||||||
var statusFlag = &cli.BoolFlag{
|
status bool
|
||||||
Name: "status, S",
|
statusFlag = &cli.BoolFlag{
|
||||||
Usage: "Show app deployment status",
|
Name: "status, S",
|
||||||
Destination: &status,
|
Usage: "Show app deployment status",
|
||||||
}
|
Destination: &status,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
var recipeFilter string
|
var (
|
||||||
var recipeFlag = &cli.StringFlag{
|
recipeFilter string
|
||||||
Name: "recipe, r",
|
recipeFlag = &cli.StringFlag{
|
||||||
Value: "",
|
Name: "recipe, r",
|
||||||
Usage: "Show apps of a specific recipe",
|
Value: "",
|
||||||
Destination: &recipeFilter,
|
Usage: "Show apps of a specific recipe",
|
||||||
}
|
Destination: &recipeFilter,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
var listAppServer string
|
var (
|
||||||
var listAppServerFlag = &cli.StringFlag{
|
listAppServer string
|
||||||
Name: "server, s",
|
listAppServerFlag = &cli.StringFlag{
|
||||||
Value: "",
|
Name: "server, s",
|
||||||
Usage: "Show apps of a specific server",
|
Value: "",
|
||||||
Destination: &listAppServer,
|
Usage: "Show apps of a specific server",
|
||||||
}
|
Destination: &listAppServer,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
type appStatus struct {
|
type appStatus struct {
|
||||||
Server string `json:"server"`
|
Server string `json:"server"`
|
||||||
@ -130,7 +136,7 @@ can take some time.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if app.Recipe == recipeFilter || recipeFilter == "" {
|
if app.Recipe.Name == recipeFilter || recipeFilter == "" {
|
||||||
if recipeFilter != "" {
|
if recipeFilter != "" {
|
||||||
// only count server if matches filter
|
// only count server if matches filter
|
||||||
totalServersCount++
|
totalServersCount++
|
||||||
@ -177,7 +183,7 @@ can take some time.
|
|||||||
|
|
||||||
var newUpdates []string
|
var newUpdates []string
|
||||||
if version != "unknown" {
|
if version != "unknown" {
|
||||||
updates, err := recipe.GetRecipeCatalogueVersions(app.Recipe, catl)
|
updates, err := recipe.GetRecipeCatalogueVersions(app.Recipe.Name, catl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -214,7 +220,7 @@ can take some time.
|
|||||||
}
|
}
|
||||||
|
|
||||||
appStats.Server = app.Server
|
appStats.Server = app.Server
|
||||||
appStats.Recipe = app.Recipe
|
appStats.Recipe = app.Recipe.Name
|
||||||
appStats.AppName = app.Name
|
appStats.AppName = app.Name
|
||||||
appStats.Domain = app.Domain
|
appStats.Domain = app.Domain
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/autocomplete"
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
"coopcloud.tech/abra/pkg/client"
|
"coopcloud.tech/abra/pkg/client"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"coopcloud.tech/abra/pkg/upstream/stack"
|
"coopcloud.tech/abra/pkg/upstream/stack"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
containerTypes "github.com/docker/docker/api/types/container"
|
containerTypes "github.com/docker/docker/api/types/container"
|
||||||
@ -38,9 +37,8 @@ var appLogsCommand = cli.Command{
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
stackName := app.StackName()
|
stackName := app.StackName()
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
if err := r.EnsureExists(); err != nil {
|
if err := app.Recipe.EnsureExists(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,21 +66,20 @@ var appNewCommand = cli.Command{
|
|||||||
},
|
},
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
recipe := internal.ValidateRecipe(c)
|
recipe := internal.ValidateRecipe(c)
|
||||||
r := recipePkg.Get2(recipe.Name)
|
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureIsClean(); err != nil {
|
if err := recipe.EnsureIsClean(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if !internal.Offline {
|
if !internal.Offline {
|
||||||
if err := r.EnsureUpToDate(); err != nil {
|
if err := recipe.EnsureUpToDate(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.Args().Get(1) == "" {
|
if c.Args().Get(1) == "" {
|
||||||
var version string
|
var version string
|
||||||
|
|
||||||
recipeVersions, err := r.GetRecipeVersions(internal.Offline)
|
recipeVersions, err := recipe.GetRecipeVersions(internal.Offline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -93,16 +92,16 @@ var appNewCommand = cli.Command{
|
|||||||
version = tag
|
version = tag
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.EnsureVersion(version); err != nil {
|
if err := recipe.EnsureVersion(version); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := r.EnsureLatest(); err != nil {
|
if err := recipe.EnsureLatest(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := r.EnsureVersion(c.Args().Get(1)); err != nil {
|
if err := recipe.EnsureVersion(c.Args().Get(1)); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +119,7 @@ var appNewCommand = cli.Command{
|
|||||||
log.Debugf("%s sanitised as %s for new app", internal.Domain, sanitisedAppName)
|
log.Debugf("%s sanitised as %s for new app", internal.Domain, sanitisedAppName)
|
||||||
|
|
||||||
if err := appPkg.TemplateAppEnvSample(
|
if err := appPkg.TemplateAppEnvSample(
|
||||||
r,
|
recipe,
|
||||||
internal.Domain,
|
internal.Domain,
|
||||||
internal.NewAppServer,
|
internal.NewAppServer,
|
||||||
internal.Domain,
|
internal.Domain,
|
||||||
@ -131,17 +130,17 @@ var appNewCommand = cli.Command{
|
|||||||
var secrets AppSecrets
|
var secrets AppSecrets
|
||||||
var secretTable *jsontable.JSONTable
|
var secretTable *jsontable.JSONTable
|
||||||
if internal.Secrets {
|
if internal.Secrets {
|
||||||
sampleEnv, err := r.SampleEnv()
|
sampleEnv, err := recipe.SampleEnv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles, err := r.GetComposeFiles(sampleEnv)
|
composeFiles, err := recipe.GetComposeFiles(sampleEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
secretsConfig, err := secret.ReadSecretsConfig(r.SampleEnvPath, composeFiles, appPkg.StackName(internal.Domain))
|
secretsConfig, err := secret.ReadSecretsConfig(recipe.SampleEnvPath, composeFiles, appPkg.StackName(internal.Domain))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -231,7 +230,7 @@ func createSecrets(cl *dockerClient.Client, secretsConfig map[string]secret.Secr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensureDomainFlag checks if the domain flag was used. if not, asks the user for it/
|
// ensureDomainFlag checks if the domain flag was used. if not, asks the user for it/
|
||||||
func ensureDomainFlag(recipe recipePkg.Recipe, server string) error {
|
func ensureDomainFlag(recipe recipePkg.Recipe2, server string) error {
|
||||||
if internal.Domain == "" && !internal.NoInput {
|
if internal.Domain == "" && !internal.NoInput {
|
||||||
prompt := &survey.Input{
|
prompt := &survey.Input{
|
||||||
Message: "Specify app domain",
|
Message: "Specify app domain",
|
||||||
|
@ -35,7 +35,6 @@ var appPsCommand = cli.Command{
|
|||||||
BashComplete: autocomplete.AppNameComplete,
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
cl, err := client.New(app.Server)
|
cl, err := client.New(app.Server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -54,7 +53,7 @@ var appPsCommand = cli.Command{
|
|||||||
statuses, err := appPkg.GetAppStatuses([]appPkg.App{app}, true)
|
statuses, err := appPkg.GetAppStatuses([]appPkg.App{app}, true)
|
||||||
if statusMeta, ok := statuses[app.StackName()]; ok {
|
if statusMeta, ok := statuses[app.StackName()]; ok {
|
||||||
if _, exists := statusMeta["chaos"]; !exists {
|
if _, exists := statusMeta["chaos"]; !exists {
|
||||||
if err := r.EnsureVersion(deployedVersion); err != nil {
|
if err := app.Recipe.EnsureVersion(deployedVersion); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/autocomplete"
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
"coopcloud.tech/abra/pkg/client"
|
"coopcloud.tech/abra/pkg/client"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -33,8 +32,7 @@ var appRestoreCommand = cli.Command{
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +58,11 @@ recipes.
|
|||||||
log.Fatal("cannot use <version> and --chaos together")
|
log.Fatal("cannot use <version> and --chaos together")
|
||||||
}
|
}
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := lint.LintForErrors(r); err != nil {
|
if err := lint.LintForErrors(app.Recipe); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,14 +87,14 @@ recipes.
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
versions, err := recipe.GetRecipeCatalogueVersions(app.Recipe, catl)
|
versions, err := recipe.GetRecipeCatalogueVersions(app.Recipe.Name, catl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(versions) == 0 && !internal.Chaos {
|
if len(versions) == 0 && !internal.Chaos {
|
||||||
log.Warn("no published versions in catalogue, trying local recipe repository")
|
log.Warn("no published versions in catalogue, trying local recipe repository")
|
||||||
recipeVersions, err := r.GetRecipeVersions(internal.Offline)
|
recipeVersions, err := app.Recipe.GetRecipeVersions(internal.Offline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
}
|
}
|
||||||
@ -165,7 +164,7 @@ recipes.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureVersion(chosenDowngrade); err != nil {
|
if err := app.Recipe.EnsureVersion(chosenDowngrade); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +172,7 @@ recipes.
|
|||||||
if internal.Chaos {
|
if internal.Chaos {
|
||||||
log.Warn("chaos mode engaged")
|
log.Warn("chaos mode engaged")
|
||||||
var err error
|
var err error
|
||||||
chosenDowngrade, err = r.ChaosVersion()
|
chosenDowngrade, err = app.Recipe.ChaosVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -188,7 +187,7 @@ recipes.
|
|||||||
app.Env[k] = v
|
app.Env[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
composeFiles, err := app.Recipe.GetComposeFiles(app.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -204,7 +203,7 @@ recipes.
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
appPkg.ExposeAllEnv(stackName, compose, app.Env)
|
appPkg.ExposeAllEnv(stackName, compose, app.Env)
|
||||||
appPkg.SetRecipeLabel(compose, stackName, app.Recipe)
|
appPkg.SetRecipeLabel(compose, stackName, app.Recipe.Name)
|
||||||
appPkg.SetChaosLabel(compose, stackName, internal.Chaos)
|
appPkg.SetChaosLabel(compose, stackName, internal.Chaos)
|
||||||
appPkg.SetChaosVersionLabel(compose, stackName, chosenDowngrade)
|
appPkg.SetChaosVersionLabel(compose, stackName, chosenDowngrade)
|
||||||
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/client"
|
"coopcloud.tech/abra/pkg/client"
|
||||||
"coopcloud.tech/abra/pkg/formatter"
|
"coopcloud.tech/abra/pkg/formatter"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"coopcloud.tech/abra/pkg/secret"
|
"coopcloud.tech/abra/pkg/secret"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
dockerClient "github.com/docker/docker/client"
|
dockerClient "github.com/docker/docker/client"
|
||||||
@ -57,8 +56,7 @@ var appSecretGenerateCommand = cli.Command{
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ var appSecretGenerateCommand = cli.Command{
|
|||||||
internal.ShowSubcommandHelpAndError(c, err)
|
internal.ShowSubcommandHelpAndError(c, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
composeFiles, err := app.Recipe.GetComposeFiles(app.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -248,29 +246,28 @@ Example:
|
|||||||
`,
|
`,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
if err := r.EnsureExists(); err != nil {
|
if err := app.Recipe.EnsureExists(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureIsClean(); err != nil {
|
if err := app.Recipe.EnsureIsClean(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Offline {
|
if !internal.Offline {
|
||||||
if err := r.EnsureUpToDate(); err != nil {
|
if err := app.Recipe.EnsureUpToDate(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.EnsureLatest(); err != nil {
|
if err := app.Recipe.EnsureLatest(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
composeFiles, err := app.Recipe.GetComposeFiles(app.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -357,24 +354,23 @@ var appSecretLsCommand = cli.Command{
|
|||||||
BashComplete: autocomplete.AppNameComplete,
|
BashComplete: autocomplete.AppNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
app := internal.ValidateApp(c)
|
app := internal.ValidateApp(c)
|
||||||
r := recipe.Get2(app.Recipe)
|
|
||||||
|
|
||||||
if err := r.EnsureExists(); err != nil {
|
if err := app.Recipe.EnsureExists(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureIsClean(); err != nil {
|
if err := app.Recipe.EnsureIsClean(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Offline {
|
if !internal.Offline {
|
||||||
if err := r.EnsureUpToDate(); err != nil {
|
if err := app.Recipe.EnsureUpToDate(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.EnsureLatest(); err != nil {
|
if err := app.Recipe.EnsureLatest(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/envfile"
|
"coopcloud.tech/abra/pkg/envfile"
|
||||||
"coopcloud.tech/abra/pkg/lint"
|
"coopcloud.tech/abra/pkg/lint"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
|
||||||
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
||||||
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
||||||
"coopcloud.tech/tagcmp"
|
"coopcloud.tech/tagcmp"
|
||||||
@ -64,13 +63,11 @@ recipes.
|
|||||||
log.Fatal("cannot use <version> and --chaos together")
|
log.Fatal("cannot use <version> and --chaos together")
|
||||||
}
|
}
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
if err := app.Recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
r2 := recipePkg.Get2(app.Recipe)
|
if err := lint.LintForErrors(app.Recipe); err != nil {
|
||||||
if err := lint.LintForErrors(r2); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,14 +92,14 @@ recipes.
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
versions, err := recipePkg.GetRecipeCatalogueVersions(app.Recipe, catl)
|
versions, err := recipePkg.GetRecipeCatalogueVersions(app.Recipe.Name, catl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(versions) == 0 && !internal.Chaos {
|
if len(versions) == 0 && !internal.Chaos {
|
||||||
log.Warn("no published versions in catalogue, trying local recipe repository")
|
log.Warn("no published versions in catalogue, trying local recipe repository")
|
||||||
recipeVersions, err := r2.GetRecipeVersions(internal.Offline)
|
recipeVersions, err := app.Recipe.GetRecipeVersions(internal.Offline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
}
|
}
|
||||||
@ -192,7 +189,7 @@ recipes.
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if parsedVersion.IsGreaterThan(parsedDeployedVersion) && parsedVersion.IsLessThan(parsedChosenUpgrade) {
|
if parsedVersion.IsGreaterThan(parsedDeployedVersion) && parsedVersion.IsLessThan(parsedChosenUpgrade) {
|
||||||
note, err := internal.GetReleaseNotes(app.Recipe, version)
|
note, err := internal.GetReleaseNotes(app.Recipe.Name, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -204,7 +201,7 @@ recipes.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !internal.Chaos {
|
if !internal.Chaos {
|
||||||
if err := r.EnsureVersion(chosenUpgrade); err != nil {
|
if err := app.Recipe.EnsureVersion(chosenUpgrade); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +209,7 @@ recipes.
|
|||||||
if internal.Chaos {
|
if internal.Chaos {
|
||||||
log.Warn("chaos mode engaged")
|
log.Warn("chaos mode engaged")
|
||||||
var err error
|
var err error
|
||||||
chosenUpgrade, err = r.ChaosVersion()
|
chosenUpgrade, err = app.Recipe.ChaosVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -227,7 +224,7 @@ recipes.
|
|||||||
app.Env[k] = v
|
app.Env[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
composeFiles, err := app.Recipe.GetComposeFiles(app.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -243,7 +240,7 @@ recipes.
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
appPkg.ExposeAllEnv(stackName, compose, app.Env)
|
appPkg.ExposeAllEnv(stackName, compose, app.Env)
|
||||||
appPkg.SetRecipeLabel(compose, stackName, app.Recipe)
|
appPkg.SetRecipeLabel(compose, stackName, app.Recipe.Name)
|
||||||
appPkg.SetChaosLabel(compose, stackName, internal.Chaos)
|
appPkg.SetChaosLabel(compose, stackName, internal.Chaos)
|
||||||
appPkg.SetChaosVersionLabel(compose, stackName, chosenUpgrade)
|
appPkg.SetChaosVersionLabel(compose, stackName, chosenUpgrade)
|
||||||
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
||||||
|
@ -78,7 +78,7 @@ var appVersionCommand = cli.Command{
|
|||||||
log.Fatalf("failed to determine version of deployed %s", app.Name)
|
log.Fatalf("failed to determine version of deployed %s", app.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeMeta, err := recipe.GetRecipeMeta(app.Recipe, internal.Offline)
|
recipeMeta, err := recipe.GetRecipeMeta(app.Recipe.Name, internal.Offline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func NewVersionOverview(app appPkg.App, currentVersion, newVersion, releaseNotes
|
|||||||
server = "local"
|
server = "local"
|
||||||
}
|
}
|
||||||
|
|
||||||
table.Append([]string{server, app.Recipe, deployConfig, app.Domain, currentVersion, newVersion})
|
table.Append([]string{server, app.Recipe.Name, deployConfig, app.Domain, currentVersion, newVersion})
|
||||||
table.Render()
|
table.Render()
|
||||||
|
|
||||||
if releaseNotes != "" && newVersion != "" {
|
if releaseNotes != "" && newVersion != "" {
|
||||||
@ -84,7 +84,7 @@ func GetReleaseNotes(recipeName, version string) (string, error) {
|
|||||||
// the commands string must have the following format:
|
// the commands string must have the following format:
|
||||||
// "<service> <command> <arguments>|<service> <command> <arguments>|... "
|
// "<service> <command> <arguments>|<service> <command> <arguments>|... "
|
||||||
func PostCmds(cl *dockerClient.Client, app appPkg.App, commands string) error {
|
func PostCmds(cl *dockerClient.Client, app appPkg.App, commands string) error {
|
||||||
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
|
abraSh := path.Join(config.RECIPES_DIR, app.Recipe.Name, "abra.sh")
|
||||||
if _, err := os.Stat(abraSh); err != nil {
|
if _, err := os.Stat(abraSh); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return fmt.Errorf(fmt.Sprintf("%s does not exist for %s?", abraSh, app.Name))
|
return fmt.Errorf(fmt.Sprintf("%s does not exist for %s?", abraSh, app.Name))
|
||||||
@ -105,7 +105,7 @@ func PostCmds(cl *dockerClient.Client, app appPkg.App, commands string) error {
|
|||||||
}
|
}
|
||||||
log.Infof("running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)
|
log.Infof("running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)
|
||||||
|
|
||||||
if err := EnsureCommand(abraSh, app.Recipe, cmdName); err != nil {
|
if err := EnsureCommand(abraSh, app.Recipe.Name, cmdName); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ func DeployOverview(app appPkg.App, version, message string) error {
|
|||||||
server = "local"
|
server = "local"
|
||||||
}
|
}
|
||||||
|
|
||||||
table.Append([]string{server, app.Recipe, deployConfig, app.Domain, version})
|
table.Append([]string{server, app.Recipe.Name, deployConfig, app.Domain, version})
|
||||||
table.Render()
|
table.Render()
|
||||||
|
|
||||||
if NoInput {
|
if NoInput {
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ValidateRecipe ensures the recipe arg is valid.
|
// ValidateRecipe ensures the recipe arg is valid.
|
||||||
func ValidateRecipe(c *cli.Context) recipe.Recipe {
|
func ValidateRecipe(c *cli.Context) recipe.Recipe2 {
|
||||||
recipeName := c.Args().First()
|
recipeName := c.Args().First()
|
||||||
|
|
||||||
if recipeName == "" && !NoInput {
|
if recipeName == "" && !NoInput {
|
||||||
@ -57,7 +57,12 @@ func ValidateRecipe(c *cli.Context) recipe.Recipe {
|
|||||||
ShowSubcommandHelpAndError(c, errors.New("no recipe name provided"))
|
ShowSubcommandHelpAndError(c, errors.New("no recipe name provided"))
|
||||||
}
|
}
|
||||||
|
|
||||||
chosenRecipe, err := recipe.Get(recipeName, Offline)
|
chosenRecipe := recipe.Get2(recipeName)
|
||||||
|
err := chosenRecipe.EnsureExists()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
_, err = chosenRecipe.GetComposeConfig(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.Command.Name == "generate" {
|
if c.Command.Name == "generate" {
|
||||||
if strings.Contains(err.Error(), "missing a compose") {
|
if strings.Contains(err.Error(), "missing a compose") {
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/formatter"
|
"coopcloud.tech/abra/pkg/formatter"
|
||||||
"coopcloud.tech/abra/pkg/lint"
|
"coopcloud.tech/abra/pkg/lint"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,8 +28,7 @@ var recipeLintCommand = cli.Command{
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
recipe := internal.ValidateRecipe(c)
|
recipe := internal.ValidateRecipe(c)
|
||||||
|
|
||||||
r := recipePkg.Get2(recipe.Name)
|
if err := recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +45,7 @@ var recipeLintCommand = cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
skipped := false
|
skipped := false
|
||||||
if rule.Skip(r) {
|
if rule.Skip(recipe) {
|
||||||
skipped = true
|
skipped = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +56,7 @@ var recipeLintCommand = cli.Command{
|
|||||||
|
|
||||||
satisfied := false
|
satisfied := false
|
||||||
if !skipped {
|
if !skipped {
|
||||||
ok, err := rule.Function(r)
|
ok, err := rule.Function(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
gitPkg "coopcloud.tech/abra/pkg/git"
|
gitPkg "coopcloud.tech/abra/pkg/git"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
"coopcloud.tech/abra/pkg/recipe"
|
"coopcloud.tech/abra/pkg/recipe"
|
||||||
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"coopcloud.tech/tagcmp"
|
"coopcloud.tech/tagcmp"
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
@ -63,14 +62,13 @@ your SSH keys configured on your account.
|
|||||||
BashComplete: autocomplete.RecipeNameComplete,
|
BashComplete: autocomplete.RecipeNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
recipe := internal.ValidateRecipe(c)
|
recipe := internal.ValidateRecipe(c)
|
||||||
r := recipePkg.Get2(recipe.Name)
|
|
||||||
|
|
||||||
imagesTmp, err := getImageVersions(r)
|
imagesTmp, err := getImageVersions(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mainApp, err := internal.GetMainAppImage(r)
|
mainApp, err := internal.GetMainAppImage(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -92,45 +90,45 @@ your SSH keys configured on your account.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if tagString != "" {
|
if tagString != "" {
|
||||||
if err := createReleaseFromTag(r, tagString, mainAppVersion); err != nil {
|
if err := createReleaseFromTag(recipe, tagString, mainAppVersion); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tags, err := r.Tags()
|
tags, err := recipe.Tags()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if tagString == "" && (!internal.Major && !internal.Minor && !internal.Patch) {
|
if tagString == "" && (!internal.Major && !internal.Minor && !internal.Patch) {
|
||||||
var err error
|
var err error
|
||||||
tagString, err = getLabelVersion(r, false)
|
tagString, err = getLabelVersion(recipe, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isClean, err := gitPkg.IsClean(r.Dir)
|
isClean, err := gitPkg.IsClean(recipe.Dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isClean {
|
if !isClean {
|
||||||
log.Infof("%s currently has these unstaged changes 👇", recipe.Name)
|
log.Infof("%s currently has these unstaged changes 👇", recipe.Name)
|
||||||
if err := gitPkg.DiffUnstaged(r.Dir); err != nil {
|
if err := gitPkg.DiffUnstaged(recipe.Dir); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(tags) > 0 {
|
if len(tags) > 0 {
|
||||||
logrus.Warnf("previous git tags detected, assuming this is a new semver release")
|
logrus.Warnf("previous git tags detected, assuming this is a new semver release")
|
||||||
if err := createReleaseFromPreviousTag(tagString, mainAppVersion, r, tags); err != nil {
|
if err := createReleaseFromPreviousTag(tagString, mainAppVersion, recipe, tags); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Warnf("no tag specified and no previous tag available for %s, assuming this is the initial release", recipe.Name)
|
log.Warnf("no tag specified and no previous tag available for %s, assuming this is the initial release", recipe.Name)
|
||||||
|
|
||||||
if err := createReleaseFromTag(r, tagString, mainAppVersion); err != nil {
|
if err := createReleaseFromTag(recipe, tagString, mainAppVersion); err != nil {
|
||||||
if cleanUpErr := cleanUpTag(tagString, recipe.Name); err != nil {
|
if cleanUpErr := cleanUpTag(tagString, recipe.Name); err != nil {
|
||||||
log.Fatal(cleanUpErr)
|
log.Fatal(cleanUpErr)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/config"
|
"coopcloud.tech/abra/pkg/config"
|
||||||
gitPkg "coopcloud.tech/abra/pkg/git"
|
gitPkg "coopcloud.tech/abra/pkg/git"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
recipePkg "coopcloud.tech/abra/pkg/recipe"
|
|
||||||
"coopcloud.tech/tagcmp"
|
"coopcloud.tech/tagcmp"
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
@ -45,21 +44,20 @@ local file system.
|
|||||||
BashComplete: autocomplete.RecipeNameComplete,
|
BashComplete: autocomplete.RecipeNameComplete,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
recipe := internal.ValidateRecipe(c)
|
recipe := internal.ValidateRecipe(c)
|
||||||
r := recipePkg.Get2(recipe.Name)
|
|
||||||
|
|
||||||
mainApp, err := internal.GetMainAppImage(r)
|
mainApp, err := internal.GetMainAppImage(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
imagesTmp, err := getImageVersions(r)
|
imagesTmp, err := getImageVersions(recipe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mainAppVersion := imagesTmp[mainApp]
|
mainAppVersion := imagesTmp[mainApp]
|
||||||
|
|
||||||
tags, err := r.Tags()
|
tags, err := recipe.Tags()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -194,20 +192,20 @@ likely to change.
|
|||||||
mainService := "app"
|
mainService := "app"
|
||||||
label := fmt.Sprintf("coop-cloud.${STACK_NAME}.version=%s", nextTag)
|
label := fmt.Sprintf("coop-cloud.${STACK_NAME}.version=%s", nextTag)
|
||||||
if !internal.Dry {
|
if !internal.Dry {
|
||||||
if err := r.UpdateLabel("compose.y*ml", mainService, label); err != nil {
|
if err := recipe.UpdateLabel("compose.y*ml", mainService, label); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Infof("dry run: not syncing label %s for recipe %s", nextTag, recipe.Name)
|
log.Infof("dry run: not syncing label %s for recipe %s", nextTag, recipe.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
isClean, err := gitPkg.IsClean(r.Dir)
|
isClean, err := gitPkg.IsClean(recipe.Dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
if !isClean {
|
if !isClean {
|
||||||
log.Infof("%s currently has these unstaged changes 👇", recipe.Name)
|
log.Infof("%s currently has these unstaged changes 👇", recipe.Name)
|
||||||
if err := gitPkg.DiffUnstaged(r.Dir); err != nil {
|
if err := gitPkg.DiffUnstaged(recipe.Dir); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
recipe := internal.ValidateRecipe(c)
|
recipe := internal.ValidateRecipe(c)
|
||||||
|
|
||||||
r := recipePkg.Get2(recipe.Name)
|
if err := recipe.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +96,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
versionsPresent := false
|
versionsPresent := false
|
||||||
recipeDir := path.Join(config.RECIPES_DIR, recipe.Name)
|
recipeDir := path.Join(config.RECIPES_DIR, recipe.Name)
|
||||||
versionsPath := path.Join(recipeDir, "versions")
|
versionsPath := path.Join(recipeDir, "versions")
|
||||||
var servicePins = make(map[string]imgPin)
|
servicePins := make(map[string]imgPin)
|
||||||
if _, err := os.Stat(versionsPath); err == nil {
|
if _, err := os.Stat(versionsPath); err == nil {
|
||||||
log.Debugf("found versions file for %s", recipe.Name)
|
log.Debugf("found versions file for %s", recipe.Name)
|
||||||
file, err := os.Open(versionsPath)
|
file, err := os.Open(versionsPath)
|
||||||
@ -130,7 +129,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
log.Debugf("did not find versions file for %s", recipe.Name)
|
log.Debugf("did not find versions file for %s", recipe.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
config, err := r.GetComposeConfig(nil)
|
config, err := recipe.GetComposeConfig(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -299,7 +298,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if upgradeTag != "skip" {
|
if upgradeTag != "skip" {
|
||||||
ok, err := r.UpdateTag(image, upgradeTag)
|
ok, err := recipe.UpdateTag(image, upgradeTag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ func upgrade(cl *dockerclient.Client, stackName, recipeName,
|
|||||||
|
|
||||||
app := appPkg.App{
|
app := appPkg.App{
|
||||||
Name: stackName,
|
Name: stackName,
|
||||||
Recipe: recipeName,
|
Recipe: recipe.Get2(recipeName),
|
||||||
Server: SERVER,
|
Server: SERVER,
|
||||||
Env: env,
|
Env: env,
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ func GetApps(appFiles AppFiles, recipeFilter string) ([]App, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if recipeFilter != "" {
|
if recipeFilter != "" {
|
||||||
if app.Recipe == recipeFilter {
|
if app.Recipe.Name == recipeFilter {
|
||||||
apps = append(apps, app)
|
apps = append(apps, app)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -84,7 +84,7 @@ func GetApps(appFiles AppFiles, recipeFilter string) ([]App, error) {
|
|||||||
// App reprents an app with its env file read into memory
|
// App reprents an app with its env file read into memory
|
||||||
type App struct {
|
type App struct {
|
||||||
Name AppName
|
Name AppName
|
||||||
Recipe string
|
Recipe recipe.Recipe2
|
||||||
Domain string
|
Domain string
|
||||||
Env envfile.AppEnv
|
Env envfile.AppEnv
|
||||||
Server string
|
Server string
|
||||||
@ -161,14 +161,13 @@ func (a App) Filters(appendServiceNames, exactMatch bool, services ...string) (f
|
|||||||
return filters, nil
|
return filters, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
r := recipe.Get2(a.Recipe)
|
composeFiles, err := a.Recipe.GetComposeFiles(a.Env)
|
||||||
composeFiles, err := r.GetComposeFiles(a.Env)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return filters, err
|
return filters, err
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := stack.Deploy{Composefiles: composeFiles}
|
opts := stack.Deploy{Composefiles: composeFiles}
|
||||||
compose, err := GetAppComposeConfig(a.Recipe, opts, a.Env)
|
compose, err := GetAppComposeConfig(a.Recipe.Name, opts, a.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return filters, err
|
return filters, err
|
||||||
}
|
}
|
||||||
@ -207,7 +206,7 @@ func (a ByServerAndRecipe) Len() int { return len(a) }
|
|||||||
func (a ByServerAndRecipe) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
func (a ByServerAndRecipe) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
func (a ByServerAndRecipe) Less(i, j int) bool {
|
func (a ByServerAndRecipe) Less(i, j int) bool {
|
||||||
if a[i].Server == a[j].Server {
|
if a[i].Server == a[j].Server {
|
||||||
return strings.ToLower(a[i].Recipe) < strings.ToLower(a[j].Recipe)
|
return strings.ToLower(a[i].Recipe.Name) < strings.ToLower(a[j].Recipe.Name)
|
||||||
}
|
}
|
||||||
return strings.ToLower(a[i].Server) < strings.ToLower(a[j].Server)
|
return strings.ToLower(a[i].Server) < strings.ToLower(a[j].Server)
|
||||||
}
|
}
|
||||||
@ -218,7 +217,7 @@ type ByRecipe []App
|
|||||||
func (a ByRecipe) Len() int { return len(a) }
|
func (a ByRecipe) Len() int { return len(a) }
|
||||||
func (a ByRecipe) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
func (a ByRecipe) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
func (a ByRecipe) Less(i, j int) bool {
|
func (a ByRecipe) Less(i, j int) bool {
|
||||||
return strings.ToLower(a[i].Recipe) < strings.ToLower(a[j].Recipe)
|
return strings.ToLower(a[i].Recipe.Name) < strings.ToLower(a[j].Recipe.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ByName sort a slice of Apps
|
// ByName sort a slice of Apps
|
||||||
@ -250,9 +249,9 @@ func ReadAppEnvFile(appFile AppFile, name AppName) (App, error) {
|
|||||||
func NewApp(env envfile.AppEnv, name string, appFile AppFile) (App, error) {
|
func NewApp(env envfile.AppEnv, name string, appFile AppFile) (App, error) {
|
||||||
domain := env["DOMAIN"]
|
domain := env["DOMAIN"]
|
||||||
|
|
||||||
recipe, exists := env["RECIPE"]
|
recipeName, exists := env["RECIPE"]
|
||||||
if !exists {
|
if !exists {
|
||||||
recipe, exists = env["TYPE"]
|
recipeName, exists = env["TYPE"]
|
||||||
if !exists {
|
if !exists {
|
||||||
return App{}, fmt.Errorf("%s is missing the TYPE env var?", name)
|
return App{}, fmt.Errorf("%s is missing the TYPE env var?", name)
|
||||||
}
|
}
|
||||||
@ -261,7 +260,7 @@ func NewApp(env envfile.AppEnv, name string, appFile AppFile) (App, error) {
|
|||||||
return App{
|
return App{
|
||||||
Name: name,
|
Name: name,
|
||||||
Domain: domain,
|
Domain: domain,
|
||||||
Recipe: recipe,
|
Recipe: recipe.Get2(recipeName),
|
||||||
Env: env,
|
Env: env,
|
||||||
Server: appFile.Server,
|
Server: appFile.Server,
|
||||||
Path: appFile.Path,
|
Path: appFile.Path,
|
||||||
@ -318,14 +317,13 @@ func GetAppServiceNames(appName string) ([]string, error) {
|
|||||||
return serviceNames, err
|
return serviceNames, err
|
||||||
}
|
}
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
composeFiles, err := app.Recipe.GetComposeFiles(app.Env)
|
||||||
composeFiles, err := r.GetComposeFiles(app.Env)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return serviceNames, err
|
return serviceNames, err
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := stack.Deploy{Composefiles: composeFiles}
|
opts := stack.Deploy{Composefiles: composeFiles}
|
||||||
compose, err := GetAppComposeConfig(app.Recipe, opts, app.Env)
|
compose, err := GetAppComposeConfig(app.Recipe.Name, opts, app.Env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return serviceNames, err
|
return serviceNames, err
|
||||||
}
|
}
|
||||||
@ -512,8 +510,7 @@ func ExposeAllEnv(stackName string, compose *composetypes.Config, appEnv envfile
|
|||||||
func CheckEnv(app App) ([]envfile.EnvVar, error) {
|
func CheckEnv(app App) ([]envfile.EnvVar, error) {
|
||||||
var envVars []envfile.EnvVar
|
var envVars []envfile.EnvVar
|
||||||
|
|
||||||
r := recipe.Get2(app.Recipe)
|
envSample, err := app.Recipe.SampleEnv()
|
||||||
envSample, err := r.SampleEnv()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return envVars, err
|
return envVars, err
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ func TestGetApp(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetComposeFiles(t *testing.T) {
|
func TestGetComposeFiles(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -95,8 +95,8 @@ func TestGetComposeFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetComposeFilesError(t *testing.T) {
|
func TestGetComposeFilesError(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ func TestReadEnv(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReadAbraShEnvVars(t *testing.T) {
|
func TestReadAbraShEnvVars(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -85,8 +85,8 @@ func TestReadAbraShEnvVars(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReadAbraShCmdNames(t *testing.T) {
|
func TestReadAbraShCmdNames(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -110,8 +110,8 @@ func TestReadAbraShCmdNames(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckEnv(t *testing.T) {
|
func TestCheckEnv(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ func TestCheckEnv(t *testing.T) {
|
|||||||
|
|
||||||
app := appPkg.App{
|
app := appPkg.App{
|
||||||
Name: "test-app",
|
Name: "test-app",
|
||||||
Recipe: r.Name,
|
Recipe: recipe.Get2(r.Name),
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Env: envSample,
|
Env: envSample,
|
||||||
Path: "example.com.env",
|
Path: "example.com.env",
|
||||||
@ -144,8 +144,8 @@ func TestCheckEnv(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckEnvError(t *testing.T) {
|
func TestCheckEnvError(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ func TestCheckEnvError(t *testing.T) {
|
|||||||
|
|
||||||
app := appPkg.App{
|
app := appPkg.App{
|
||||||
Name: "test-app",
|
Name: "test-app",
|
||||||
Recipe: r.Name,
|
Recipe: recipe.Get2(r.Name),
|
||||||
Domain: "example.com",
|
Domain: "example.com",
|
||||||
Env: envSample,
|
Env: envSample,
|
||||||
Path: "example.com.env",
|
Path: "example.com.env",
|
||||||
@ -180,8 +180,8 @@ func TestCheckEnvError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEnvVarCommentsRemoved(t *testing.T) {
|
func TestEnvVarCommentsRemoved(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -212,14 +212,13 @@ func TestEnvVarCommentsRemoved(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEnvVarModifiersIncluded(t *testing.T) {
|
func TestEnvVarModifiersIncluded(t *testing.T) {
|
||||||
offline := true
|
r := recipe.Get2("abra-test-recipe")
|
||||||
r, err := recipe.Get("abra-test-recipe", offline)
|
err := r.EnsureExists()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
r2 := recipe.Get2(r.Name)
|
envSample, modifiers, err := envfile.ReadEnvWithModifiers(r.SampleEnvPath)
|
||||||
envSample, modifiers, err := envfile.ReadEnvWithModifiers(r2.SampleEnvPath)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
appPkg "coopcloud.tech/abra/pkg/app"
|
appPkg "coopcloud.tech/abra/pkg/app"
|
||||||
"coopcloud.tech/abra/pkg/envfile"
|
"coopcloud.tech/abra/pkg/envfile"
|
||||||
"coopcloud.tech/abra/pkg/log"
|
"coopcloud.tech/abra/pkg/log"
|
||||||
|
"coopcloud.tech/abra/pkg/recipe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -32,7 +33,7 @@ var ExpectedAppEnv = envfile.AppEnv{
|
|||||||
|
|
||||||
var ExpectedApp = appPkg.App{
|
var ExpectedApp = appPkg.App{
|
||||||
Name: AppName,
|
Name: AppName,
|
||||||
Recipe: ExpectedAppEnv["RECIPE"],
|
Recipe: recipe.Get2(ExpectedAppEnv["RECIPE"]),
|
||||||
Domain: ExpectedAppEnv["DOMAIN"],
|
Domain: ExpectedAppEnv["DOMAIN"],
|
||||||
Env: ExpectedAppEnv,
|
Env: ExpectedAppEnv,
|
||||||
Path: ExpectedAppFile.Path,
|
Path: ExpectedAppFile.Path,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user