Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
292d054661
commit
e8d7ac4f14
36 changed files with 258 additions and 69 deletions
|
@ -204,7 +204,7 @@ jest:
|
|||
- tmp/tests/frontend/
|
||||
reports:
|
||||
junit: junit_jest.xml
|
||||
parallel: 2
|
||||
parallel: 4
|
||||
|
||||
jest-integration:
|
||||
extends:
|
||||
|
@ -222,6 +222,7 @@ jest-as-if-foss:
|
|||
- .frontend:rules:default-frontend-jobs-as-if-foss
|
||||
- .as-if-foss
|
||||
needs: ["frontend-fixtures-as-if-foss"]
|
||||
parallel: 2
|
||||
|
||||
coverage-frontend:
|
||||
extends:
|
||||
|
|
|
@ -169,7 +169,7 @@ export default {
|
|||
}}</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div v-if="showLabelFooter" class="board-card-labels prepend-top-4 d-flex flex-wrap">
|
||||
<div v-if="showLabelFooter" class="board-card-labels gl-mt-2 d-flex flex-wrap">
|
||||
<template v-for="label in orderedLabels">
|
||||
<gl-label
|
||||
:key="label.id"
|
||||
|
|
|
@ -235,7 +235,7 @@ export default {
|
|||
<gl-link href="/help/ci/variables/README#protected-environment-variables">
|
||||
<gl-icon name="question" :size="12" />
|
||||
</gl-link>
|
||||
<p class="prepend-top-4 text-secondary">
|
||||
<p class="gl-mt-2 text-secondary">
|
||||
{{ __('Export variable to pipelines running on protected branches and tags only.') }}
|
||||
</p>
|
||||
</gl-form-checkbox>
|
||||
|
@ -249,7 +249,7 @@ export default {
|
|||
<gl-link href="/help/ci/variables/README#masked-variables">
|
||||
<gl-icon name="question" :size="12" />
|
||||
</gl-link>
|
||||
<p class="prepend-top-4 gl-mb-0 text-secondary">
|
||||
<p class="gl-mt-2 gl-mb-0 text-secondary">
|
||||
{{ __('Variable will be masked in job logs.') }}
|
||||
<span
|
||||
:class="{
|
||||
|
|
|
@ -396,7 +396,6 @@ img.emoji {
|
|||
🚨 Do not use these classes — they are deprecated and being removed. 🚨
|
||||
See https://gitlab.com/gitlab-org/gitlab/-/issues/217418 for more details.
|
||||
**/
|
||||
.prepend-top-4 { margin-top: $gl-padding-4; }
|
||||
.prepend-top-5 { margin-top: 5px; }
|
||||
.prepend-top-10 { margin-top: 10px; }
|
||||
.prepend-top-15 { margin-top: 15px; }
|
||||
|
|
|
@ -148,7 +148,7 @@ class NotesFinder
|
|||
|
||||
# Searches for notes matching the given query.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
def search(notes)
|
||||
query = @params[:search]
|
||||
|
|
|
@ -163,14 +163,14 @@ module Ci
|
|||
|
||||
# Searches for runners matching the given query.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# This method performs a *partial* match on tokens, thus a query for "a"
|
||||
# will match any runner where the token contains the letter "a". As a result
|
||||
# you should *not* use this method for non-admin purposes as otherwise users
|
||||
# might be able to query a list of all runners.
|
||||
#
|
||||
# query - The search query as a String
|
||||
# query - The search query as a String.
|
||||
#
|
||||
# Returns an ActiveRecord::Relation.
|
||||
def self.search(query)
|
||||
|
|
|
@ -53,7 +53,7 @@ module Clusters
|
|||
super.merge('wait-for-elasticsearch.sh': File.read("#{Rails.root}/vendor/elastic_stack/wait-for-elasticsearch.sh"))
|
||||
end
|
||||
|
||||
def elasticsearch_client
|
||||
def elasticsearch_client(timeout: nil)
|
||||
strong_memoize(:elasticsearch_client) do
|
||||
next unless kube_client
|
||||
|
||||
|
@ -65,6 +65,7 @@ module Clusters
|
|||
# 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]
|
||||
faraday.options.timeout = timeout unless timeout.nil?
|
||||
end
|
||||
|
||||
rescue Kubeclient::HttpError => error
|
||||
|
|
|
@ -36,6 +36,8 @@ module Clusters
|
|||
has_one :cluster_project, -> { order(id: :desc) }, class_name: 'Clusters::Project'
|
||||
has_many :deployment_clusters
|
||||
has_many :deployments, inverse_of: :cluster
|
||||
has_many :successful_deployments, -> { success }, class_name: 'Deployment'
|
||||
has_many :environments, -> { distinct }, through: :deployments
|
||||
|
||||
has_many :cluster_groups, class_name: 'Clusters::Group'
|
||||
has_many :groups, through: :cluster_groups, class_name: '::Group'
|
||||
|
@ -125,6 +127,12 @@ module Clusters
|
|||
scope :gcp_installed, -> { gcp_provided.joins(:provider_gcp).merge(Clusters::Providers::Gcp.with_status(:created)) }
|
||||
scope :aws_installed, -> { aws_provided.joins(:provider_aws).merge(Clusters::Providers::Aws.with_status(:created)) }
|
||||
|
||||
scope :with_enabled_modsecurity, -> { joins(:application_ingress).merge(::Clusters::Applications::Ingress.modsecurity_enabled) }
|
||||
scope :with_available_elasticstack, -> { joins(:application_elastic_stack).merge(::Clusters::Applications::ElasticStack.available) }
|
||||
scope :distinct_with_deployed_environments, -> { joins(:environments).merge(::Deployment.success).distinct }
|
||||
scope :preload_elasticstack, -> { preload(:application_elastic_stack) }
|
||||
scope :preload_environments, -> { preload(:environments) }
|
||||
|
||||
scope :managed, -> { where(managed: true) }
|
||||
scope :with_persisted_applications, -> { eager_load(*APPLICATIONS_ASSOCIATIONS) }
|
||||
scope :default_environment, -> { where(environment_scope: DEFAULT_ENVIRONMENT) }
|
||||
|
|
|
@ -195,7 +195,7 @@ module Issuable
|
|||
class_methods do
|
||||
# Searches for records with a matching title.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# query - The search query as a String
|
||||
#
|
||||
|
@ -219,7 +219,7 @@ module Issuable
|
|||
|
||||
# Searches for records with a matching title or description.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# query - The search query as a String
|
||||
# matched_columns - Modify the scope of the query. 'title', 'description' or joining them with a comma.
|
||||
|
|
|
@ -133,7 +133,7 @@ class Label < ApplicationRecord
|
|||
|
||||
# Searches for labels with a matching title or description.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# query - The search query as a String.
|
||||
#
|
||||
|
|
|
@ -100,11 +100,11 @@ class Namespace < ApplicationRecord
|
|||
|
||||
# Searches for namespaces matching the given query.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# query - The search query as a String
|
||||
# query - The search query as a String.
|
||||
#
|
||||
# Returns an ActiveRecord::Relation
|
||||
# Returns an ActiveRecord::Relation.
|
||||
def search(query)
|
||||
fuzzy_search(query, [:name, :path])
|
||||
end
|
||||
|
|
|
@ -617,8 +617,7 @@ class Project < ApplicationRecord
|
|||
# Searches for a list of projects based on the query given in `query`.
|
||||
#
|
||||
# On PostgreSQL this method uses "ILIKE" to perform a case-insensitive
|
||||
# search. On MySQL a regular "LIKE" is used as it's already
|
||||
# case-insensitive.
|
||||
# search.
|
||||
#
|
||||
# query - The search query as a String.
|
||||
def search(query, include_namespace: false)
|
||||
|
|
|
@ -337,7 +337,7 @@ class Snippet < ApplicationRecord
|
|||
class << self
|
||||
# Searches for snippets with a matching title, description or file name.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# query - The search query as a String.
|
||||
#
|
||||
|
|
|
@ -522,7 +522,7 @@ class User < ApplicationRecord
|
|||
|
||||
# Searches users matching the given query.
|
||||
#
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
#
|
||||
# query - The search query as a String
|
||||
#
|
||||
|
@ -565,7 +565,7 @@ class User < ApplicationRecord
|
|||
|
||||
# searches user by given pattern
|
||||
# it compares name, email, username fields and user's secondary emails with given pattern
|
||||
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
|
||||
# This method uses ILIKE on PostgreSQL.
|
||||
|
||||
def search_with_secondary_emails(query)
|
||||
return none if query.blank?
|
||||
|
|
|
@ -82,16 +82,21 @@ class SearchService
|
|||
end
|
||||
|
||||
def redact_unauthorized_results(results_collection)
|
||||
results = results_collection.to_a
|
||||
permitted_results = results.select { |object| visible_result?(object) }
|
||||
redacted_results = results_collection.reject { |object| visible_result?(object) }
|
||||
|
||||
redacted_results = (results - permitted_results).each_with_object({}) do |object, memo|
|
||||
memo[object.id] = { ability: :"read_#{object.to_ability_name}", id: object.id, class_name: object.class.name }
|
||||
if redacted_results.any?
|
||||
redacted_log = redacted_results.each_with_object({}) do |object, memo|
|
||||
memo[object.id] = { ability: :"read_#{object.to_ability_name}", id: object.id, class_name: object.class.name }
|
||||
end
|
||||
|
||||
log_redacted_search_results(redacted_log.values)
|
||||
|
||||
return results_collection.id_not_in(redacted_log.keys) if results_collection.is_a?(ActiveRecord::Relation)
|
||||
end
|
||||
|
||||
log_redacted_search_results(redacted_results.values) if redacted_results.any?
|
||||
return results_collection if results_collection.is_a?(ActiveRecord::Relation)
|
||||
|
||||
return results_collection.id_not_in(redacted_results.keys) if results_collection.is_a?(ActiveRecord::Relation)
|
||||
permitted_results = results_collection - redacted_results
|
||||
|
||||
Kaminari.paginate_array(
|
||||
permitted_results,
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
%span.form-text.text-muted#session_expire_delay_help_block= _('GitLab restart is required to apply changes.')
|
||||
|
||||
= render_if_exists 'admin/application_settings/personal_access_token_expiration_policy', form: f
|
||||
= render_if_exists 'admin/application_settings/enforce_pat_expiration', form: f
|
||||
|
||||
.form-group
|
||||
= f.label :user_oauth_applications, _('User OAuth applications'), class: 'label-bold'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Reduce redundant queries for Search API users scope.
|
||||
merge_request: 33795
|
||||
author:
|
||||
type: performance
|
5
changelogs/unreleased/emilyring-remove-tf-plan-name.yml
Normal file
5
changelogs/unreleased/emilyring-remove-tf-plan-name.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Removed default artifact name for Terraform template
|
||||
merge_request: 34557
|
||||
author:
|
||||
type: fixed
|
|
@ -567,6 +567,9 @@ Gitlab.ee do
|
|||
Settings.cron_jobs['sync_seat_link_worker'] ||= Settingslogic.new({})
|
||||
Settings.cron_jobs['sync_seat_link_worker']['cron'] ||= "#{rand(60)} 0 * * *"
|
||||
Settings.cron_jobs['sync_seat_link_worker']['job_class'] = 'SyncSeatLinkWorker'
|
||||
Settings.cron_jobs['web_application_firewall_metrics_worker'] ||= Settingslogic.new({})
|
||||
Settings.cron_jobs['web_application_firewall_metrics_worker']['cron'] ||= '0 1 * * 0'
|
||||
Settings.cron_jobs['web_application_firewall_metrics_worker']['job_class'] = 'IngressModsecurityCounterMetricsWorker'
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddEnforcePatExpirationToApplicationSettings < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :application_settings, :enforce_pat_expiration, :boolean, default: true, null: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddComposerJsonToMetadata < ActiveRecord::Migration[6.0]
|
||||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
add_column :packages_composer_metadata, :composer_json, :jsonb, default: {}, null: false
|
||||
end
|
||||
end
|
|
@ -477,6 +477,7 @@ CREATE TABLE public.application_settings (
|
|||
elasticsearch_pause_indexing boolean DEFAULT false NOT NULL,
|
||||
repository_storages_weighted jsonb DEFAULT '{}'::jsonb NOT NULL,
|
||||
max_import_size integer DEFAULT 50 NOT NULL,
|
||||
enforce_pat_expiration boolean DEFAULT true NOT NULL,
|
||||
CONSTRAINT check_d03919528d CHECK ((char_length(container_registry_vendor) <= 255)),
|
||||
CONSTRAINT check_d820146492 CHECK ((char_length(spam_check_endpoint_url) <= 255)),
|
||||
CONSTRAINT check_e5aba18f02 CHECK ((char_length(container_registry_version) <= 255))
|
||||
|
@ -4672,7 +4673,8 @@ ALTER SEQUENCE public.packages_build_infos_id_seq OWNED BY public.packages_build
|
|||
|
||||
CREATE TABLE public.packages_composer_metadata (
|
||||
package_id bigint NOT NULL,
|
||||
target_sha bytea NOT NULL
|
||||
target_sha bytea NOT NULL,
|
||||
composer_json jsonb DEFAULT '{}'::jsonb NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE public.packages_conan_file_metadata (
|
||||
|
@ -13958,6 +13960,7 @@ COPY "schema_migrations" (version) FROM STDIN;
|
|||
20200602013900
|
||||
20200602013901
|
||||
20200603073101
|
||||
20200603180338
|
||||
20200604143628
|
||||
20200604145731
|
||||
20200604174544
|
||||
|
@ -13971,5 +13974,6 @@ COPY "schema_migrations" (version) FROM STDIN;
|
|||
20200609142507
|
||||
20200609142508
|
||||
20200609212701
|
||||
20200615083635
|
||||
\.
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ You can add a command to your `.gitlab-ci.yml` file to
|
|||
| `CI_EXTERNAL_PULL_REQUEST_SOURCE_BRANCH_SHA` | 12.3 | all | The HEAD SHA of the source branch of the pull request if [the pipelines are for external pull requests](../ci_cd_for_external_repos/index.md#pipelines-for-external-pull-requests). Available only if `only: [external_pull_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the pull request is open. |
|
||||
| `CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME` | 12.3 | all | The target branch name of the pull request if [the pipelines are for external pull requests](../ci_cd_for_external_repos/index.md#pipelines-for-external-pull-requests). Available only if `only: [external_pull_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the pull request is open. |
|
||||
| `CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_SHA` | 12.3 | all | The HEAD SHA of the target branch of the pull request if [the pipelines are for external pull requests](../ci_cd_for_external_repos/index.md#pipelines-for-external-pull-requests). Available only if `only: [external_pull_requests]` or [`rules`](../yaml/README.md#rules) syntax is used and the pull request is open. |
|
||||
| `CI_HAS_OPEN_REQUIREMENTS` | 13.1 | all | Included with the value `true` only if the pipeline's project has any open [requirements](../../user/project/requirements/index.md). Not included if there are no open requirements for the pipeline's project. |
|
||||
| `CI_JOB_ID` | 9.0 | all | The unique ID of the current job that GitLab CI/CD uses internally |
|
||||
| `CI_JOB_IMAGE` | 12.9 | 12.9 | The name of the image running the CI job |
|
||||
| `CI_JOB_MANUAL` | 8.12 | all | The flag to indicate that job was manually started |
|
||||
|
|
|
@ -504,6 +504,7 @@ appear to be associated to any of the services running, since they all appear to
|
|||
| `projects_jira_dvcs_server_active` | `counts` | | | |
|
||||
| `labels` | `counts` | | | |
|
||||
| `merge_requests` | `counts` | | | |
|
||||
| `merge_requests_users` | `counts` | | | |
|
||||
| `notes` | `counts` | | | |
|
||||
| `wiki_pages_create` | `counts` | | | |
|
||||
| `wiki_pages_update` | `counts` | | | |
|
||||
|
|
|
@ -420,6 +420,7 @@ Read the documentation on [links](#add-related-links-to-custom-dashboards).
|
|||
| `max_value` | number | no | Denominator value used for calculating [percentile based results](#percentile-based-results) |
|
||||
| `weight` | number | no, defaults to order in file | Order to appear within the grouping. Lower number means higher priority, which will be higher on the page. Numbers do not need to be consecutive. |
|
||||
| `metrics` | array | yes | The metrics which should be displayed in the panel. Any number of metrics can be displayed when `type` is `area-chart` or `line-chart`, whereas only 3 can be displayed when `type` is `anomaly-chart`. |
|
||||
| `links` | array | no | Add links to display on the chart's [context menu](#chart-context-menu). |
|
||||
|
||||
##### **Axis (`panels[].y_axis`) properties**
|
||||
|
||||
|
@ -842,16 +843,27 @@ templating:
|
|||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/216385) in GitLab 13.1.
|
||||
|
||||
Related links can be added to the top of your metrics dashboard, which can be used for quickly
|
||||
navigating between dashboards or external services. The links will open in the same tab.
|
||||
You can embed links to other dashboards or external services in your custom
|
||||
dashboard by adding **Related links** to your dashboard's YAML file. Related links
|
||||
open in the same tab as the dashboard. Related links can be displayed in the
|
||||
following locations on your dashboard:
|
||||
|
||||
- At the top of your dashboard as the top level [`links` dashboard property](#dashboard-top-level-properties).
|
||||
- In charts context menus as the [`links` property of a panel](#panel-panels-properties).
|
||||
|
||||
Related links can contain the following attributes:
|
||||
|
||||
- `url`: The full URL to the link. Required.
|
||||
- `title`: A phrase describing the link. Optional. If this attribute is not set,
|
||||
the full URL is used for the link title.
|
||||
- `type`: A string declaring the type of link. Optional. If set to `grafana`, the
|
||||
dashboard's time range values are converted to Grafana's time range format and
|
||||
appended to the `url`.
|
||||
|
||||
The dashboard's time range is appended to the `url` as URL parameters.
|
||||
|
||||
The `url` attribute is required for the link but the `title` attribute is optional; if the `title`
|
||||
is missing then the full address of the URL will be displayed.
|
||||
|
||||
The `type` attribute is optional; if the `type` is `grafana`, the dashboard's time range values are
|
||||
converted to Grafana's time range format and appended to the `url`.
|
||||
The following example shows two related links (`GitLab.com` and `GitLab Documentation`)
|
||||
added to a dashboard:
|
||||
|
||||
![Links UI](img/related_links_v13_1.png)
|
||||
|
||||
|
|
|
@ -169,12 +169,16 @@ The following topics show other examples of other options you can add to your CI
|
|||
|
||||
You may want to deploy to a Pages site only from specific branches.
|
||||
|
||||
You can add another line to `.gitlab-ci.yml`, which tells the Runner
|
||||
to perform the job called `pages` on the `master` branch **only**:
|
||||
First, add a `workflow` section to force the pipeline to run only when changes are
|
||||
pushed to branches:
|
||||
|
||||
```yaml
|
||||
image: ruby:2.7
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
pages:
|
||||
script:
|
||||
- gem install bundler
|
||||
|
@ -183,8 +187,27 @@ pages:
|
|||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
```
|
||||
|
||||
Then configure the pipeline to run the job for the master branch only.
|
||||
|
||||
```yaml
|
||||
image: ruby:2.7
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
pages:
|
||||
script:
|
||||
- gem install bundler
|
||||
- bundle install
|
||||
- bundle exec jekyll build -d public
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
```
|
||||
|
||||
## Specify a stage to deploy
|
||||
|
@ -202,6 +225,10 @@ add a `stage` line to your CI file:
|
|||
```yaml
|
||||
image: ruby:2.7
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
|
@ -211,16 +238,20 @@ pages:
|
|||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
```
|
||||
|
||||
Now add another job to the CI file, telling it to
|
||||
test every push to other branches, **except** the `master` branch:
|
||||
test every push to every branch **except** the `master` branch:
|
||||
|
||||
```yaml
|
||||
image: ruby:2.7
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
|
@ -230,8 +261,8 @@ pages:
|
|||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
|
||||
test:
|
||||
stage: test
|
||||
|
@ -242,8 +273,8 @@ test:
|
|||
artifacts:
|
||||
paths:
|
||||
- test
|
||||
except:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
||||
```
|
||||
|
||||
When the `test` job runs in the `test` stage, Jekyll
|
||||
|
@ -257,9 +288,8 @@ same time.
|
|||
|
||||
## Remove duplicate commands
|
||||
|
||||
To avoid running the same scripts for each job, you can add the
|
||||
parameter `before_script`. In this section, specify the commands
|
||||
you want to run for every job.
|
||||
To avoid duplicating the same scripts in every job, you can add them
|
||||
to a `before_script` section.
|
||||
|
||||
In the example, `gem install bundler` and `bundle install` were running
|
||||
for both jobs, `pages` and `test`.
|
||||
|
@ -269,6 +299,10 @@ Move these commands to a `before_script` section:
|
|||
```yaml
|
||||
image: ruby:2.7
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
before_script:
|
||||
- gem install bundler
|
||||
- bundle install
|
||||
|
@ -280,8 +314,8 @@ pages:
|
|||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
|
||||
test:
|
||||
stage: test
|
||||
|
@ -290,8 +324,8 @@ test:
|
|||
artifacts:
|
||||
paths:
|
||||
- test
|
||||
except:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
||||
```
|
||||
|
||||
## Build faster with cached dependencies
|
||||
|
@ -305,6 +339,10 @@ when you run `bundle install`:
|
|||
```yaml
|
||||
image: ruby:2.7
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- vendor/
|
||||
|
@ -320,8 +358,8 @@ pages:
|
|||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
|
||||
test:
|
||||
stage: test
|
||||
|
@ -330,11 +368,11 @@ test:
|
|||
artifacts:
|
||||
paths:
|
||||
- test
|
||||
except:
|
||||
- master
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH != "master"'
|
||||
```
|
||||
|
||||
In this case, we need to exclude the `/vendor`
|
||||
In this case, you need to exclude the `/vendor`
|
||||
directory from the list of folders Jekyll builds. Otherwise, Jekyll
|
||||
will try to build the directory contents along with the site.
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ plan:
|
|||
- terraform plan -out=$PLAN
|
||||
- "terraform show --json $PLAN | convert_report > $JSON_PLAN_FILE"
|
||||
artifacts:
|
||||
name: plan
|
||||
paths:
|
||||
- $PLAN
|
||||
reports:
|
||||
|
|
|
@ -11,8 +11,8 @@ module Gitlab
|
|||
|
||||
STORAGES = [ActionCable, Cache, Queues, SharedState].freeze
|
||||
|
||||
# Milliseconds represented in seconds (from 1 to 500 milliseconds).
|
||||
QUERY_TIME_BUCKETS = [0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5].freeze
|
||||
# Milliseconds represented in seconds (from 1 millisecond to 2 seconds).
|
||||
QUERY_TIME_BUCKETS = [0.001, 0.0025, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2].freeze
|
||||
|
||||
class << self
|
||||
def detail_store
|
||||
|
|
|
@ -19,7 +19,13 @@ module Gitlab
|
|||
private
|
||||
|
||||
def paginate_with_limit_optimization(relation)
|
||||
pagination_data = relation.page(params[:page]).per(params[:per_page])
|
||||
# do not paginate relation if it is already paginated
|
||||
pagination_data = if relation.respond_to?(:current_page) && relation.current_page == params[:page] && relation.limit_value == params[:per_page]
|
||||
relation
|
||||
else
|
||||
relation.page(params[:page]).per(params[:per_page])
|
||||
end
|
||||
|
||||
return pagination_data unless pagination_data.is_a?(ActiveRecord::Relation)
|
||||
return pagination_data unless Feature.enabled?(:api_kaminari_count_with_limit)
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ module Gitlab
|
|||
.merge(object_store_usage_data)
|
||||
.merge(topology_usage_data)
|
||||
.merge(recording_ce_finish_data)
|
||||
.merge(merge_requests_usage_data(default_time_period))
|
||||
end
|
||||
|
||||
def to_json(force_refresh: false)
|
||||
|
@ -162,7 +161,8 @@ module Gitlab
|
|||
usage_counters,
|
||||
user_preferences_usage,
|
||||
ingress_modsecurity_usage,
|
||||
container_expiration_policies_usage
|
||||
container_expiration_policies_usage,
|
||||
merge_requests_usage(default_time_period)
|
||||
)
|
||||
}
|
||||
end
|
||||
|
@ -400,7 +400,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
# rubocop: disable CodeReuse/ActiveRecord
|
||||
def merge_requests_usage_data(time_period)
|
||||
def merge_requests_usage(time_period)
|
||||
query =
|
||||
Event
|
||||
.where(target_type: Event::TARGET_TYPES[:merge_request].to_s)
|
||||
|
|
|
@ -8417,6 +8417,9 @@ msgstr ""
|
|||
msgid "Enforce DNS rebinding attack protection"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enforce personal access token expiration"
|
||||
msgstr ""
|
||||
|
||||
msgid "Ensure connectivity is available from the GitLab server to the Prometheus server"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ describe Gitlab::UsageData, :aggregate_failures do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#merge_requests_usage_data' do
|
||||
describe '#merge_requests_usage' do
|
||||
let(:time_period) { { created_at: 2.days.ago..Time.current } }
|
||||
let(:merge_request) { create(:merge_request) }
|
||||
let(:other_user) { create(:user) }
|
||||
|
@ -597,7 +597,7 @@ describe Gitlab::UsageData, :aggregate_failures do
|
|||
end
|
||||
|
||||
it 'returns the distinct count of users using merge requests (via events table) within the specified time period' do
|
||||
expect(described_class.merge_requests_usage_data(time_period)).to eq(
|
||||
expect(described_class.merge_requests_usage(time_period)).to eq(
|
||||
merge_requests_users: 2
|
||||
)
|
||||
end
|
||||
|
|
|
@ -2407,13 +2407,13 @@ describe Ci::Build do
|
|||
allow(build).to receive(:job_jwt_variables) { [job_jwt_var] }
|
||||
allow(build).to receive(:dependency_variables) { [job_dependency_var] }
|
||||
|
||||
allow_any_instance_of(Project)
|
||||
allow(build.project)
|
||||
.to receive(:predefined_variables) { [project_pre_var] }
|
||||
|
||||
project.variables.create!(key: 'secret', value: 'value')
|
||||
|
||||
allow_any_instance_of(Ci::Pipeline)
|
||||
.to receive(:predefined_variables) { [pipeline_pre_var] }
|
||||
allow(build.pipeline)
|
||||
.to receive(:predefined_variables).and_return([pipeline_pre_var])
|
||||
end
|
||||
|
||||
it 'returns variables in order depending on resource hierarchy' do
|
||||
|
|
|
@ -175,6 +175,7 @@ describe Clusters::Applications::ElasticStack do
|
|||
expect(faraday_connection.headers["Authorization"]).to eq(kube_client.headers[:Authorization])
|
||||
expect(faraday_connection.ssl.cert_store).to be_instance_of(OpenSSL::X509::Store)
|
||||
expect(faraday_connection.ssl.verify).to eq(1)
|
||||
expect(faraday_connection.options.timeout).to be_nil
|
||||
end
|
||||
|
||||
context 'when cluster is not reachable' do
|
||||
|
@ -186,6 +187,15 @@ describe Clusters::Applications::ElasticStack do
|
|||
expect(subject.elasticsearch_client).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when timeout is provided' do
|
||||
it 'sets timeout in elasticsearch_client' do
|
||||
client = subject.elasticsearch_client(timeout: 123)
|
||||
faraday_connection = client.transport.connections.first.connection
|
||||
|
||||
expect(faraday_connection.options.timeout).to eq(123)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,6 +28,8 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
|
|||
it { is_expected.to have_one(:cluster_project) }
|
||||
it { is_expected.to have_many(:deployment_clusters) }
|
||||
it { is_expected.to have_many(:metrics_dashboard_annotations) }
|
||||
it { is_expected.to have_many(:successful_deployments) }
|
||||
it { is_expected.to have_many(:environments).through(:deployments) }
|
||||
|
||||
it { is_expected.to delegate_method(:status).to(:provider) }
|
||||
it { is_expected.to delegate_method(:status_reason).to(:provider) }
|
||||
|
@ -190,6 +192,73 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.with_enabled_modsecurity' do
|
||||
subject { described_class.with_enabled_modsecurity }
|
||||
|
||||
let_it_be(:cluster) { create(:cluster) }
|
||||
|
||||
context 'cluster has ingress application with enabled modsecurity' do
|
||||
let!(:application) { create(:clusters_applications_ingress, :installed, :modsecurity_logging, cluster: cluster) }
|
||||
|
||||
it { is_expected.to include(cluster) }
|
||||
end
|
||||
|
||||
context 'cluster has ingress application with disabled modsecurity' do
|
||||
let!(:application) { create(:clusters_applications_ingress, :installed, :modsecurity_disabled, cluster: cluster) }
|
||||
|
||||
it { is_expected.not_to include(cluster) }
|
||||
end
|
||||
|
||||
context 'cluster does not have ingress application' do
|
||||
it { is_expected.not_to include(cluster) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.with_available_elasticstack' do
|
||||
subject { described_class.with_available_elasticstack }
|
||||
|
||||
let_it_be(:cluster) { create(:cluster) }
|
||||
|
||||
context 'cluster has ElasticStack application' do
|
||||
let!(:application) { create(:clusters_applications_elastic_stack, :installed, cluster: cluster) }
|
||||
|
||||
it { is_expected.to include(cluster) }
|
||||
end
|
||||
|
||||
context 'cluster does not have ElasticStack application' do
|
||||
it { is_expected.not_to include(cluster) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.distinct_with_deployed_environments' do
|
||||
subject { described_class.distinct_with_deployed_environments }
|
||||
|
||||
let_it_be(:cluster) { create(:cluster) }
|
||||
|
||||
context 'cluster has multiple successful deployment with environment' do
|
||||
let!(:environment) { create(:environment) }
|
||||
let!(:deployment) { create(:deployment, :success, cluster: cluster, environment: environment) }
|
||||
let!(:deployment_2) { create(:deployment, :success, cluster: cluster, environment: environment) }
|
||||
|
||||
it { is_expected.to include(cluster) }
|
||||
|
||||
it 'lists only distinct environments' do
|
||||
expect(subject.first.environments.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'cluster has only failed deployment with environment' do
|
||||
let!(:environment) { create(:environment) }
|
||||
let!(:deployment) { create(:deployment, :failed, cluster: cluster, environment: environment) }
|
||||
|
||||
it { is_expected.not_to include(cluster) }
|
||||
end
|
||||
|
||||
context 'cluster does not have any deployment' do
|
||||
it { is_expected.not_to include(cluster) }
|
||||
end
|
||||
end
|
||||
|
||||
describe '.with_project_alert_service_data' do
|
||||
subject { described_class.with_project_alert_service_data(project_id) }
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ module UsageDataHelpers
|
|||
labels
|
||||
lfs_objects
|
||||
merge_requests
|
||||
merge_requests_users
|
||||
milestone_lists
|
||||
milestones
|
||||
notes
|
||||
|
|
Loading…
Reference in a new issue