forked from toolshed/abra
refactor: move app files from config to app package
This commit is contained in:
@ -8,7 +8,7 @@ import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
appPkg "coopcloud.tech/abra/pkg/app"
|
||||
containerPkg "coopcloud.tech/abra/pkg/container"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/upstream/container"
|
||||
@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
// RunCmdRemote executes an abra.sh command in the target service
|
||||
func RunCmdRemote(cl *dockerClient.Client, app config.App, abraSh, serviceName, cmdName, cmdArgs string) error {
|
||||
func RunCmdRemote(cl *dockerClient.Client, app appPkg.App, abraSh, serviceName, cmdName, cmdArgs string) error {
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))
|
||||
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
appPkg "coopcloud.tech/abra/pkg/app"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"github.com/AlecAivazis/survey/v2"
|
||||
@ -15,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// NewVersionOverview shows an upgrade or downgrade overview
|
||||
func NewVersionOverview(app config.App, currentVersion, newVersion, releaseNotes string) error {
|
||||
func NewVersionOverview(app appPkg.App, currentVersion, newVersion, releaseNotes string) error {
|
||||
tableCol := []string{"server", "recipe", "config", "domain", "current version", "to be deployed"}
|
||||
table := formatter.CreateTable(tableCol)
|
||||
|
||||
@ -82,7 +83,7 @@ func GetReleaseNotes(recipeName, version string) (string, error) {
|
||||
// PostCmds parses a string of commands and executes them inside of the respective services
|
||||
// the commands string must have the following format:
|
||||
// "<service> <command> <arguments>|<service> <command> <arguments>|... "
|
||||
func PostCmds(cl *dockerClient.Client, app config.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")
|
||||
if _, err := os.Stat(abraSh); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@ -108,7 +109,7 @@ func PostCmds(cl *dockerClient.Client, app config.App, commands string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
serviceNames, err := config.GetAppServiceNames(app.Name)
|
||||
serviceNames, err := appPkg.GetAppServiceNames(app.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -135,7 +136,7 @@ func PostCmds(cl *dockerClient.Client, app config.App, commands string) error {
|
||||
}
|
||||
|
||||
// DeployOverview shows a deployment overview
|
||||
func DeployOverview(app config.App, version, message string) error {
|
||||
func DeployOverview(app appPkg.App, version, message string) error {
|
||||
tableCol := []string{"server", "recipe", "config", "domain", "version"}
|
||||
table := formatter.CreateTable(tableCol)
|
||||
|
||||
|
@ -78,7 +78,7 @@ func ValidateRecipe(c *cli.Context) recipe.Recipe {
|
||||
}
|
||||
|
||||
// ValidateApp ensures the app name arg is valid.
|
||||
func ValidateApp(c *cli.Context) config.App {
|
||||
func ValidateApp(c *cli.Context) app.App {
|
||||
appName := c.Args().First()
|
||||
|
||||
if appName == "" {
|
||||
|
Reference in New Issue
Block a user