fix(customtemplates): set TLSSkipVerify on update EE-5336 (#9007)

pull/9009/head
andres-portainer 2023-05-26 00:29:09 -03:00 committed by GitHub
parent bcbdb01785
commit ac94d344df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,6 @@ import (
"net/http" "net/http"
"strconv" "strconv"
"github.com/asaskevich/govalidator"
httperror "github.com/portainer/libhttp/error" httperror "github.com/portainer/libhttp/error"
"github.com/portainer/libhttp/request" "github.com/portainer/libhttp/request"
"github.com/portainer/libhttp/response" "github.com/portainer/libhttp/response"
@ -15,6 +14,8 @@ import (
httperrors "github.com/portainer/portainer/api/http/errors" httperrors "github.com/portainer/portainer/api/http/errors"
"github.com/portainer/portainer/api/http/security" "github.com/portainer/portainer/api/http/security"
"github.com/portainer/portainer/api/stacks/stackutils" "github.com/portainer/portainer/api/stacks/stackutils"
"github.com/asaskevich/govalidator"
) )
type customTemplateUpdatePayload struct { type customTemplateUpdatePayload struct {
@ -53,6 +54,8 @@ type customTemplateUpdatePayload struct {
FileContent string `validate:"required"` FileContent string `validate:"required"`
// Definitions of variables in the stack file // Definitions of variables in the stack file
Variables []portainer.CustomTemplateVariableDefinition Variables []portainer.CustomTemplateVariableDefinition
// TLSSkipVerify skips SSL verification when cloning the Git repository
TLSSkipVerify bool `example:"false"`
// IsComposeFormat indicates if the Kubernetes template is created from a Docker Compose file // IsComposeFormat indicates if the Kubernetes template is created from a Docker Compose file
IsComposeFormat bool `example:"false"` IsComposeFormat bool `example:"false"`
} }
@ -167,6 +170,7 @@ func (handler *Handler) customTemplateUpdate(w http.ResponseWriter, r *http.Requ
URL: payload.RepositoryURL, URL: payload.RepositoryURL,
ReferenceName: payload.RepositoryReferenceName, ReferenceName: payload.RepositoryReferenceName,
ConfigFilePath: payload.ComposeFilePathInRepository, ConfigFilePath: payload.ComposeFilePathInRepository,
TLSSkipVerify: payload.TLSSkipVerify,
} }
if payload.RepositoryAuthentication { if payload.RepositoryAuthentication {