fix(stacks): pass prune option through the deploy pipeline [BE-12738] (#2098)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chaim Lev-Ari
2026-03-22 12:37:40 +02:00
committed by GitHub
parent 5670216d7e
commit a2fee4fc4c
15 changed files with 180 additions and 37 deletions

View File

@@ -130,8 +130,11 @@ func (handler *Handler) stackGitRedeploy(w http.ResponseWriter, r *http.Request)
payload.RepullImageAndRedeploy = payload.RepullImageAndRedeploy || payload.PullImage
stack.GitConfig.ReferenceName = payload.RepositoryReferenceName
stack.Env = payload.Env
if stack.Type == portainer.DockerSwarmStack {
stack.Option = &portainer.StackOption{Prune: payload.Prune}
if stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {
if stack.Option == nil {
stack.Option = &portainer.StackOption{}
}
stack.Option.Prune = payload.Prune
}
if stack.Type == portainer.KubernetesStack {
@@ -233,7 +236,9 @@ func (handler *Handler) deployStack(r *http.Request, stack *portainer.Stack, pul
return httperror.InternalServerError("Unable to retrieve info from request context", err)
}
deploymentConfiger, err = deployments.CreateComposeStackDeploymentConfig(securityContext, stack, endpoint, handler.DataStore, handler.FileService, handler.StackDeployer, pullImage, true)
prune := stack.Option != nil && stack.Option.Prune
deploymentConfiger, err = deployments.CreateComposeStackDeploymentConfig(securityContext, stack, endpoint, handler.DataStore, handler.FileService, handler.StackDeployer, prune, pullImage, true)
if err != nil {
return httperror.InternalServerError(err.Error(), err)
}