fix(libstack): add a different timeout for WaitForStatus BE-11376 (#120)

pull/7947/merge
andres-portainer 2 weeks ago committed by GitHub
parent 7444e2c1c7
commit 2e9e459aa3

@ -8,6 +8,7 @@ import (
"path/filepath"
"slices"
"strings"
"sync"
"github.com/portainer/portainer/pkg/libstack"
@ -21,6 +22,8 @@ import (
"github.com/rs/zerolog/log"
)
var mu sync.Mutex
func withCli(
ctx context.Context,
options libstack.Options,
@ -47,9 +50,12 @@ func withCli(
opts.ConfigDir = tempDir
mu.Lock()
if err := cli.Initialize(opts); err != nil {
mu.Unlock()
return fmt.Errorf("unable to initialize the Docker client: %w", err)
}
mu.Unlock()
defer cli.Client().Close()
for _, r := range options.Registries {

@ -130,7 +130,11 @@ func (c *ComposeDeployer) WaitForStatus(ctx context.Context, name string, status
if err := withComposeService(ctx, nil, libstack.Options{ProjectName: name}, func(composeService api.Service, project *types.Project) error {
var err error
containerSummaries, err = composeService.Ps(ctx, name, api.PsOptions{All: true})
psCtx, cancelFunc := context.WithTimeout(context.Background(), time.Minute)
defer cancelFunc()
containerSummaries, err = composeService.Ps(psCtx, name, api.PsOptions{All: true})
return err
}); err != nil {

Loading…
Cancel
Save