feat: version arguments, local tag lookups & release notes
See: * coop-cloud/organising#441 * coop-cloud/organising#204 * coop-cloud/organising#493
This commit is contained in:
@ -23,7 +23,7 @@ var appDeployCommand = cli.Command{
|
||||
Name: "deploy",
|
||||
Aliases: []string{"d"},
|
||||
Usage: "Deploy an app",
|
||||
ArgsUsage: "<domain>",
|
||||
ArgsUsage: "<domain> [<version>]",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
@ -99,9 +99,17 @@ recipes.
|
||||
}
|
||||
}
|
||||
|
||||
isLatestHash := false
|
||||
version := deployedVersion
|
||||
if !internal.Chaos {
|
||||
specificVersion := c.Args().Get(1)
|
||||
if specificVersion != "" {
|
||||
version = specificVersion
|
||||
logrus.Debugf("choosing %s as version to deploy", version)
|
||||
if err := recipe.EnsureVersion(app.Recipe, version); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if !internal.Chaos && specificVersion == "" {
|
||||
catl, err := recipe.ReadRecipeCatalogue(internal.Offline)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
@ -110,7 +118,21 @@ recipes.
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
if len(versions) > 0 {
|
||||
|
||||
if len(versions) == 0 && !internal.Chaos {
|
||||
logrus.Warn("no published versions in catalogue, trying local recipe repository")
|
||||
recipeVersions, err := recipe.GetRecipeVersions(app.Recipe, internal.Offline)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
for _, recipeVersion := range recipeVersions {
|
||||
for version := range recipeVersion {
|
||||
versions = append(versions, version)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(versions) > 0 && !internal.Chaos {
|
||||
version = versions[len(versions)-1]
|
||||
logrus.Debugf("choosing %s as version to deploy", version)
|
||||
if err := recipe.EnsureVersion(app.Recipe, version); err != nil {
|
||||
@ -121,19 +143,11 @@ recipes.
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
isLatestHash = true
|
||||
version = formatter.SmallSHA(head.String())
|
||||
logrus.Warn("no versions detected, using latest commit")
|
||||
}
|
||||
}
|
||||
|
||||
if version != "unknown" && !internal.Chaos && !isLatestHash {
|
||||
logrus.Debugf("choosing %s as version to deploy", version)
|
||||
if err := recipe.EnsureVersion(app.Recipe, version); err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if internal.Chaos {
|
||||
logrus.Warnf("chaos mode engaged")
|
||||
var err error
|
||||
|
Reference in New Issue
Block a user