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

Add latest changes from gitlab-org/gitlab@master

parent 898e2cc1
No related branches found
No related tags found
No related merge requests found
Showing with 139 additions and 20 deletions
Loading
@@ -23,11 +23,11 @@ build-qa-image:
Loading
@@ -23,11 +23,11 @@ build-qa-image:
stage: prepare stage: prepare
script: script:
- '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"' - '[[ ! -d "ee/" ]] || export GITLAB_EDITION="ee"'
- export QA_MASTER_IMAGE="${CI_REGISTRY}/gitlab-org/gitlab/gitlab/gitlab-${GITLAB_EDITION}-qa:master" - export QA_MASTER_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:master"
- export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}" - export QA_IMAGE="${CI_REGISTRY}/${CI_PROJECT_PATH}/gitlab/gitlab-${GITLAB_EDITION}-qa:${CI_COMMIT_REF_SLUG}"
- echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
- time docker pull "${QA_MASTER_IMAGE}" - time docker pull "${QA_MASTER_IMAGE}"
- time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./ - time docker build --cache-from "${QA_MASTER_IMAGE}" --tag ${QA_IMAGE} --file ./qa/Dockerfile ./
- echo "${CI_JOB_TOKEN}" | docker login --username gitlab-ci-token --password-stdin ${CI_REGISTRY}
- time docker push ${QA_IMAGE} - time docker push ${QA_IMAGE}
   
.base-review-cleanup: .base-review-cleanup:
Loading
Loading
Loading
@@ -13,18 +13,18 @@ class DeploymentMetrics
Loading
@@ -13,18 +13,18 @@ class DeploymentMetrics
end end
   
def has_metrics? def has_metrics?
deployment.success? && prometheus_adapter&.can_query? deployment.success? && prometheus_adapter&.configured?
end end
   
def metrics def metrics
return {} unless has_metrics? return {} unless has_metrics_and_can_query?
   
metrics = prometheus_adapter.query(:deployment, deployment) metrics = prometheus_adapter.query(:deployment, deployment)
metrics&.merge(deployment_time: deployment.finished_at.to_i) || {} metrics&.merge(deployment_time: deployment.finished_at.to_i) || {}
end end
   
def additional_metrics def additional_metrics
return {} unless has_metrics? return {} unless has_metrics_and_can_query?
   
metrics = prometheus_adapter.query(:additional_metrics_deployment, deployment) metrics = prometheus_adapter.query(:additional_metrics_deployment, deployment)
metrics&.merge(deployment_time: deployment.finished_at.to_i) || {} metrics&.merge(deployment_time: deployment.finished_at.to_i) || {}
Loading
@@ -47,4 +47,8 @@ class DeploymentMetrics
Loading
@@ -47,4 +47,8 @@ class DeploymentMetrics
def cluster_prometheus def cluster_prometheus
cluster.application_prometheus if cluster&.application_prometheus_available? cluster.application_prometheus if cluster&.application_prometheus_available?
end end
def has_metrics_and_can_query?
has_metrics? && prometheus_adapter.can_query?
end
end end
Loading
@@ -208,7 +208,7 @@ class Environment < ApplicationRecord
Loading
@@ -208,7 +208,7 @@ class Environment < ApplicationRecord
end end
   
def metrics def metrics
prometheus_adapter.query(:environment, self) if has_metrics? && prometheus_adapter.can_query? prometheus_adapter.query(:environment, self) if has_metrics_and_can_query?
end end
   
def prometheus_status def prometheus_status
Loading
@@ -216,7 +216,7 @@ class Environment < ApplicationRecord
Loading
@@ -216,7 +216,7 @@ class Environment < ApplicationRecord
end end
   
def additional_metrics(*args) def additional_metrics(*args)
return unless has_metrics? return unless has_metrics_and_can_query?
   
prometheus_adapter.query(:additional_metrics_environment, self, *args.map(&:to_f)) prometheus_adapter.query(:additional_metrics_environment, self, *args.map(&:to_f))
end end
Loading
@@ -285,6 +285,10 @@ class Environment < ApplicationRecord
Loading
@@ -285,6 +285,10 @@ class Environment < ApplicationRecord
   
private private
   
