Skip to content
Snippets Groups Projects
Commit 29c01c6c authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent eed996ac
No related branches found
No related tags found
No related merge requests found
Showing
with 172 additions and 23 deletions
Loading
Loading
@@ -449,7 +449,7 @@ group :ed25519 do
end
 
# Gitaly GRPC protocol definitions
gem 'gitaly', '~> 1.65.0'
gem 'gitaly', '~> 1.70.0'
 
gem 'grpc', '~> 1.24.0'
 
Loading
Loading
Loading
Loading
@@ -358,7 +358,7 @@ GEM
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
git (1.5.0)
gitaly (1.65.0)
gitaly (1.70.0)
grpc (~> 1.0)
github-markup (1.7.0)
gitlab-labkit (0.7.0)
Loading
Loading
@@ -1167,7 +1167,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
gitaly (~> 1.65.0)
gitaly (~> 1.70.0)
github-markup (~> 1.7.0)
gitlab-labkit (~> 0.5)
gitlab-license (~> 1.0)
Loading
Loading
Loading
Loading
@@ -301,6 +301,7 @@ export default {
v-if="showContentViewer"
:content="file.content || file.raw"
:path="file.rawPath || file.path"
:file-path="file.path"
:file-size="file.size"
:project-path="file.projectId"
:type="fileType"
Loading
Loading
Loading
Loading
@@ -18,6 +18,11 @@ export default {
required: false,
default: 0,
},
filePath: {
type: String,
required: false,
default: '',
},
projectPath: {
type: String,
required: false,
Loading
Loading
@@ -52,6 +57,7 @@ export default {
<component
:is="viewer"
:path="path"
:file-path="filePath"
:file-size="fileSize"
:project-path="projectPath"
:content="content"
Loading
Loading
Loading
Loading
@@ -16,6 +16,11 @@ export default {
type: String,
required: true,
},
filePath: {
type: String,
required: false,
default: '',
},
projectPath: {
type: String,
required: true,
Loading
Loading
@@ -48,6 +53,7 @@ export default {
this.isLoading = true;
const postBody = {
text: this.content,
path: this.filePath,
};
const postOptions = {
cancelToken: axiosSource.token,
Loading
Loading
Loading
Loading
@@ -7,17 +7,8 @@ module PreviewMarkdown
def preview_markdown
result = PreviewMarkdownService.new(@project, current_user, markdown_service_params).execute
 
markdown_params =
case controller_name
when 'wikis' then { pipeline: :wiki, project_wiki: @project_wiki, page_slug: params[:id] }
when 'snippets' then { skip_project_check: true }
when 'groups' then { group: group }
when 'projects' then projects_filter_params
else {}
end
render json: {
body: view_context.markdown(result[:text], markdown_params),
body: view_context.markdown(result[:text], markdown_context_params),
references: {
users: result[:users],
suggestions: SuggestionSerializer.new.represent_diff(result[:suggestions]),
Loading
Loading
@@ -38,5 +29,16 @@ module PreviewMarkdown
def markdown_service_params
params
end
def markdown_context_params
case controller_name
when 'wikis' then { pipeline: :wiki, project_wiki: @project_wiki, page_slug: params[:id] }
when 'snippets' then { skip_project_check: true }
when 'groups' then { group: group }
when 'projects' then projects_filter_params
else {}
end.merge(requested_path: params[:path])
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
end
Loading
Loading
@@ -5,12 +5,15 @@ module Clusters
class ElasticStack < ApplicationRecord
VERSION = '1.8.0'
 
ELASTICSEARCH_PORT = 9200
self.table_name = 'clusters_applications_elastic_stacks'
 
include ::Clusters::Concerns::ApplicationCore
include ::Clusters::Concerns::ApplicationStatus
include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
include ::Gitlab::Utils::StrongMemoize
 
default_value_for :version, VERSION
 
Loading
Loading
@@ -49,6 +52,28 @@ module Clusters
)
end
 
def elasticsearch_client
strong_memoize(:elasticsearch_client) do
next unless kube_client
proxy_url = kube_client.proxy_url('service', 'elastic-stack-elasticsearch-client', ::Clusters::Applications::ElasticStack::ELASTICSEARCH_PORT, Gitlab::Kubernetes::Helm::NAMESPACE)
Elasticsearch::Client.new(url: proxy_url) do |faraday|
# ensures headers containing auth data are appended to original client options
faraday.headers.merge!(kube_client.headers)
# ensure TLS certs are properly verified
faraday.ssl[:verify] = kube_client.ssl_options[:verify_ssl]
faraday.ssl[:cert_store] = kube_client.ssl_options[:cert_store]
end
rescue Kubeclient::HttpError => error
# If users have mistakenly set parameters or removed the depended clusters,
# `proxy_url` could raise an exception because gitlab can not communicate with the cluster.
# We check for a nil client in downstream use and behaviour is equivalent to an empty state
log_exception(error, :failed_to_create_elasticsearch_client)
end
end
private
 
def specification
Loading
Loading
@@ -74,6 +99,10 @@ module Clusters
Gitlab::Kubernetes::KubectlCmd.delete("pvc", "--selector", "release=elastic-stack")
].compact
end
def kube_client
cluster&.kubeclient&.core_client
end
end
end
end
Loading
Loading
@@ -60,6 +60,24 @@ module Clusters
# Override if your application needs any action after
# being uninstalled by Helm
end
def logger
@logger ||= Gitlab::Kubernetes::Logger.build
end
def log_exception(error, event)
logger.error({
exception: error.class.name,
status_code: error.error_code,
cluster_id: cluster&.id,
application_id: id,
class_name: self.class.name,
event: event,
message: error.message
})
Gitlab::Sentry.track_acceptable_exception(error, extra: { cluster_id: cluster&.id, application_id: id })
end
end
end
end
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ class Environment < ApplicationRecord
has_one :last_deployment, -> { success.order('deployments.id DESC') }, class_name: 'Deployment'
has_one :last_deployable, through: :last_deployment, source: 'deployable', source_type: 'CommitStatus'
has_one :last_pipeline, through: :last_deployable, source: 'pipeline'
has_one :last_visible_deployment, -> { visible.distinct_on_environment }, class_name: 'Deployment'
has_one :last_visible_deployment, -> { visible.distinct_on_environment }, inverse_of: :environment, class_name: 'Deployment'
has_one :last_visible_deployable, through: :last_visible_deployment, source: 'deployable', source_type: 'CommitStatus'
has_one :last_visible_pipeline, through: :last_visible_deployable, source: 'pipeline'
 
Loading
Loading
@@ -66,6 +66,9 @@ class Environment < ApplicationRecord
scope :for_project, -> (project) { where(project_id: project) }
scope :with_deployment, -> (sha) { where('EXISTS (?)', Deployment.select(1).where('deployments.environment_id = environments.id').where(sha: sha)) }
scope :unfoldered, -> { where(environment_type: nil) }
scope :with_rank, -> do
select('environments.*, rank() OVER (PARTITION BY project_id ORDER BY id DESC)')
end
 
state_machine :state, initial: :available do
event :start do
Loading
Loading
Loading
Loading
@@ -287,7 +287,7 @@ class Project < ApplicationRecord
has_many :variables, class_name: 'Ci::Variable'
has_many :triggers, class_name: 'Ci::Trigger'
has_many :environments
has_many :unfoldered_environments, -> { unfoldered.available }, class_name: 'Environment'
has_many :environments_for_dashboard, -> { from(with_rank.unfoldered.available, :environments).where('rank <= 3') }, class_name: 'Environment'
has_many :deployments
has_many :pipeline_schedules, class_name: 'Ci::PipelineSchedule'
has_many :project_deploy_tokens
Loading
Loading
Loading
Loading
@@ -50,16 +50,24 @@ class BaseService
 
private
 
def error(message, http_status = nil)
# Return a Hash with an `error` status
#
# message - Error message to include in the Hash
# http_status - Optional HTTP status code override (default: nil)
# pass_back - Additional attributes to be included in the resulting Hash
def error(message, http_status = nil, pass_back: {})
result = {
message: message,
status: :error
}
}.reverse_merge(pass_back)
 
result[:http_status] = http_status if http_status
result
end
 
# Return a Hash with a `success` status
#
# pass_back - Additional attributes to be included in the resulting Hash
def success(pass_back = {})
pass_back[:status] = :success
pass_back
Loading
Loading
Loading
Loading
@@ -23,14 +23,15 @@ module Commits
message,
start_project: @start_project,
start_branch_name: @start_branch)
rescue Gitlab::Git::Repository::CreateTreeError
rescue Gitlab::Git::Repository::CreateTreeError => ex
act = action.to_s.dasherize
type = @commit.change_type_title(current_user)
 
error_msg = "Sorry, we cannot #{act} this #{type} automatically. " \
"This #{type} may already have been #{act}ed, or a more recent " \
"commit may have updated some of its content."
raise ChangeError, error_msg
raise ChangeError.new(error_msg, ex.error_code)
end
end
end
Loading
Loading
@@ -3,7 +3,15 @@
module Commits
class CreateService < ::BaseService
ValidationError = Class.new(StandardError)
ChangeError = Class.new(StandardError)
class ChangeError < StandardError
attr_reader :error_code
def initialize(message, error_code = nil)
super(message)
@error_code = error_code
end
end
 
def initialize(*args)
super
Loading
Loading
@@ -21,8 +29,9 @@ module Commits
new_commit = create_commit!
 
success(result: new_commit)
rescue ChangeError => ex
error(ex.message, pass_back: { error_code: ex.error_code })
rescue ValidationError,
ChangeError,
Gitlab::Git::Index::IndexError,
Gitlab::Git::CommitError,
Gitlab::Git::PreReceiveError,
Loading
Loading
---
title: Enable environments dashboard by default
merge_request: 19838
author:
type: added
---
title: Fix broken images when previewing markdown files in Web IDE
merge_request: 18899
author:
type: fixed
---
title: Increase PumaWorkerKiller memory limit in development environment
merge_request: 20039
author:
type: performance
---
title: Helm v2.16.1
merge_request: 19981
author:
type: fixed
---
title: 'Add an `error_code` attribute to the API response when a cherry-pick or revert fails.'
merge_request: 19518
author:
type: added
Loading
Loading
@@ -317,6 +317,21 @@ Example response:
}
```
 
In the event of a failed cherry-pick, the response will provide context about
why:
```json
{
"message": "Sorry, we cannot cherry-pick this commit automatically. This commit may already have been cherry-picked, or a more recent commit may have updated some of its content.",
"error_code": "empty"
}
```
In this case, the cherry-pick failed because the changeset was empty and likely
indicates that the commit already exists in the target branch. The other
possible error code is `conflict`, which indicates that there was a merge
conflict.
## Revert a commit
 
> [Introduced][ce-22919] in GitLab 11.5.
Loading
Loading
@@ -358,6 +373,19 @@ Example response:
}
```
 
In the event of a failed revert, the response will provide context about why:
```json
{
"message": "Sorry, we cannot revert this commit automatically. This commit may already have been reverted, or a more recent commit may have updated some of its content.",
"error_code": "conflict"
}
```
In this case, the revert failed because the attempted revert generated a merge
conflict. The other possible error code is `empty`, which indicates that the
changeset was empty, likely due to the change having already been reverted.
## Get the diff of a commit
 
Get the diff of a commit in a project.
Loading
Loading
Loading
Loading
@@ -32,10 +32,23 @@ Management projects are restricted to the following:
 
## Usage
 
To use a cluster management project for a cluster:
1. Select the project.
1. Configure your pipelines.
1. Set an environment scope.
### Selecting a cluster management project
 
You can select a management project for the cluster under **Advanced
settings**.
To select a cluster management project to use:
1. Navigate to the appropriate configuration page. For a:
- [Project-level cluster](../project/clusters/index.md), navigate to your project's
**Operations > Kubernetes** page.
- [Group-level cluster](../group/clusters/index.md), navigate to your group's **Kubernetes**
page.
1. Select the project using **Cluster management project field** in the **Advanced settings**
section.
 
![Selecting a cluster management project under Advanced settings](img/advanced-settings-cluster-management-project-v12_5.png)
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment