resolve review
This commit is contained in:
parent
baaf8d224e
commit
d3650b274e
@ -3,7 +3,6 @@ package app
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
@ -202,14 +201,11 @@ recipes.
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
timeoutLabel := config.GetLabel(compose, stackName, "timeout")
|
||||
if timeoutLabel != "" {
|
||||
stack.WaitTimeout, err = strconv.Atoi(timeoutLabel)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Debugf("Set waiting timeout to %s s", timeoutLabel)
|
||||
stack.WaitTimeout, err = config.GetTimeoutFromLabel(compose, stackName)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Debugf("set waiting timeout to %d s", stack.WaitTimeout)
|
||||
|
||||
if err := stack.RunDeploy(cl, deployOpts, compose, stackName, internal.DontWaitConverge); err != nil {
|
||||
logrus.Fatal(err)
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
@ -162,14 +161,11 @@ func DeployAction(c *cli.Context) error {
|
||||
logrus.Warn("skipping domain checks as requested")
|
||||
}
|
||||
|
||||
timeoutLabel := config.GetLabel(compose, stackName, "timeout")
|
||||
if timeoutLabel != "" {
|
||||
stack.WaitTimeout, err = strconv.Atoi(timeoutLabel)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Debugf("Set waiting timeout to %s s", timeoutLabel)
|
||||
stack.WaitTimeout, err = config.GetTimeoutFromLabel(compose, stackName)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Debugf("set waiting timeout to %d s", stack.WaitTimeout)
|
||||
|
||||
if err := stack.RunDeploy(cl, deployOpts, compose, app.Name, DontWaitConverge); err != nil {
|
||||
logrus.Fatal(err)
|
||||
|
@ -545,7 +545,7 @@ func SetUpdateLabel(compose *composetypes.Config, stackName string, appEnv AppEn
|
||||
}
|
||||
}
|
||||
|
||||
// getLabel reads docker labels in the format of "coop-cloud.${STACK_NAME}.${LABEL}" from the local compose files
|
||||
// GetLabel reads docker labels in the format of "coop-cloud.${STACK_NAME}.${LABEL}" from the local compose files
|
||||
func GetLabel(compose *composetypes.Config, stackName string, label string) string {
|
||||
for _, service := range compose.Services {
|
||||
if service.Name == "app" {
|
||||
@ -559,3 +559,14 @@ func GetLabel(compose *composetypes.Config, stackName string, label string) stri
|
||||
logrus.Debugf("no %s label found for %s", label, stackName)
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetTimeoutFromLabel reads the timeout value from docker label "coop-cloud.${STACK_NAME}.TIMEOUT" and returns 50 as default value
|
||||
func GetTimeoutFromLabel(compose *composetypes.Config, stackName string) (int, error) {
|
||||
var timeout = 50 // Default Timeout
|
||||
var err error = nil
|
||||
if timeoutLabel := GetLabel(compose, stackName, "timeout"); timeoutLabel != "" {
|
||||
logrus.Debugf("timeout label: %s", timeoutLabel)
|
||||
timeout, err = strconv.Atoi(timeoutLabel)
|
||||
}
|
||||
return timeout, err
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ const (
|
||||
ResolveImageNever = "never"
|
||||
)
|
||||
|
||||
// Timeout to wait until docker services converge, default is 50s (random choice)
|
||||
var WaitTimeout int = 50
|
||||
|
||||
type StackStatus struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user