def has_metrics_and_can_query?
has_metrics? && prometheus_adapter.can_query?
end
def generate_slug def generate_slug
self.slug = Gitlab::Slug::Environment.new(name).generate self.slug = Gitlab::Slug::Environment.new(name).generate
end end
Loading
Loading
Loading
@@ -4,9 +4,7 @@ module Notes
Loading
@@ -4,9 +4,7 @@ module Notes
class CreateService < ::Notes::BaseService class CreateService < ::Notes::BaseService
# rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/CyclomaticComplexity
def execute def execute
merge_request_diff_head_sha = params.delete(:merge_request_diff_head_sha) note = Notes::BuildService.new(project, current_user, params.except(:merge_request_diff_head_sha)).execute
note = Notes::BuildService.new(project, current_user, params).execute
   
# n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/37440 # n+1: https://gitlab.com/gitlab-org/gitlab-foss/issues/37440
note_valid = Gitlab::GitalyClient.allow_n_plus_1_calls do note_valid = Gitlab::GitalyClient.allow_n_plus_1_calls do
Loading
@@ -23,8 +21,7 @@ module Notes
Loading
@@ -23,8 +21,7 @@ module Notes
quick_actions_service = QuickActionsService.new(project, current_user) quick_actions_service = QuickActionsService.new(project, current_user)
   
if quick_actions_service.supported?(note) if quick_actions_service.supported?(note)
options = { merge_request_diff_head_sha: merge_request_diff_head_sha } content, update_params, message = quick_actions_service.execute(note, quick_action_options)
content, update_params, message = quick_actions_service.execute(note, options)
   
only_commands = content.empty? only_commands = content.empty?
   
Loading
@@ -74,6 +71,11 @@ module Notes
Loading
@@ -74,6 +71,11 @@ module Notes
   
private private
   
# EE::Notes::CreateService would override this method
def quick_action_options
{ merge_request_diff_head_sha: params[:merge_request_diff_head_sha] }
end
def tracking_data_for(note) def tracking_data_for(note)
label = Gitlab.ee? && note.author == User.visual_review_bot ? 'anonymous_visual_review_note' : 'note' label = Gitlab.ee? && note.author == User.visual_review_bot ? 'anonymous_visual_review_note' : 'note'
   
Loading
@@ -84,3 +86,5 @@ module Notes
Loading
@@ -84,3 +86,5 @@ module Notes
end end
end end
end end
Notes::CreateService.prepend_if_ee('EE::Notes::CreateService')
---
title: Prevent MergeRequestsController#ci_environment_status.json from making HTTP requests
merge_request: 21812
author:
type: fixed
---
title: Fix transferring groups to root when EE features are enabled
merge_request: 21915
author:
type: fixed
Loading
@@ -421,6 +421,47 @@ etc. For example:
Loading
@@ -421,6 +421,47 @@ etc. For example:
{"severity":"DEBUG","time":"2019-10-17T06:23:13.227Z","correlation_id":null,"message":"redacted_search_result","class_name":"Milestone","id":2,"ability":"read_milestone","current_user_id":2,"query":"project"} {"severity":"DEBUG","time":"2019-10-17T06:23:13.227Z","correlation_id":null,"message":"redacted_search_result","class_name":"Milestone","id":2,"ability":"read_milestone","current_user_id":2,"query":"project"}
``` ```
   
