resolve PR review
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Moritz 2023-04-14 14:34:45 +02:00
parent 14bdb57ac7
commit 0845fcf78c
3 changed files with 9 additions and 5 deletions

View File

@ -207,9 +207,9 @@ recipes.
postDeployCmds, ok := app.Env["POST_UPGRADE_CMDS"]
if ok && !internal.DontWaitConverge {
logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)
logrus.Debugf("run the following post-deploy commands: %s", postDeployCmds)
if err := internal.PostCmds(cl, app, postDeployCmds); err != nil {
logrus.Fatal(err)
logrus.Fatalf("attempting to run post deploy commands, saw: %s", err)
}
}

View File

@ -20,6 +20,7 @@ import (
"github.com/sirupsen/logrus"
)
// RunCmdRemote executes an abra.sh command in the target service
func RunCmdRemote(cl *dockerClient.Client, app config.App, abraSh, serviceName, cmdName, cmdArgs string) error {
filters := filters.NewArgs()
filters.Add("name", fmt.Sprintf("^%s_%s", app.StackName(), serviceName))

View File

@ -167,15 +167,18 @@ func DeployAction(c *cli.Context) error {
postDeployCmds, ok := app.Env["POST_DEPLOY_CMDS"]
if ok && !DontWaitConverge {
logrus.Debugf("Run the following post-deploy commands: %s", postDeployCmds)
logrus.Debugf("run the following post-deploy commands: %s", postDeployCmds)
if err := PostCmds(cl, app, postDeployCmds); err != nil {
logrus.Fatal(err)
logrus.Fatalf("attempting to run post deploy commands, saw: %s", err)
}
}
return nil
}
// 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 {
abraSh := path.Join(config.RECIPES_DIR, app.Recipe, "abra.sh")
if _, err := os.Stat(abraSh); err != nil {
@ -196,7 +199,7 @@ func PostCmds(cl *dockerClient.Client, app config.App, commands string) error {
if len(commandParts) > 2 {
parsedCmdArgs = fmt.Sprintf("%s ", strings.Join(commandParts[2:], " "))
}
logrus.Infof("Running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)
logrus.Infof("running post-command '%s %s' in container %s", cmdName, parsedCmdArgs, targetServiceName)
if err := EnsureCommand(abraSh, app.Recipe, cmdName); err != nil {
return err