forked from toolshed/abra
feat: deploy --no-converge-checks & finish app errors
This commit is contained in:
@ -158,7 +158,7 @@ func pruneServices(ctx context.Context, cl *dockerclient.Client, namespace conve
|
||||
}
|
||||
|
||||
// RunDeploy is the swarm implementation of docker stack deploy
|
||||
func RunDeploy(cl *dockerclient.Client, opts Deploy, cfg *composetypes.Config, recipeName string) error {
|
||||
func RunDeploy(cl *dockerclient.Client, opts Deploy, cfg *composetypes.Config, recipeName string, dontWait bool) error {
|
||||
ctx := context.Background()
|
||||
|
||||
if err := validateResolveImageFlag(&opts); err != nil {
|
||||
@ -170,7 +170,7 @@ func RunDeploy(cl *dockerclient.Client, opts Deploy, cfg *composetypes.Config, r
|
||||
opts.ResolveImage = ResolveImageNever
|
||||
}
|
||||
|
||||
return deployCompose(ctx, cl, opts, cfg, recipeName)
|
||||
return deployCompose(ctx, cl, opts, cfg, recipeName, dontWait)
|
||||
}
|
||||
|
||||
// validateResolveImageFlag validates the opts.resolveImage command line option
|
||||
@ -183,7 +183,7 @@ func validateResolveImageFlag(opts *Deploy) error {
|
||||
}
|
||||
}
|
||||
|
||||
func deployCompose(ctx context.Context, cl *dockerclient.Client, opts Deploy, config *composetypes.Config, recipeName string) error {
|
||||
func deployCompose(ctx context.Context, cl *dockerclient.Client, opts Deploy, config *composetypes.Config, recipeName string, dontWait bool) error {
|
||||
namespace := convert.NewNamespace(opts.Namespace)
|
||||
|
||||
if opts.Prune {
|
||||
@ -224,7 +224,7 @@ func deployCompose(ctx context.Context, cl *dockerclient.Client, opts Deploy, co
|
||||
return err
|
||||
}
|
||||
|
||||
return deployServices(ctx, cl, services, namespace, opts.SendRegistryAuth, opts.ResolveImage, recipeName)
|
||||
return deployServices(ctx, cl, services, namespace, opts.SendRegistryAuth, opts.ResolveImage, recipeName, dontWait)
|
||||
}
|
||||
|
||||
func getServicesDeclaredNetworks(serviceConfigs []composetypes.ServiceConfig) map[string]struct{} {
|
||||
@ -340,7 +340,8 @@ func deployServices(
|
||||
namespace convert.Namespace,
|
||||
sendAuth bool,
|
||||
resolveImage string,
|
||||
recipeName string) error {
|
||||
recipeName string,
|
||||
dontWait bool) error {
|
||||
existingServices, err := GetStackServices(ctx, cl, namespace.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
@ -439,8 +440,13 @@ func deployServices(
|
||||
for _, serviceName := range serviceIDs {
|
||||
serviceNames = append(serviceNames, serviceName)
|
||||
}
|
||||
logrus.Infof("waiting for services to converge: %s", strings.Join(serviceNames, ", "))
|
||||
|
||||
if dontWait {
|
||||
logrus.Warn("skipping converge logic checks")
|
||||
return nil
|
||||
}
|
||||
|
||||
logrus.Infof("waiting for services to converge: %s", strings.Join(serviceNames, ", "))
|
||||
ch := make(chan error, len(serviceIDs))
|
||||
for serviceID, serviceName := range serviceIDs {
|
||||
logrus.Debugf("waiting on %s to converge", serviceName)
|
||||
|
Reference in New Issue
Block a user