fix(context): clean up context usage BE-12766 (#2164)

This commit is contained in:
andres-portainer
2026-04-01 18:02:48 -03:00
committed by GitHub
parent e68e14787b
commit 50056bef70
91 changed files with 558 additions and 519 deletions
@@ -1,6 +1,7 @@
package stackbuilders
import (
"context"
"time"
portainer "github.com/portainer/portainer/api"
@@ -12,7 +13,7 @@ type FileContentMethodStackBuildProcess interface {
// Set unique stack information, e.g. swarm stack has swarmID, kubernetes stack has namespace
SetUniqueInfo(payload *StackPayload) FileContentMethodStackBuildProcess
// Deploy stack based on the configuration
Deploy(payload *StackPayload, endpoint *portainer.Endpoint) FileContentMethodStackBuildProcess
Deploy(ctx context.Context, payload *StackPayload, endpoint *portainer.Endpoint) FileContentMethodStackBuildProcess
// Save the stack information to database
SaveStack() (*portainer.Stack, error)
// Get response from HTTP request. Use if it is needed
@@ -44,13 +45,13 @@ func (b *FileContentMethodStackBuilder) SetFileContent(payload *StackPayload) Fi
return b
}
func (b *FileContentMethodStackBuilder) Deploy(payload *StackPayload, endpoint *portainer.Endpoint) FileContentMethodStackBuildProcess {
func (b *FileContentMethodStackBuilder) Deploy(ctx context.Context, payload *StackPayload, endpoint *portainer.Endpoint) FileContentMethodStackBuildProcess {
if b.hasError() {
return b
}
// Deploy the stack
b.err = b.deploymentConfiger.Deploy()
b.err = b.deploymentConfiger.Deploy(ctx)
return b
}