fix: ensure containers really go away #623
@ -7,7 +7,7 @@
|
||||
msgid ""
|
||||
msgstr "Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2025-08-27 12:59-0400\n"
|
||||
"POT-Creation-Date: 2025-08-28 16:17+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -1510,6 +1510,10 @@ msgstr ""
|
||||
msgid "all"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:270
|
||||
msgid "all containers did really go away"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/lint/recipe.go:82
|
||||
msgid "all images use a tag"
|
||||
msgstr ""
|
||||
@ -1518,6 +1522,10 @@ msgstr ""
|
||||
msgid "all services have images"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:251
|
||||
msgid "all tasks reached terminal state"
|
||||
msgstr ""
|
||||
|
||||
#: ./cli/app/restart.go:162
|
||||
msgid "all-services"
|
||||
msgstr ""
|
||||
@ -2101,7 +2109,7 @@ msgstr ""
|
||||
msgid "deployment cancelled"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:249
|
||||
#: ./pkg/upstream/stack/remove.go:256
|
||||
msgid "deployment timed out 🟠"
|
||||
msgstr ""
|
||||
|
||||
@ -2435,11 +2443,16 @@ msgstr ""
|
||||
msgid "failed to determine deployed version of %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:234
|
||||
#: ./pkg/upstream/stack/remove.go:239
|
||||
#, c-format
|
||||
msgid "failed to get tasks: %w"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:264
|
||||
#, c-format
|
||||
msgid "failed to list containers of stack: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/stack.go:183
|
||||
#, c-format
|
||||
msgid "failed to list services: %s"
|
||||
@ -2463,27 +2476,27 @@ msgstr ""
|
||||
msgid "failed to publish new release: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:182
|
||||
#: ./pkg/upstream/stack/remove.go:183
|
||||
#, c-format
|
||||
msgid "failed to remove config %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:150
|
||||
#: ./pkg/upstream/stack/remove.go:151
|
||||
#, c-format
|
||||
msgid "failed to remove network %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:166
|
||||
#: ./pkg/upstream/stack/remove.go:167
|
||||
#, c-format
|
||||
msgid "failed to remove secret %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:134
|
||||
#: ./pkg/upstream/stack/remove.go:135
|
||||
#, c-format
|
||||
msgid "failed to remove service %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:82
|
||||
#: ./pkg/upstream/stack/remove.go:83
|
||||
#, c-format
|
||||
msgid "failed to remove some resources from stack: %s"
|
||||
msgstr ""
|
||||
@ -2527,7 +2540,7 @@ msgstr ""
|
||||
msgid "failed to update secret %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:92
|
||||
#: ./pkg/upstream/stack/remove.go:93
|
||||
#, c-format
|
||||
msgid "failed to wait on tasks of stack: %s: %s"
|
||||
msgstr ""
|
||||
@ -2893,7 +2906,7 @@ msgstr ""
|
||||
msgid "initialising deployment"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:25
|
||||
#: ./pkg/upstream/stack/remove.go:26
|
||||
msgid "initialising undeploy"
|
||||
msgstr ""
|
||||
|
||||
@ -3418,7 +3431,7 @@ msgstr ""
|
||||
msgid "not upgrading from %s to %s for %s, because the upgrade type is more serious than what user wants"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:72
|
||||
#: ./pkg/upstream/stack/remove.go:73
|
||||
#, c-format
|
||||
msgid "nothing found in stack: %s"
|
||||
msgstr ""
|
||||
@ -3548,7 +3561,7 @@ msgstr ""
|
||||
msgid "polling deployment status"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:86
|
||||
#: ./pkg/upstream/stack/remove.go:87
|
||||
msgid "polling undeploy status"
|
||||
msgstr ""
|
||||
|
||||
@ -3788,7 +3801,7 @@ msgstr ""
|
||||
msgid "removing all images, not only dangling ones"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:179
|
||||
#: ./pkg/upstream/stack/remove.go:180
|
||||
#, c-format
|
||||
msgid "removing config %s"
|
||||
msgstr ""
|
||||
@ -3798,17 +3811,17 @@ msgstr ""
|
||||
msgid "removing configs failed: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:147
|
||||
#: ./pkg/upstream/stack/remove.go:148
|
||||
#, c-format
|
||||
msgid "removing network %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:163
|
||||
#: ./pkg/upstream/stack/remove.go:164
|
||||
#, c-format
|
||||
msgid "removing secret %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:131
|
||||
#: ./pkg/upstream/stack/remove.go:132
|
||||
#, c-format
|
||||
msgid "removing service %s"
|
||||
msgstr ""
|
||||
@ -4225,7 +4238,7 @@ msgstr ""
|
||||
msgid "skipping %s, does not have level \"error\""
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:109
|
||||
#: ./pkg/upstream/stack/remove.go:110
|
||||
msgid "skipping as requested, undeploy still in progress 🟠"
|
||||
msgstr ""
|
||||
|
||||
@ -4428,7 +4441,7 @@ msgstr ""
|
||||
msgid "tests"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:226
|
||||
#: ./pkg/upstream/stack/remove.go:231
|
||||
#, c-format
|
||||
msgid "timed out on undeploy (timeout=%v sec)"
|
||||
msgstr ""
|
||||
@ -4438,12 +4451,12 @@ msgstr ""
|
||||
msgid "timeout label: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:28 ./pkg/upstream/stack/stack.go:209
|
||||
#: ./pkg/upstream/stack/remove.go:29 ./pkg/upstream/stack/stack.go:209
|
||||
#, c-format
|
||||
msgid "timeout: set to %d second(s)"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:221
|
||||
#: ./pkg/upstream/stack/remove.go:226
|
||||
#, c-format
|
||||
msgid "timeout: waiting on undeploy tasks (timeout=%v secs)"
|
||||
msgstr ""
|
||||
@ -5032,6 +5045,16 @@ msgstr ""
|
||||
msgid "waitOnServices: writeFile: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:275
|
||||
#, c-format
|
||||
msgid "waiting for %d container(s) to really go away"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/upstream/stack/remove.go:244
|
||||
#, c-format
|
||||
msgid "waiting for %d task(s) to reach terminal state"
|
||||
msgstr ""
|
||||
|
||||
#: ./pkg/lint/recipe.go:21 ./pkg/lint/recipe.go:67 ./pkg/lint/recipe.go:74 ./pkg/lint/recipe.go:81 ./pkg/lint/recipe.go:88 ./pkg/lint/recipe.go:95 ./pkg/lint/recipe.go:102 ./pkg/lint/recipe.go:109 ./pkg/lint/recipe.go:116 ./pkg/lint/recipe.go:123
|
||||
msgid "warn"
|
||||
msgstr ""
|
||||
|
||||
Binary file not shown.
@ -2,11 +2,11 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2025-08-27 12:59-0400\n"
|
||||
"POT-Creation-Date: 2025-08-28 16:17+0200\n"
|
||||
"PO-Revision-Date: 2025-08-28 01:00+0000\n"
|
||||
"Last-Translator: 3wordchant <3wc.coopcloud@doesthisthing.work>\n"
|
||||
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/"
|
||||
"co-op-cloud/abra/es/>\n"
|
||||
"Language-Team: Spanish <https://translate.coopcloud.tech/projects/co-op-"
|
||||
"cloud/abra/es/>\n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@ -1652,6 +1652,10 @@ msgstr ""
|
||||
msgid "all"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:270
|
||||
msgid "all containers did really go away"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/lint/recipe.go:82
|
||||
msgid "all images use a tag"
|
||||
msgstr ""
|
||||
@ -1660,6 +1664,10 @@ msgstr ""
|
||||
msgid "all services have images"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:251
|
||||
msgid "all tasks reached terminal state"
|
||||
msgstr ""
|
||||
|
||||
#: cli/app/restart.go:162
|
||||
msgid "all-services"
|
||||
msgstr ""
|
||||
@ -2263,7 +2271,7 @@ msgstr ""
|
||||
msgid "deployment cancelled"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:249
|
||||
#: pkg/upstream/stack/remove.go:256
|
||||
msgid "deployment timed out 🟠"
|
||||
msgstr ""
|
||||
|
||||
@ -2606,11 +2614,16 @@ msgstr ""
|
||||
msgid "failed to determine deployed version of %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:234
|
||||
#: pkg/upstream/stack/remove.go:239
|
||||
#, c-format
|
||||
msgid "failed to get tasks: %w"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:264
|
||||
#, c-format
|
||||
msgid "failed to list containers of stack: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/stack.go:183
|
||||
#, c-format
|
||||
msgid "failed to list services: %s"
|
||||
@ -2634,27 +2647,27 @@ msgstr ""
|
||||
msgid "failed to publish new release: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:182
|
||||
#: pkg/upstream/stack/remove.go:183
|
||||
#, c-format
|
||||
msgid "failed to remove config %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:150
|
||||
#: pkg/upstream/stack/remove.go:151
|
||||
#, c-format
|
||||
msgid "failed to remove network %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:166
|
||||
#: pkg/upstream/stack/remove.go:167
|
||||
#, c-format
|
||||
msgid "failed to remove secret %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:134
|
||||
#: pkg/upstream/stack/remove.go:135
|
||||
#, c-format
|
||||
msgid "failed to remove service %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:82
|
||||
#: pkg/upstream/stack/remove.go:83
|
||||
#, c-format
|
||||
msgid "failed to remove some resources from stack: %s"
|
||||
msgstr ""
|
||||
@ -2698,7 +2711,7 @@ msgstr ""
|
||||
msgid "failed to update secret %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:92
|
||||
#: pkg/upstream/stack/remove.go:93
|
||||
#, c-format
|
||||
msgid "failed to wait on tasks of stack: %s: %s"
|
||||
msgstr ""
|
||||
@ -3072,7 +3085,7 @@ msgstr ""
|
||||
msgid "initialising deployment"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:25
|
||||
#: pkg/upstream/stack/remove.go:26
|
||||
msgid "initialising undeploy"
|
||||
msgstr ""
|
||||
|
||||
@ -3622,7 +3635,7 @@ msgid ""
|
||||
"than what user wants"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:72
|
||||
#: pkg/upstream/stack/remove.go:73
|
||||
#, c-format
|
||||
msgid "nothing found in stack: %s"
|
||||
msgstr ""
|
||||
@ -3759,7 +3772,7 @@ msgstr ""
|
||||
msgid "polling deployment status"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:86
|
||||
#: pkg/upstream/stack/remove.go:87
|
||||
msgid "polling undeploy status"
|
||||
msgstr ""
|
||||
|
||||
@ -4005,7 +4018,7 @@ msgstr ""
|
||||
msgid "removing all images, not only dangling ones"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:179
|
||||
#: pkg/upstream/stack/remove.go:180
|
||||
#, c-format
|
||||
msgid "removing config %s"
|
||||
msgstr ""
|
||||
@ -4015,17 +4028,17 @@ msgstr ""
|
||||
msgid "removing configs failed: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:147
|
||||
#: pkg/upstream/stack/remove.go:148
|
||||
#, c-format
|
||||
msgid "removing network %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:163
|
||||
#: pkg/upstream/stack/remove.go:164
|
||||
#, c-format
|
||||
msgid "removing secret %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:131
|
||||
#: pkg/upstream/stack/remove.go:132
|
||||
#, c-format
|
||||
msgid "removing service %s"
|
||||
msgstr ""
|
||||
@ -4450,7 +4463,7 @@ msgstr ""
|
||||
msgid "skipping %s, does not have level \"error\""
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:109
|
||||
#: pkg/upstream/stack/remove.go:110
|
||||
msgid "skipping as requested, undeploy still in progress 🟠"
|
||||
msgstr ""
|
||||
|
||||
@ -4656,7 +4669,7 @@ msgstr ""
|
||||
msgid "tests"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:226
|
||||
#: pkg/upstream/stack/remove.go:231
|
||||
#, c-format
|
||||
msgid "timed out on undeploy (timeout=%v sec)"
|
||||
msgstr ""
|
||||
@ -4666,12 +4679,12 @@ msgstr ""
|
||||
msgid "timeout label: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:28 pkg/upstream/stack/stack.go:209
|
||||
#: pkg/upstream/stack/remove.go:29 pkg/upstream/stack/stack.go:209
|
||||
#, c-format
|
||||
msgid "timeout: set to %d second(s)"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:221
|
||||
#: pkg/upstream/stack/remove.go:226
|
||||
#, c-format
|
||||
msgid "timeout: waiting on undeploy tasks (timeout=%v secs)"
|
||||
msgstr ""
|
||||
@ -5270,6 +5283,16 @@ msgstr ""
|
||||
msgid "waitOnServices: writeFile: %s"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:275
|
||||
#, c-format
|
||||
msgid "waiting for %d container(s) to really go away"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/upstream/stack/remove.go:244
|
||||
#, c-format
|
||||
msgid "waiting for %d task(s) to reach terminal state"
|
||||
msgstr ""
|
||||
|
||||
#: pkg/lint/recipe.go:21 pkg/lint/recipe.go:67 pkg/lint/recipe.go:74
|
||||
#: pkg/lint/recipe.go:81 pkg/lint/recipe.go:88 pkg/lint/recipe.go:95
|
||||
#: pkg/lint/recipe.go:102 pkg/lint/recipe.go:109 pkg/lint/recipe.go:116
|
||||
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/i18n"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/docker/docker/api/types"
|
||||
containerPkg "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
@ -79,7 +80,7 @@ func RunRemove(ctx context.Context, client *apiclient.Client, opts Remove) error
|
||||
hasError = removeNetworks(ctx, client, networks) || hasError
|
||||
|
||||
if hasError {
|
||||
errs = append(errs, fmt.Sprint(i18n.G("failed to remove some resources from stack: %s", namespace)))
|
||||
errs = append(errs, i18n.G("failed to remove some resources from stack: %s", namespace))
|
||||
continue
|
||||
}
|
||||
|
||||
@ -190,6 +191,10 @@ func getStackTasks(ctx context.Context, apiclient client.APIClient, namespace st
|
||||
return apiclient.TaskList(ctx, types.TaskListOptions{Filters: getStackFilter(namespace)})
|
||||
}
|
||||
|
||||
func getStackContainers(ctx context.Context, apiclient client.APIClient, namespace string) ([]containerPkg.Summary, error) {
|
||||
return apiclient.ContainerList(ctx, containerPkg.ListOptions{Filters: getStackFilter(namespace)})
|
||||
}
|
||||
|
||||
var numberedStates = map[swarm.TaskState]int64{
|
||||
swarm.TaskStateNew: 1,
|
||||
swarm.TaskStateAllocated: 2,
|
||||
@ -236,12 +241,14 @@ func waitOnTasks(ctx context.Context, client apiclient.APIClient, namespace stri
|
||||
|
||||
for _, task := range tasks {
|
||||
if terminalState(task.Status.State) {
|
||||
log.Debug(i18n.G("waiting for %d task(s) to reach terminal state", len(tasks)-terminalStatesReached))
|
||||
terminalStatesReached++
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if terminalStatesReached == len(tasks) {
|
||||
log.Debug(i18n.G("all tasks reached terminal state"))
|
||||
break
|
||||
}
|
||||
|
||||
@ -250,5 +257,25 @@ func waitOnTasks(ctx context.Context, client apiclient.APIClient, namespace stri
|
||||
}
|
||||
}
|
||||
|
||||
lastSeenCount := -1
|
||||
for {
|
||||
containers, err := getStackContainers(ctx, client, namespace)
|
||||
if err != nil {
|
||||
return false, errors.New(i18n.G("failed to list containers of stack: %s", namespace))
|
||||
}
|
||||
|
||||
numContainers := len(containers)
|
||||
|
||||
if numContainers == 0 {
|
||||
log.Debug(i18n.G("all containers did really go away"))
|
||||
break
|
||||
}
|
||||
|
||||
if numContainers != lastSeenCount {
|
||||
log.Debug(i18n.G("waiting for %d container(s) to really go away", numContainers))
|
||||
lastSeenCount = numContainers
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user