Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Apr 6, 2020
1 parent cce8cf0 commit eaea945
Show file tree
Hide file tree
Showing 42 changed files with 457 additions and 240 deletions.
2 changes: 0 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,7 @@ RSpec/RepeatedExample:
- 'spec/features/merge_request/user_posts_diff_notes_spec.rb'
- 'spec/features/projects/files/template_type_dropdown_spec.rb'
- 'spec/finders/environments_finder_spec.rb'
- 'spec/frontend/fixtures/merge_requests.rb'
- 'spec/helpers/users_helper_spec.rb'
- 'spec/lib/gitlab/closing_issue_extractor_spec.rb'
- 'spec/lib/gitlab/import_export/project/relation_factory_spec.rb'
- 'spec/services/notification_service_spec.rb'
- 'spec/services/web_hook_service_spec.rb'
2 changes: 1 addition & 1 deletion GITLAB_WORKHORSE_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.29.0
8.30.0
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const popoverStates = {
},
};
export default {
dismissTrackValue: 10,
clickTrackValue: 'click_button',
components: {
GlPopover,
GlSprintf,
Expand Down Expand Up @@ -109,7 +111,16 @@ export default {
<template #title>
<span v-html="suggestTitle"></span>
<span class="ml-auto">
<gl-deprecated-button :aria-label="__('Close')" class="btn-blank" @click="onDismiss">
<gl-deprecated-button
:aria-label="__('Close')"
class="btn-blank"
name="dismiss"
:data-track-property="humanAccess"
:data-track-value="$options.dismissTrackValue"
:data-track-event="$options.clickTrackValue"
:data-track-label="trackLabel"
@click="onDismiss"
>
<gl-icon name="close" aria-hidden="true" />
</gl-deprecated-button>
</span>
Expand Down
48 changes: 48 additions & 0 deletions app/services/projects/prometheus/metrics/base_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

module Projects
module Prometheus
module Metrics
class BaseService
include Gitlab::Utils::StrongMemoize

def initialize(metric, params = {})
@metric = metric
@project = metric.project
@params = params.dup
end

protected

attr_reader :metric, :project, :params

def application
alert.environment.cluster_prometheus_adapter
end

def schedule_alert_update
return unless alert
return unless alert.environment

::Clusters::Applications::ScheduleUpdateService.new(
alert.environment.cluster_prometheus_adapter, project).execute
end

def alert
strong_memoize(:alert) { find_alert(metric) }
end

def find_alert(metric)
Projects::Prometheus::AlertsFinder
.new(project: project, metric: metric)
.execute
.first
end

def has_alert?
alert.present?
end
end
end
end
end
14 changes: 14 additions & 0 deletions app/services/projects/prometheus/metrics/destroy_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

module Projects
module Prometheus
module Metrics
class DestroyService < Metrics::BaseService
def execute
schedule_alert_update if has_alert?
metric.destroy
end
end
end
end
end
29 changes: 29 additions & 0 deletions app/services/projects/prometheus/metrics/update_service.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module Projects
module Prometheus
module Metrics
class UpdateService < Metrics::BaseService
def execute
metric.update!(params)
schedule_alert_update if requires_alert_update?
metric
end

private

def requires_alert_update?
has_alert? && (changing_title? || changing_query?)
end

def changing_title?
metric.previous_changes.include?(:title)
end

def changing_query?
metric.previous_changes.include?(:query)
end
end
end
end
end
3 changes: 2 additions & 1 deletion app/views/projects/network/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@

- if @commit
.network-graph{ data: { url: @url, commit_url: @commit_url, ref: @ref, commit_id: @commit.id } }
= spinner nil, true
.text-center.prepend-top-default
.spinner.spinner-md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Migrate .fa-spinner to .spinner for app/views/projects/network
merge_request: 25050
author: nuwe1
type: other
5 changes: 5 additions & 0 deletions changelogs/unreleased/closing-issue-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Remove duplicate spec from closing issue spec
merge_request: 28803
author: Rajendra Kadam
type: added
5 changes: 5 additions & 0 deletions changelogs/unreleased/merge-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Fix duplciate spec in merge requests
merge_request: 28856
author: Rajendra Kadam
type: added
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

class AddPartialIndexOnIdToCiJobArtifacts < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers

DOWNTIME = false
INDEX_NAME = 'index_ci_job_artifacts_file_store_is_null'

disable_ddl_transaction!

def up
add_concurrent_index :ci_job_artifacts, :id, where: 'file_store IS NULL', name: INDEX_NAME
end

def down
remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

class AddPartialIndexOnIdToLfsObjects < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers

DOWNTIME = false
INDEX_NAME = 'index_lfs_objects_file_store_is_null'

disable_ddl_transaction!

def up
add_concurrent_index :lfs_objects, :id, where: 'file_store IS NULL', name: INDEX_NAME
end

def down
remove_concurrent_index_by_name :lfs_objects, INDEX_NAME
end
end
18 changes: 18 additions & 0 deletions db/migrate/20200403185422_add_partial_index_on_id_to_uploads.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

class AddPartialIndexOnIdToUploads < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers

DOWNTIME = false
INDEX_NAME = 'index_uploads_store_is_null'

disable_ddl_transaction!

def up
add_concurrent_index :uploads, :id, where: 'store IS NULL', name: INDEX_NAME
end

def down
remove_concurrent_index_by_name :uploads, INDEX_NAME
end
end
9 changes: 9 additions & 0 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8708,6 +8708,8 @@ CREATE INDEX index_ci_daily_report_results_on_last_pipeline_id ON public.ci_dail

CREATE UNIQUE INDEX index_ci_group_variables_on_group_id_and_key ON public.ci_group_variables USING btree (group_id, key);

CREATE INDEX index_ci_job_artifacts_file_store_is_null ON public.ci_job_artifacts USING btree (id) WHERE (file_store IS NULL);

CREATE INDEX index_ci_job_artifacts_on_expire_at_and_job_id ON public.ci_job_artifacts USING btree (expire_at, job_id);

CREATE INDEX index_ci_job_artifacts_on_file_store ON public.ci_job_artifacts USING btree (file_store);
Expand Down Expand Up @@ -9328,6 +9330,8 @@ CREATE UNIQUE INDEX index_lfs_file_locks_on_project_id_and_path ON public.lfs_fi

CREATE INDEX index_lfs_file_locks_on_user_id ON public.lfs_file_locks USING btree (user_id);

CREATE INDEX index_lfs_objects_file_store_is_null ON public.lfs_objects USING btree (id) WHERE (file_store IS NULL);

CREATE INDEX index_lfs_objects_on_file_store ON public.lfs_objects USING btree (file_store);

CREATE UNIQUE INDEX index_lfs_objects_on_oid ON public.lfs_objects USING btree (oid);
Expand Down Expand Up @@ -10094,6 +10098,8 @@ CREATE INDEX index_uploads_on_store ON public.uploads USING btree (store);

CREATE INDEX index_uploads_on_uploader_and_path ON public.uploads USING btree (uploader, path);

CREATE INDEX index_uploads_store_is_null ON public.uploads USING btree (id) WHERE (store IS NULL);

CREATE INDEX index_user_agent_details_on_subject_id_and_subject_type ON public.user_agent_details USING btree (subject_id, subject_type);

CREATE INDEX index_user_callouts_on_user_id ON public.user_callouts USING btree (user_id);
Expand Down Expand Up @@ -12929,5 +12935,8 @@ COPY "schema_migrations" (version) FROM STDIN;
20200330123739
20200330132913
20200331220930
20200403184110
20200403185127
20200403185422
\.

2 changes: 1 addition & 1 deletion doc/ci/variables/predefined_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ future GitLab releases.**
| `CI_PAGES_URL` | 11.8 | all | URL to GitLab Pages-built pages. Always belongs to a subdomain of `CI_PAGES_DOMAIN`. |
| `CI_PIPELINE_ID` | 8.10 | all | The unique id of the current pipeline that GitLab CI/CD uses internally |
| `CI_PIPELINE_IID` | 11.0 | all | The unique id of the current pipeline scoped to project |
| `CI_PIPELINE_SOURCE` | 10.0 | all | Indicates how the pipeline was triggered. Possible options are: `push`, `web`, `trigger`, `schedule`, `api`, `pipeline`, `external`, `chat`, `merge_request_event`, and `external_pull_request_event`. For pipelines created before GitLab 9.5, this will show as `unknown` |
| `CI_PIPELINE_SOURCE` | 10.0 | all | Indicates how the pipeline was triggered. Possible options are: `push`, `web`, `trigger`, `schedule`, `api`, `pipeline`, `parent_pipeline`, `external`, `chat`, `merge_request_event`, and `external_pull_request_event`. For pipelines created before GitLab 9.5, this will show as `unknown` |
| `CI_PIPELINE_TRIGGERED` | all | all | The flag to indicate that job was [triggered](../triggers/README.md) |
| `CI_PIPELINE_URL` | 11.1 | 0.5 | Pipeline details URL |
| `CI_PROJECT_DIR` | all | all | The full path where the repository is cloned and where the job is run. If the GitLab Runner `builds_dir` parameter is set, this variable is set relative to the value of `builds_dir`. For more information, see [Advanced configuration](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section) for GitLab Runner. |
Expand Down
2 changes: 1 addition & 1 deletion doc/development/code_review.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ helped us with overall code quality (using delegation, `&.` those
types of things), and making the code more robust.

**["Support multiple assignees for merge requests"](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/10161)**:
A good example of collaboration on an MR touching multiple parts of the codebase. Nick pointed out interesting edge cases, James Lopes also joined in raising concerns on import/export feature.
A good example of collaboration on an MR touching multiple parts of the codebase. Nick pointed out interesting edge cases, James Lopez also joined in raising concerns on import/export feature.

### Credits

Expand Down
54 changes: 5 additions & 49 deletions doc/development/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ merge request with new or changed docs is submitted, are:
- If any code or the `doc/README.md` file is changed, a full pipeline will run, which
runs tests for [`/help`](#gitlab-help-tests).

### Running tests & lint checks locally
### Running tests

Apart from [previewing your changes locally](#previewing-the-changes-live), you can also run all lint checks
and Nanoc tests locally.
Expand Down Expand Up @@ -462,62 +462,20 @@ The output should be similar to:
Note that this requires you to either have the required lint tools installed on your machine,
or a working Docker installation, in which case an image with these tools pre-installed will be used.

For more information on available linters refer to the [linting](#linting) section.

### Linting
### Local linting

To help adhere to the [documentation style guidelines](styleguide.md), and improve the content
added to documentation, consider locally installing and running documentation linters. This will
help you catch common issues before raising merge requests for review of documentation.

The following are some suggested linters you can install locally and sample configuration:
Running the following locally allows you to match the checks in the build pipeline:

- [`proselint`](#proselint)
- [markdownlint](#markdownlint), which is the same as the test run in [`docs-lint`](#testing)
- [Vale](#vale), for English language grammar and syntax suggestions
- [markdownlint](#markdownlint).
- [Vale](#vale).

NOTE: **Note:**
This list does not limit what other linters you can add to your local documentation writing toolchain.

#### `proselint`

`proselint` checks for common problems with English prose. It provides a
[plethora of checks](http://proselint.com/checks/) that are helpful for technical writing.

`proselint` can be used [on the command line](http://proselint.com/utility/), either on a single
Markdown file or on all Markdown files in a project. For example, to run `proselint` on all
documentation in the [`gitlab` project](https://gitlab.com/gitlab-org/gitlab), run the
following commands from within the `gitlab` project:

```shell
cd doc
proselint **/*.md
```

`proselint` can also be run from within editors using plugins. For example, the following plugins
are available:

- [Sublime Text](https://packagecontrol.io/packages/SublimeLinter-contrib-proselint)
- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=PatrykPeszko.vscode-proselint)
- [Others](https://github.com/amperser/proselint#plugins-for-other-software)

##### Sample `proselint` configuration

All of the checks are good to use. However, excluding the `typography.symbols` and `misc.phrasal_adjectives` checks will reduce
noise. The following sample `proselint` configuration disables these checks:

```json
{
"checks": {
"typography.symbols": false,
"misc.phrasal_adjectives": false
}
}
```

A file with `proselint` configuration must be placed in a
[valid location](https://github.com/amperser/proselint#checks). For example, `~/.config/proselint/config`.

#### markdownlint

[markdownlint](https://github.com/DavidAnson/markdownlint) checks that Markdown
Expand Down Expand Up @@ -596,8 +554,6 @@ You can also
[configure the text editor of your choice](https://errata-ai.github.io/vale/#local-use-by-a-single-writer)
to display the results.

Vale's test results are not currently displayed in CI, but may be displayed in the future.

## Danger Bot

GitLab uses [Danger](https://github.com/danger/danger) for some elements in
Expand Down
2 changes: 1 addition & 1 deletion doc/development/documentation/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This document defines the standards for GitLab's documentation content and files

For broader information about the documentation, see the [Documentation guidelines](index.md).

For programmatic help adhering to the guidelines, see [linting](index.md#linting).
For programmatic help adhering to the guidelines, see [Testing](index.md#testing).

See the GitLab handbook for further [writing style guidelines](https://about.gitlab.com/handbook/communication/#writing-style-guidelines)
that apply to all GitLab content, not just documentation.
Expand Down
4 changes: 2 additions & 2 deletions lib/gitlab/database/batch_count.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
module Gitlab
module Database
module BatchCount
def batch_count(relation, column = nil, batch_size: nil)
BatchCounter.new(relation, column: column).count(batch_size: batch_size)
def batch_count(relation, column = nil, batch_size: nil, start: nil, finish: nil)
BatchCounter.new(relation, column: column).count(batch_size: batch_size, start: start, finish: finish)
end

def batch_distinct_count(relation, column = nil, batch_size: nil, start: nil, finish: nil)
Expand Down
4 changes: 2 additions & 2 deletions lib/gitlab/usage_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def user_preferences_usage
{} # augmented in EE
end

def count(relation, column = nil, fallback: -1, batch: true)
def count(relation, column = nil, fallback: -1, batch: true, start: nil, finish: nil)
if batch && Feature.enabled?(:usage_ping_batch_counter, default_enabled: true)
Gitlab::Database::BatchCount.batch_count(relation, column)
Gitlab::Database::BatchCount.batch_count(relation, column, start: start, finish: finish)
else
relation.count
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module QA
context 'Release' do
context 'Release', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/213222', type: :flaky } do
describe 'Deploy token creation' do
it 'user adds a deploy token' do
Flow::Login.sign_in
Expand Down
Loading

0 comments on commit eaea945

Please sign in to comment.