// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack."
// @param body body stackGitRedployPayload true "Git configs for pull and redeploy a stack"
return&httperror.HandlerError{StatusCode:http.StatusNotFound,Message:"Unable to find a stack with the specified identifier inside the database",Err:err}
}elseiferr!=nil{
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to find a stack with the specified identifier inside the database",Err:err}
}
ifstack.GitConfig==nil{
return&httperror.HandlerError{StatusCode:http.StatusBadRequest,Message:"Stack is not created from git",Err:err}
}
// TODO: this is a work-around for stacks created with Portainer version >= 1.17.1
// The EndpointID property is not available for these stacks, this API endpoint
// can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack.
return&httperror.HandlerError{StatusCode:http.StatusNotFound,Message:"Unable to find the endpoint associated to the stack inside the database",Err:err}
}elseiferr!=nil{
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to find the endpoint associated to the stack inside the database",Err:err}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to retrieve a resource control associated to the stack",Err:err}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to verify user authorizations to validate stack access",Err:err}
}
if!access{
return&httperror.HandlerError{StatusCode:http.StatusForbidden,Message:"Access denied to resource",Err:httperrors.ErrResourceAccessDenied}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable get latest commit id",Err:errors.WithMessagef(err,"failed to fetch latest commit id of the stack %v",stack.ID)}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to persist the stack changes inside the database",Err:errors.Wrap(err,"failed to update the stack")}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Invalid namespace",Err:errors.New("Namespace must not be empty when redeploying kubernetes stacks")}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to read deployment.yml manifest file",Err:errors.Wrap(err,"failed to read manifest file")}
return&httperror.HandlerError{StatusCode:http.StatusInternalServerError,Message:"Unable to redeploy Kubernetes stack",Err:errors.WithMessage(err,"failed to deploy kube application")}