From 7c2fcb67ebdc12c9c058775f329e354cb045ed2c Mon Sep 17 00:00:00 2001 From: cmeng Date: Fri, 28 Apr 2023 13:35:38 +1200 Subject: [PATCH] fix(stack) add skip TLS toggle for edit stack EE-5391 (#8850) --- api/http/handler/stacks/create_swarm_stack.go | 1 + api/http/handler/stacks/stack_update_git.go | 2 ++ .../handler/stacks/update_kubernetes_stack.go | 2 ++ ...bernetes-redeploy-app-git-form.controller.js | 8 ++++++++ .../kubernetes-redeploy-app-git-form.html | 14 ++++++++++++++ .../stack-redeploy-git-form.controller.js | 6 ++++++ .../stack-redeploy-git-form.html | 17 +++++++++++++++++ app/portainer/services/api/stackService.js | 2 ++ 8 files changed, 52 insertions(+) diff --git a/api/http/handler/stacks/create_swarm_stack.go b/api/http/handler/stacks/create_swarm_stack.go index 031c518c9..437fefc57 100644 --- a/api/http/handler/stacks/create_swarm_stack.go +++ b/api/http/handler/stacks/create_swarm_stack.go @@ -150,6 +150,7 @@ func createStackPayloadFromSwarmGitPayload(name, swarmID, repoUrl, repoReference Authentication: repoAuthentication, Username: repoUsername, Password: repoPassword, + TLSSkipVerify: repoSkipSSLVerify, }, ComposeFile: composeFile, AdditionalFiles: additionalFiles, diff --git a/api/http/handler/stacks/stack_update_git.go b/api/http/handler/stacks/stack_update_git.go index 7a56f7278..3ccbb7633 100644 --- a/api/http/handler/stacks/stack_update_git.go +++ b/api/http/handler/stacks/stack_update_git.go @@ -25,6 +25,7 @@ type stackGitUpdatePayload struct { RepositoryAuthentication bool RepositoryUsername string RepositoryPassword string + TLSSkipVerify bool } func (payload *stackGitUpdatePayload) Validate(r *http.Request) error { @@ -138,6 +139,7 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) * //update retrieved stack data based on the payload stack.GitConfig.ReferenceName = payload.RepositoryReferenceName + stack.GitConfig.TLSSkipVerify = payload.TLSSkipVerify stack.AutoUpdate = payload.AutoUpdate stack.Env = payload.Env stack.UpdatedBy = user.Username diff --git a/api/http/handler/stacks/update_kubernetes_stack.go b/api/http/handler/stacks/update_kubernetes_stack.go index e172a0c33..b07390eb7 100644 --- a/api/http/handler/stacks/update_kubernetes_stack.go +++ b/api/http/handler/stacks/update_kubernetes_stack.go @@ -31,6 +31,7 @@ type kubernetesGitStackUpdatePayload struct { RepositoryUsername string RepositoryPassword string AutoUpdate *portainer.AutoUpdateSettings + TLSSkipVerify bool } func (payload *kubernetesFileStackUpdatePayload) Validate(r *http.Request) error { @@ -62,6 +63,7 @@ func (handler *Handler) updateKubernetesStack(r *http.Request, stack *portainer. } stack.GitConfig.ReferenceName = payload.RepositoryReferenceName + stack.GitConfig.TLSSkipVerify = payload.TLSSkipVerify stack.AutoUpdate = payload.AutoUpdate if payload.RepositoryAuthentication { diff --git a/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.controller.js b/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.controller.js index bb636b9e9..e18232f34 100644 --- a/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.controller.js +++ b/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.controller.js @@ -45,6 +45,7 @@ class KubernetesRedeployAppGitFormController { this.onChangeRef = this.onChangeRef.bind(this); this.onChangeAutoUpdate = this.onChangeAutoUpdate.bind(this); this.onChangeGitAuth = this.onChangeGitAuth.bind(this); + this.onChangeTLSSkipVerify = this.onChangeTLSSkipVerify.bind(this); } onChangeRef(value) { @@ -68,6 +69,12 @@ class KubernetesRedeployAppGitFormController { }); } + onChangeTLSSkipVerify(value) { + return this.$async(async () => { + this.onChange({ TLSSkipVerify: value }); + }); + } + async onChangeAutoUpdate(values) { return this.$async(async () => { await this.onChange({ @@ -152,6 +159,7 @@ class KubernetesRedeployAppGitFormController { $onInit() { this.formValues.RefName = this.stack.GitConfig.ReferenceName; + this.formValues.TLSSkipVerify = this.stack.GitConfig.TLSSkipVerify; this.formValues.AutoUpdate = parseAutoUpdateResponse(this.stack.AutoUpdate); diff --git a/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.html b/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.html index a149d9c9c..64a888758 100644 --- a/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.html +++ b/app/portainer/components/forms/kubernetes-redeploy-app-git-form/kubernetes-redeploy-app-git-form.html @@ -43,6 +43,19 @@ is-auth-edit="$ctrl.state.isAuthEdit" > +
+
+ +
+
+
Actions
+