mirror of https://github.com/portainer/portainer
				
				
				
			
							parent
							
								
									2eb4453487
								
							
						
					
					
						commit
						7c2fcb67eb
					
				| 
						 | 
				
			
			@ -150,6 +150,7 @@ func createStackPayloadFromSwarmGitPayload(name, swarmID, repoUrl, repoReference
 | 
			
		|||
			Authentication: repoAuthentication,
 | 
			
		||||
			Username:       repoUsername,
 | 
			
		||||
			Password:       repoPassword,
 | 
			
		||||
			TLSSkipVerify:  repoSkipSSLVerify,
 | 
			
		||||
		},
 | 
			
		||||
		ComposeFile:     composeFile,
 | 
			
		||||
		AdditionalFiles: additionalFiles,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,19 @@
 | 
			
		|||
    is-auth-edit="$ctrl.state.isAuthEdit"
 | 
			
		||||
  ></git-form-auth-fieldset>
 | 
			
		||||
 | 
			
		||||
  <div class="form-group" ng-if="$ctrl.state.showConfig">
 | 
			
		||||
    <div class="col-sm-12">
 | 
			
		||||
      <por-switch-field
 | 
			
		||||
        name="TLSSkipVerify"
 | 
			
		||||
        checked="$ctrl.formValues.TLSSkipVerify"
 | 
			
		||||
        tooltip="'Enabling this will allow skipping TLS validation for any self-signed certificate.'"
 | 
			
		||||
        label-class="'col-sm-3 col-lg-2'"
 | 
			
		||||
        label="'Skip TLS Verification'"
 | 
			
		||||
        on-change="($ctrl.onChangeTLSSkipVerify)"
 | 
			
		||||
      ></por-switch-field>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="col-sm-12 form-section-title"> Actions </div>
 | 
			
		||||
  <!-- #Git buttons -->
 | 
			
		||||
  <button
 | 
			
		||||
| 
						 | 
				
			
			@ -61,6 +74,7 @@
 | 
			
		|||
    </span>
 | 
			
		||||
    <span ng-show="$ctrl.state.redeployInProgress">In progress...</span>
 | 
			
		||||
  </button>
 | 
			
		||||
 | 
			
		||||
  <button
 | 
			
		||||
    class="btn btn-sm btn-primary"
 | 
			
		||||
    ng-click="$ctrl.saveGitSettings()"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,6 +55,7 @@ class StackRedeployGitFormController {
 | 
			
		|||
    this.onChangeEnvVar = this.onChangeEnvVar.bind(this);
 | 
			
		||||
    this.onChangeOption = this.onChangeOption.bind(this);
 | 
			
		||||
    this.onChangeGitAuth = this.onChangeGitAuth.bind(this);
 | 
			
		||||
    this.onChangeTLSSkipVerify = this.onChangeTLSSkipVerify.bind(this);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  buildAnalyticsProperties() {
 | 
			
		||||
| 
						 | 
				
			
			@ -94,6 +95,10 @@ class StackRedeployGitFormController {
 | 
			
		|||
    this.onChange({ Env: value });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  onChangeTLSSkipVerify(value) {
 | 
			
		||||
    this.onChange({ TLSSkipVerify: value });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  onChangeOption(values) {
 | 
			
		||||
    this.onChange({
 | 
			
		||||
      Option: {
 | 
			
		||||
| 
						 | 
				
			
			@ -189,6 +194,7 @@ class StackRedeployGitFormController {
 | 
			
		|||
 | 
			
		||||
  async $onInit() {
 | 
			
		||||
    this.formValues.RefName = this.model.ReferenceName;
 | 
			
		||||
    this.formValues.TLSSkipVerify = this.model.TLSSkipVerify;
 | 
			
		||||
    this.formValues.Env = this.stack.Env;
 | 
			
		||||
 | 
			
		||||
    if (this.stack.Option) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
<form name="$ctrl.redeployGitForm" class="form-horizontal my-8">
 | 
			
		||||
  <div class="col-sm-12 form-section-title"> Redeploy from git repository </div>
 | 
			
		||||
 | 
			
		||||
  <git-form-info-panel
 | 
			
		||||
    class-name="'text-muted small'"
 | 
			
		||||
    url="$ctrl.model.URL"
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +18,7 @@
 | 
			
		|||
    webhook-id="{{ $ctrl.state.webhookId }}"
 | 
			
		||||
    webhooks-docs="https://docs.portainer.io/user/docker/stacks/webhooks"
 | 
			
		||||
  ></git-form-auto-update-fieldset>
 | 
			
		||||
 | 
			
		||||
  <div class="form-group">
 | 
			
		||||
    <div class="col-sm-12">
 | 
			
		||||
      <p>
 | 
			
		||||
| 
						 | 
				
			
			@ -37,6 +39,7 @@
 | 
			
		|||
    is-url-valid="true"
 | 
			
		||||
    stack-id="$ctrl.gitStackId"
 | 
			
		||||
  ></git-form-ref-field>
 | 
			
		||||
 | 
			
		||||
  <git-form-auth-fieldset
 | 
			
		||||
    ng-if="$ctrl.state.showConfig"
 | 
			
		||||
    value="$ctrl.formValues"
 | 
			
		||||
| 
						 | 
				
			
			@ -45,12 +48,26 @@
 | 
			
		|||
    is-auth-edit="$ctrl.state.isAuthEdit"
 | 
			
		||||
  ></git-form-auth-fieldset>
 | 
			
		||||
 | 
			
		||||
  <div class="form-group" ng-if="$ctrl.state.showConfig">
 | 
			
		||||
    <div class="col-sm-12">
 | 
			
		||||
      <por-switch-field
 | 
			
		||||
        name="TLSSkipVerify"
 | 
			
		||||
        checked="$ctrl.formValues.TLSSkipVerify"
 | 
			
		||||
        tooltip="'Enabling this will allow skipping TLS validation for any self-signed certificate.'"
 | 
			
		||||
        label-class="'col-sm-3 col-lg-2'"
 | 
			
		||||
        label="'Skip TLS Verification'"
 | 
			
		||||
        on-change="($ctrl.onChangeTLSSkipVerify)"
 | 
			
		||||
      ></por-switch-field>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <environment-variables-panel
 | 
			
		||||
    ng-model="$ctrl.formValues.Env"
 | 
			
		||||
    explanation="These values will be used as substitutions in the stack file"
 | 
			
		||||
    on-change="($ctrl.onChangeEnvVar)"
 | 
			
		||||
    show-help-message="true"
 | 
			
		||||
  ></environment-variables-panel>
 | 
			
		||||
 | 
			
		||||
  <option-panel ng-if="$ctrl.stack.Type === 1 && $ctrl.endpoint.apiVersion >= 1.27" ng-model="$ctrl.formValues.Option" on-change="($ctrl.onChangeOption)"></option-panel>
 | 
			
		||||
 | 
			
		||||
  <div class="col-sm-12 form-section-title"> Actions </div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -284,6 +284,7 @@ angular.module('portainer.app').factory('StackService', [
 | 
			
		|||
          RepositoryAuthentication: gitConfig.RepositoryAuthentication,
 | 
			
		||||
          RepositoryUsername: gitConfig.RepositoryUsername,
 | 
			
		||||
          RepositoryPassword: gitConfig.RepositoryPassword,
 | 
			
		||||
          TLSSkipVerify: gitConfig.TLSSkipVerify,
 | 
			
		||||
        };
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -468,6 +469,7 @@ angular.module('portainer.app').factory('StackService', [
 | 
			
		|||
          RepositoryUsername: gitConfig.RepositoryUsername,
 | 
			
		||||
          RepositoryPassword: gitConfig.RepositoryPassword,
 | 
			
		||||
          Prune: gitConfig.Option.Prune,
 | 
			
		||||
          TLSSkipVerify: gitConfig.TLSSkipVerify,
 | 
			
		||||
        }
 | 
			
		||||
      ).$promise;
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue