feat(stack/swarm): add prune option for swarm stack redeployment [EE-2678] (#7025)

This commit is contained in:
Oscar Zhou
2022-07-04 11:39:03 +12:00
committed by GitHub
parent d7306fb22e
commit 7275d23e4b
13 changed files with 97 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ import (
type stackGitUpdatePayload struct {
AutoUpdate *portainer.StackAutoUpdate
Env []portainer.Pair
Prune bool
RepositoryReferenceName string
RepositoryAuthentication bool
RepositoryUsername string
@@ -131,6 +132,12 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *
stack.UpdatedBy = user.Username
stack.UpdateDate = time.Now().Unix()
if stack.Type == portainer.DockerSwarmStack {
stack.Option = &portainer.StackOption{
Prune: payload.Prune,
}
}
if payload.RepositoryAuthentication {
password := payload.RepositoryPassword
if password == "" && stack.GitConfig != nil && stack.GitConfig.Authentication != nil {