## `exceptions_json.log`
> [Introduced](https://gitlab.com/gitlab-org/gitlab/merge_requests/17819) in GitLab 12.6.
This file lives in
`/var/log/gitlab/gitlab-rails/exceptions_json.log` for Omnibus GitLab
packages or in `/home/git/gitlab/log/exceptions_json.log` for installations
from source.
It logs the information about exceptions being tracked by `Gitlab::ErrorTracking` which provides standard and consistent way of [processing rescued exceptions](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/development/logging.md#exception-handling).
Each line contains a JSON line that can be ingested by Elasticsearch. For example:
```json
{
"severity": "ERROR",
"time": "2019-12-17T11:49:29.485Z",
"correlation_id": "AbDVUrrTvM1",
"extra.server": {
"os": {
"name": "Darwin",
"version": "Darwin Kernel Version 19.2.0",
"build": "19.2.0",
},
"runtime": {
"name": "ruby",
"version": "ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]"
}
},
"extra.project_id": 55,
"extra.relation_key": "milestones",
"extra.relation_index": 1,
"exception.class": "NoMethodError",
"exception.message": "undefined method `strong_memoize' for #<Gitlab::ImportExport::RelationFactory:0x00007fb5d917c4b0>",
"exception.backtrace": [
"lib/gitlab/import_export/relation_factory.rb:329:in `unique_relation?'",
"lib/gitlab/import_export/relation_factory.rb:345:in `find_or_create_object!'"
]
}
```
[repocheck]: repository_checks.md [repocheck]: repository_checks.md
[Rack Attack]: ../security/rack_attack.md [Rack Attack]: ../security/rack_attack.md
[Rate Limit]: ../user/admin_area/settings/rate_limits_on_raw_endpoints.md [Rate Limit]: ../user/admin_area/settings/rate_limits_on_raw_endpoints.md
Loading
Loading
Loading
@@ -352,7 +352,10 @@ bottom of the screen with two buttons:
Loading
@@ -352,7 +352,10 @@ bottom of the screen with two buttons:
Clicking **Submit review** will publish all comments. Any quick actions Clicking **Submit review** will publish all comments. Any quick actions
submitted are performed at this time. submitted are performed at this time.
   
Alternatively, every pending comment has a button to finish the entire review. Alternatively, to finish the entire review from a pending comment:
- Click the **Finish review** button on the comment.
- Use the `/submit_review` [quick action](../project/quick_actions.md) in the text of non-review comment.
   
![Review submission](img/review_preview.png) ![Review submission](img/review_preview.png)
   
Loading
Loading
Loading
@@ -68,7 +68,8 @@ The following quick actions are applicable to descriptions, discussions and thre
Loading
@@ -68,7 +68,8 @@ The following quick actions are applicable to descriptions, discussions and thre
| `/remove_zoom` | ✓ | | | Remove Zoom meeting from this issue. ([Introduced in GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/merge_requests/16609)) | | `/remove_zoom` | ✓ | | | Remove Zoom meeting from this issue. ([Introduced in GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/merge_requests/16609)) |
| `/target_branch <local branch name>` | | ✓ | | Set target branch | | `/target_branch <local branch name>` | | ✓ | | Set target branch |
| `/wip` | | ✓ | | Toggle the Work In Progress status | | `/wip` | | ✓ | | Toggle the Work In Progress status |
| `/approve` | | ✓ | | Approve the merge request | | `/approve` | | ✓ | | Approve the merge request **(STARTER)** |
| `/submit_review` | | ✓ | | Submit a pending review. ([Introduced in GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/issues/8041)) **(PREMIUM)** |
| `/merge` | | ✓ | | Merge (when pipeline succeeds) | | `/merge` | | ✓ | | Merge (when pipeline succeeds) |
| `/child_epic <epic>` | | | ✓ | Add child epic to `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** | | `/child_epic <epic>` | | | ✓ | Add child epic to `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** |
| `/remove_child_epic <epic>` | | | ✓ | Remove child epic from `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** | | `/remove_child_epic <epic>` | | | ✓ | Remove child epic from `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** |
Loading
Loading
Loading
@@ -116,6 +116,35 @@ rendered to HTML when viewed.
Loading
@@ -116,6 +116,35 @@ rendered to HTML when viewed.
Interactive features, including JavaScript plots, will not work when viewed in Interactive features, including JavaScript plots, will not work when viewed in
GitLab. GitLab.
   
### OpenAPI viewer
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/19515) in GitLab 12.6.
GitLab can render OpenAPI specification files with its file viewer, provided
their filenames include `openapi` or `swagger` and their extension is `yaml`,
`yml`, or `json`. The following examples are all correct:
- `openapi.yml`
- `openapi.yaml`
- `openapi.json`
- `swagger.yml`
- `swagger.yaml`
- `swagger.json`
- `gitlab_swagger.yml`
- `openapi_gitlab.yml`
- `OpenAPI.YML`
- `openapi.Yaml`
- `openapi.JSON`
- `openapi.gitlab.yml`
- `gitlab.openapi.yml`
Then, to render them:
1. Navigate to the OpenAPI file in your repository in GitLab's UI.
1. Click the "Display OpenAPI" button which is located between the "Display source"
and "Edit" buttons (when an OpenAPI file is found, it replaces the
"Display rendered file" button).
## Branches ## Branches
   
For details, see [Branches](branches/index.md). For details, see [Branches](branches/index.md).
Loading
Loading
Loading
@@ -363,6 +363,10 @@ module API
Loading
@@ -363,6 +363,10 @@ module API
render_api_error!('204 No Content', 204) render_api_error!('204 No Content', 204)
end end
   
def created!
render_api_error!('201 Created', 201)
end
def accepted! def accepted!
render_api_error!('202 Accepted', 202) render_api_error!('202 Accepted', 202)
end end
Loading
Loading
Loading
@@ -17283,6 +17283,9 @@ msgstr ""
Loading
@@ -17283,6 +17283,9 @@ msgstr ""
msgid "Subkeys" msgid "Subkeys"
msgstr "" msgstr ""
   
msgid "Submit a review"
msgstr ""
msgid "Submit as spam" msgid "Submit as spam"
msgstr "" msgstr ""
   
Loading
@@ -17298,6 +17301,12 @@ msgstr ""
Loading
@@ -17298,6 +17301,12 @@ msgstr ""
msgid "Submit search" msgid "Submit search"
msgstr "" msgstr ""
   
msgid "Submit the current review."
msgstr ""
msgid "Submitted the current review."
msgstr ""
msgid "Subscribe" msgid "Subscribe"
msgstr "" msgstr ""
   
Loading
Loading
Loading
@@ -20,7 +20,7 @@ describe DeploymentMetrics do
Loading
@@ -20,7 +20,7 @@ describe DeploymentMetrics do
end end
   
context 'with a Prometheus Service' do context 'with a Prometheus Service' do
let(:prometheus_service) { instance_double(PrometheusService, can_query?: true) } let(:prometheus_service) { instance_double(PrometheusService, can_query?: true, configured?: true) }
   
before do before do
allow(deployment.project).to receive(:find_or_initialize_service).with('prometheus').and_return prometheus_service allow(deployment.project).to receive(:find_or_initialize_service).with('prometheus').and_return prometheus_service
Loading
@@ -30,7 +30,17 @@ describe DeploymentMetrics do
Loading
@@ -30,7 +30,17 @@ describe DeploymentMetrics do
end end
   
context 'with a Prometheus Service that cannot query' do context 'with a Prometheus Service that cannot query' do
let(:prometheus_service) { instance_double(PrometheusService, can_query?: false) } let(:prometheus_service) { instance_double(PrometheusService, configured?: true, can_query?: false) }
before do
allow(deployment.project).to receive(:find_or_initialize_service).with('prometheus').and_return prometheus_service
end
it { is_expected.to be_falsy }
end
context 'with a Prometheus Service that is not configured' do
let(:prometheus_service) { instance_double(PrometheusService, configured?: false, can_query?: false) }
   
before do before do
allow(deployment.project).to receive(:find_or_initialize_service).with('prometheus').and_return prometheus_service allow(deployment.project).to receive(:find_or_initialize_service).with('prometheus').and_return prometheus_service
Loading
@@ -44,7 +54,7 @@ describe DeploymentMetrics do
Loading
@@ -44,7 +54,7 @@ describe DeploymentMetrics do
let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: deployment.cluster) } let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: deployment.cluster) }
   
before do before do
expect(deployment.cluster.application_prometheus).to receive(:can_query?).and_return(true) expect(deployment.cluster.application_prometheus).to receive(:configured?).and_return(true)
end end
   
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
Loading
@@ -54,7 +64,7 @@ describe DeploymentMetrics do
Loading
@@ -54,7 +64,7 @@ describe DeploymentMetrics do
   
describe '#metrics' do describe '#metrics' do
let(:deployment) { create(:deployment, :success) } let(:deployment) { create(:deployment, :success) }
let(:prometheus_adapter) { instance_double(PrometheusService, can_query?: true) } let(:prometheus_adapter) { instance_double(PrometheusService, can_query?: true, configured?: true) }
let(:deployment_metrics) { described_class.new(deployment.project, deployment) } let(:deployment_metrics) { described_class.new(deployment.project, deployment) }
   
subject { deployment_metrics.metrics } subject { deployment_metrics.metrics }
Loading
@@ -101,7 +111,7 @@ describe DeploymentMetrics do
Loading
@@ -101,7 +111,7 @@ describe DeploymentMetrics do
} }
end end
   
let(:prometheus_adapter) { instance_double('prometheus_adapter', can_query?: true) } let(:prometheus_adapter) { instance_double('prometheus_adapter', can_query?: true, configured?: true) }
   
before do before do
allow(deployment_metrics).to receive(:prometheus_adapter).and_return(prometheus_adapter) allow(deployment_metrics).to receive(:prometheus_adapter).and_return(prometheus_adapter)
Loading
Loading
Loading
@@ -45,7 +45,7 @@ describe EnvironmentStatusEntity do
Loading
@@ -45,7 +45,7 @@ describe EnvironmentStatusEntity do
end end
   
context 'when deployment has metrics' do context 'when deployment has metrics' do
let(:prometheus_adapter) { double('prometheus_adapter', can_query?: true) } let(:prometheus_adapter) { double('prometheus_adapter', can_query?: true, configured?: true) }
   
let(:simple_metrics) do let(:simple_metrics) do
{ {
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