mirror of https://github.com/portainer/portainer
fix(git-stacks): UI bugs when using a PAT when deploying from Git [EE-1731] (#5882)
parent
5ba80c3a44
commit
32756f9e1b
|
@ -146,6 +146,10 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) *
|
||||||
Username: payload.RepositoryUsername,
|
Username: payload.RepositoryUsername,
|
||||||
Password: password,
|
Password: password,
|
||||||
}
|
}
|
||||||
|
_, err = handler.GitService.LatestCommitID(stack.GitConfig.URL, stack.GitConfig.ReferenceName, stack.GitConfig.Authentication.Username, stack.GitConfig.Authentication.Password)
|
||||||
|
if err != nil {
|
||||||
|
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to fetch git repository", Err: err}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if payload.AutoUpdate != nil && payload.AutoUpdate.Interval != "" {
|
if payload.AutoUpdate != nil && payload.AutoUpdate.Interval != "" {
|
||||||
|
|
|
@ -74,6 +74,10 @@ func (handler *Handler) updateKubernetesStack(r *http.Request, stack *portainer.
|
||||||
Username: payload.RepositoryUsername,
|
Username: payload.RepositoryUsername,
|
||||||
Password: password,
|
Password: password,
|
||||||
}
|
}
|
||||||
|
_, err := handler.GitService.LatestCommitID(stack.GitConfig.URL, stack.GitConfig.ReferenceName, stack.GitConfig.Authentication.Username, stack.GitConfig.Authentication.Password)
|
||||||
|
if err != nil {
|
||||||
|
return &httperror.HandlerError{StatusCode: http.StatusInternalServerError, Message: "Unable to fetch git repository", Err: err}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stack.GitConfig.Authentication = nil
|
stack.GitConfig.Authentication = nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,13 @@ class GitFormComposeAuthFieldsetController {
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
this.authValues.username = this.model.RepositoryUsername;
|
this.authValues.username = this.model.RepositoryUsername;
|
||||||
this.authValues.password = this.model.RepositoryPassword;
|
this.authValues.password = this.model.RepositoryPassword;
|
||||||
this.onChange({
|
|
||||||
...this.model,
|
|
||||||
RepositoryAuthentication: true,
|
|
||||||
RepositoryUsername: '',
|
|
||||||
RepositoryPassword: '',
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onChange({
|
this.onChange({
|
||||||
...this.model,
|
...this.model,
|
||||||
RepositoryAuthentication: false,
|
RepositoryAuthentication: auth,
|
||||||
RepositoryUsername: this.authValues.username,
|
RepositoryUsername: auth ? this.authValues.username : '',
|
||||||
RepositoryPassword: this.authValues.password,
|
RepositoryPassword: auth ? this.authValues.password : '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
class="form-control"
|
class="form-control"
|
||||||
ng-model="$ctrl.model.RepositoryPassword"
|
ng-model="$ctrl.model.RepositoryPassword"
|
||||||
name="repository_password"
|
name="repository_password"
|
||||||
placeholder="personal access token"
|
placeholder="*******"
|
||||||
ng-change="$ctrl.onChangePassword($ctrl.model.RepositoryPassword)"
|
ng-change="$ctrl.onChangePassword($ctrl.model.RepositoryPassword)"
|
||||||
ng-required="!$ctrl.isEdit"
|
ng-required="!$ctrl.isEdit"
|
||||||
data-cy="component-gitPasswordInput"
|
data-cy="component-gitPasswordInput"
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
class="btn btn-sm btn-primary"
|
class="btn btn-sm btn-primary"
|
||||||
ng-click="$ctrl.submit()"
|
ng-click="$ctrl.submit()"
|
||||||
ng-if="!$ctrl.formValues.AutoUpdate.RepositoryAutomaticUpdates"
|
ng-if="!$ctrl.formValues.AutoUpdate.RepositoryAutomaticUpdates"
|
||||||
ng-disabled="$ctrl.isSubmitButtonDisabled() || $ctrl.state.hasUnsavedChanges || !$ctrl.redeployGitForm.$valid"
|
ng-disabled="$ctrl.isSubmitButtonDisabled() || $ctrl.state.hasUnsavedChanges || !$ctrl.redeployGitForm.$valid || ($ctrl.formValues.RepositoryAuthentication && !$ctrl.formValues.RepositoryPassword)"
|
||||||
style="margin-top: 7px; margin-left: 0;"
|
style="margin-top: 7px; margin-left: 0;"
|
||||||
button-spinner="$ctrl.state.redeployInProgress"
|
button-spinner="$ctrl.state.redeployInProgress"
|
||||||
analytics-on
|
analytics-on
|
||||||
|
|
Loading…
Reference in New Issue