feat(deploy): set timeout via label (!290)

Solves coop-cloud/organising#437

A timeout can be specified globally for a recipe using this label:
`coop-cloud.${STACK_NAME}.timeout=${TIMEOUT:-120}`. This sets the default timeout to 120s. An app specific timeout can be set using the env `TIMEOUT`.

Co-authored-by: Moritz <moritz.m@local-it.org>
Reviewed-on: coop-cloud/abra#290
This commit is contained in:
2023-04-14 14:44:18 +00:00
parent 18615eaaef
commit 31ec322c55
5 changed files with 45 additions and 4 deletions

View File

@ -31,6 +31,9 @@ const (
ResolveImageNever = "never"
)
// Timeout to wait until docker services converge, default is 50s (random choice)
var WaitTimeout int = 50
type StackStatus struct {
Services []swarm.Service
Err error
@ -457,7 +460,7 @@ func WaitOnService(ctx context.Context, cl *dockerClient.Client, serviceID, appN
go io.Copy(ioutil.Discard, pipeReader)
timeout := 50 * time.Second
timeout := time.Duration(WaitTimeout) * time.Second
select {
case err := <-errChan: