fix: catch ctrl-c again; less cryptic logging
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
decentral1se 2024-07-17 10:09:09 +02:00
parent 1132b09b5b
commit e5a6dea10c
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410

View File

@ -175,6 +175,7 @@ func pruneServices(ctx context.Context, cl *dockerClient.Client, namespace conve
pruneServices = append(pruneServices, service)
}
}
removeServices(ctx, cl, pruneServices)
}
@ -255,10 +256,12 @@ func deployCompose(ctx context.Context, cl *dockerClient.Client, opts Deploy, co
log.Infof("waiting for %s to deploy... please hold 🤚", appName)
if err := waitOnServices(ctx, cl, serviceIDs, appName); err == nil {
log.Infof("successfully deployed %s", appName)
if err := waitOnServices(ctx, cl, serviceIDs, appName); err != nil {
return err
}
log.Infof("successfully deployed %s", appName)
return nil
}
@ -395,7 +398,7 @@ func deployServices(
)
if service, exists := existingServiceMap[name]; exists {
log.Infof("updating service %s (id: %s)", name, service.ID)
log.Infof("updating %s", name)
updateOpts := types.ServiceUpdateOptions{EncodedRegistryAuth: encodedAuth}
@ -430,7 +433,7 @@ func deployServices(
response, err := cl.ServiceUpdate(ctx, service.ID, service.Version, serviceSpec, updateOpts)
if err != nil {
return nil, errors.Wrapf(err, "failed to update service %s", name)
return nil, errors.Wrapf(err, "failed to update %s", name)
}
for _, warning := range response.Warnings {
@ -439,7 +442,7 @@ func deployServices(
serviceIDs = append(serviceIDs, service.ID)
} else {
log.Infof("creating service %s", name)
log.Infof("creating %s", name)
createOpts := types.ServiceCreateOptions{EncodedRegistryAuth: encodedAuth}
@ -450,7 +453,7 @@ func deployServices(
serviceCreateResponse, err := cl.ServiceCreate(ctx, serviceSpec, createOpts)
if err != nil {
return nil, errors.Wrapf(err, "failed to create service %s", name)
return nil, errors.Wrapf(err, "failed to create %s", name)
}
serviceIDs = append(serviceIDs, serviceCreateResponse.ID)
@ -510,13 +513,14 @@ func WaitOnService(ctx context.Context, cl *dockerClient.Client, serviceID, appN
case err := <-errChan:
return err
case <-sigintChannel:
return fmt.Errorf(fmt.Sprintf(`
return fmt.Errorf(`
Not waiting for %s to deploy. The deployment is ongoing...
If you want to stop the deployment, try:
abra app undeploy %s`, appName, appName))
abra app undeploy %s`, appName, appName)
case <-time.After(timeout):
return fmt.Errorf(fmt.Sprintf(`
return fmt.Errorf(`
%s has not converged (%s second timeout reached).
This does not necessarily mean your deployment has failed, it may just be that
@ -530,7 +534,7 @@ You can track latest deployment status with:
And inspect the logs with:
abra app logs %s
`, appName, timeout, appName, appName))
`, appName, timeout, appName, appName)
}
}
@ -548,7 +552,7 @@ func GetStacks(cl *dockerClient.Client) ([]*formatter.Stack, error) {
labels := service.Spec.Labels
name, ok := labels[convert.LabelNamespace]
if !ok {
return nil, errors.Errorf("cannot get label %s for service %s",
return nil, errors.Errorf("cannot get label %s for %s",
convert.LabelNamespace, service.ID)
}
ztack, ok := m[name]