WIP: Initial stab at secrets/configs/images
This commit is contained in:
@ -22,6 +22,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/upstream/stack"
|
||||
dockerClient "github.com/docker/docker/client"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/docker/docker/api/types"
|
||||
)
|
||||
|
||||
// translators: `abra app deploy` aliases. use a comma separated list of aliases with
|
||||
@ -194,15 +195,49 @@ checkout as-is. Recipe commit hashes are also supported as values for
|
||||
deployedVersion = deployMeta.Version
|
||||
}
|
||||
|
||||
filters, err := app.Filters(false, false)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
secretList, err := cl.SecretList(context.Background(), types.SecretListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var secretStrings []string
|
||||
for _, cont := range secretList {
|
||||
secretStrings = append(secretStrings, cont.Spec.Name)
|
||||
}
|
||||
|
||||
configList, err := cl.ConfigList(context.Background(), types.ConfigListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var configStrings []string
|
||||
for _, config := range configList {
|
||||
configStrings = append(configStrings, config.Spec.Name)
|
||||
}
|
||||
|
||||
var imageStrings []string
|
||||
for _, service := range compose.Services {
|
||||
imageStrings = append(imageStrings, service.Image)
|
||||
}
|
||||
|
||||
if err := internal.DeployOverview(
|
||||
app,
|
||||
deployedVersion,
|
||||
toDeployVersion,
|
||||
"",
|
||||
deployWarnMessages,
|
||||
strings.Join(secretStrings, "\n"),
|
||||
strings.Join(configStrings, "\n"),
|
||||
strings.Join(imageStrings, "\n"),
|
||||
); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
|
||||
stack.WaitTimeout, err = appPkg.GetTimeoutFromLabel(compose, stackName)
|
||||
if err != nil {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
@ -19,6 +20,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@ -190,6 +192,36 @@ beforehand. See "abra app backup" for more.`),
|
||||
}
|
||||
appPkg.SetUpdateLabel(compose, stackName, app.Env)
|
||||
|
||||
filters, err := app.Filters(false, false)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
secretList, err := cl.SecretList(context.Background(), types.SecretListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var secretStrings []string
|
||||
for _, cont := range secretList {
|
||||
secretStrings = append(secretStrings, cont.Spec.Name)
|
||||
}
|
||||
|
||||
configList, err := cl.ConfigList(context.Background(), types.ConfigListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var configStrings []string
|
||||
for _, config := range configList {
|
||||
configStrings = append(configStrings, config.Spec.Name)
|
||||
}
|
||||
|
||||
var imageStrings []string
|
||||
for _, service := range compose.Services {
|
||||
imageStrings = append(imageStrings, service.Image)
|
||||
}
|
||||
|
||||
// NOTE(d1): no release notes implemeneted for rolling back
|
||||
if err := internal.DeployOverview(
|
||||
app,
|
||||
@ -197,6 +229,9 @@ beforehand. See "abra app backup" for more.`),
|
||||
chosenDowngrade,
|
||||
"",
|
||||
downgradeWarnMessages,
|
||||
strings.Join(secretStrings, "\n"),
|
||||
strings.Join(configStrings, "\n"),
|
||||
strings.Join(imageStrings, "\n"),
|
||||
); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ Passing "--prune/-p" does not remove those volumes.`),
|
||||
config.NO_DOMAIN_DEFAULT,
|
||||
"",
|
||||
nil,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
||||
"coopcloud.tech/tagcmp"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
"github.com/docker/docker/api/types"
|
||||
dockerClient "github.com/docker/docker/client"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@ -216,6 +217,36 @@ beforehand. See "abra app backup" for more.`),
|
||||
}
|
||||
}
|
||||
|
||||
filters, err := app.Filters(false, false)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
secretList, err := cl.SecretList(context.Background(), types.SecretListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var secretStrings []string
|
||||
for _, cont := range secretList {
|
||||
secretStrings = append(secretStrings, cont.Spec.Name)
|
||||
}
|
||||
|
||||
configList, err := cl.ConfigList(context.Background(), types.ConfigListOptions{Filters: filters})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var configStrings []string
|
||||
for _, config := range configList {
|
||||
configStrings = append(configStrings, config.Spec.Name)
|
||||
}
|
||||
|
||||
var imageStrings []string
|
||||
for _, service := range compose.Services {
|
||||
imageStrings = append(imageStrings, service.Image)
|
||||
}
|
||||
|
||||
if showReleaseNotes {
|
||||
fmt.Print(upgradeReleaseNotes)
|
||||
return
|
||||
@ -234,6 +265,9 @@ beforehand. See "abra app backup" for more.`),
|
||||
chosenUpgrade,
|
||||
upgradeReleaseNotes,
|
||||
upgradeWarnMessages,
|
||||
strings.Join(secretStrings, "\n"),
|
||||
strings.Join(configStrings, "\n"),
|
||||
strings.Join(imageStrings, "\n"),
|
||||
); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ func DeployOverview(
|
||||
toDeployVersion string,
|
||||
releaseNotes string,
|
||||
warnMessages []string,
|
||||
secrets string,
|
||||
configs string,
|
||||
images string,
|
||||
) error {
|
||||
deployConfig := "compose.yml"
|
||||
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
||||
@ -80,6 +83,10 @@ func DeployOverview(
|
||||
{i18n.G("CURRENT DEPLOYMENT"), formatter.BoldDirtyDefault(deployedVersion)},
|
||||
{i18n.G("ENV VERSION"), formatter.BoldDirtyDefault(envVersion)},
|
||||
{i18n.G("NEW DEPLOYMENT"), formatter.BoldDirtyDefault(toDeployVersion)},
|
||||
{"", ""},
|
||||
{i18n.G("SECRETS"), secrets},
|
||||
{i18n.G("CONFIGS"), configs},
|
||||
{i18n.G("IMAGES"), images},
|
||||
}
|
||||
|
||||
deployType := getDeployType(deployedVersion, toDeployVersion)
|
||||
|
Reference in New Issue
Block a user