Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 03:09:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 03:09:31 +0300
commite70cf9a65919abc7042672ee544dbf2ccb1e2a9e (patch)
tree81f4092b260250879e7eda0bca10faaa9ec4f338
parent3e308768fd9306a49bb0149ca3636e8e8285485d (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--.gitlab/CODEOWNERS2
-rw-r--r--app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue12
-rw-r--r--app/assets/javascripts/pipelines/components/graph_shared/links_inner.vue7
-rw-r--r--app/assets/javascripts/pipelines/components/graph_shared/links_layer.vue4
-rw-r--r--app/assets/stylesheets/vendors/atwho.scss5
-rw-r--r--app/models/ci/build.rb5
-rw-r--r--app/presenters/packages/composer/packages_presenter.rb2
-rw-r--r--changelogs/unreleased/expose-failure-reasons-features.yml5
-rw-r--r--changelogs/unreleased/fix-overflowing-width-at-mention-selector.yml5
-rw-r--r--changelogs/unreleased/john_long-composer-package-relative-url.yml5
-rw-r--r--changelogs/unreleased/remove-ci_jwt_include_environment-feature-flag.yml5
-rw-r--r--config/feature_flags/development/ci_jwt_include_environment.yml8
-rw-r--r--doc/topics/git/index.md2
-rw-r--r--doc/topics/git/tags.md41
-rw-r--r--doc/university/training/index.md1
-rw-r--r--doc/university/training/topics/tags.md52
-rw-r--r--doc/user/project/merge_requests/getting_started.md29
-rw-r--r--lib/csv_builder.rb5
-rw-r--r--lib/gitlab/ci/jwt.rb6
-rw-r--r--lib/gitlab/metrics/subscribers/active_record.rb3
-rw-r--r--locale/gitlab.pot3
-rw-r--r--spec/lib/gitlab/ci/jwt_spec.rb11
-rw-r--r--spec/lib/gitlab/metrics/subscribers/active_record_spec.rb45
-rw-r--r--spec/presenters/packages/composer/packages_presenter_spec.rb6
-rw-r--r--spec/requests/api/ci/runner/jobs_request_post_spec.rb9
25 files changed, 149 insertions, 129 deletions
diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS
index 0d34eeccf8c..ae971c2f987 100644
--- a/.gitlab/CODEOWNERS
+++ b/.gitlab/CODEOWNERS
@@ -101,6 +101,7 @@
/doc/api/repository_files.md @aqualls
/doc/api/repository_submodules.md @aqualls
/doc/api/search.md @aqualls
+/doc/api/services.md @aqualls
/doc/api/snippets.md @aqualls
/doc/api/suggestions.md @aqualls
/doc/api/tags.md @aqualls
@@ -110,6 +111,7 @@
/doc/topics/gitlab_flow.md @aqualls
/doc/user/admin_area/settings/account_and_limit_settings.md @aqualls
/doc/user/admin_area/settings/instance_template_repository.md @aqualls
+/doc/user/admin_area/settings/project_integration_management.md @aqualls
/doc/user/admin_area/settings/push_event_activities_limit.md @aqualls
/doc/user/admin_area/settings/visibility_and_access_controls.md @aqualls
/doc/user/asciidoc.md @aqualls
diff --git a/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue b/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
index f596333237d..afe4dfb9c8d 100644
--- a/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
+++ b/app/assets/javascripts/pipelines/components/graph/graph_component_wrapper.vue
@@ -2,7 +2,7 @@
import { GlAlert, GlLoadingIcon } from '@gitlab/ui';
import getPipelineDetails from 'shared_queries/pipelines/get_pipeline_details.query.graphql';
import { __ } from '~/locale';
-import { DEFAULT, LOAD_FAILURE } from '../../constants';
+import { DEFAULT, DRAW_FAILURE, LOAD_FAILURE } from '../../constants';
import PipelineGraph from './graph_component.vue';
import { unwrapPipelineData, toggleQueryPollingByVisibility, reportToSentry } from './utils';
@@ -29,6 +29,7 @@ export default {
};
},
errorTexts: {
+ [DRAW_FAILURE]: __('An error ocurred while drawing job relationship links.'),
[LOAD_FAILURE]: __('We are currently unable to fetch data for this pipeline.'),
[DEFAULT]: __('An unknown error occurred while loading this graph.'),
},
@@ -53,6 +54,11 @@ export default {
computed: {
alert() {
switch (this.alertType) {
+ case DRAW_FAILURE:
+ return {
+ text: this.$options.errorTexts[DRAW_FAILURE],
+ variant: 'danger',
+ };
case LOAD_FAILURE:
return {
text: this.$options.errorTexts[LOAD_FAILURE],
@@ -88,8 +94,8 @@ export default {
},
reportFailure(type) {
this.showAlert = true;
- this.failureType = type;
- reportToSentry(this.$options.name, this.failureType);
+ this.alertType = type;
+ reportToSentry(this.$options.name, this.alertType);
},
},
};
diff --git a/app/assets/javascripts/pipelines/components/graph_shared/links_inner.vue b/app/assets/javascripts/pipelines/components/graph_shared/links_inner.vue
index 289e04e02c5..a7fad1c57b0 100644
--- a/app/assets/javascripts/pipelines/components/graph_shared/links_inner.vue
+++ b/app/assets/javascripts/pipelines/components/graph_shared/links_inner.vue
@@ -2,6 +2,7 @@
import { isEmpty } from 'lodash';
import { DRAW_FAILURE } from '../../constants';
import { createJobsHash, generateJobNeedsDict } from '../../utils';
+import { reportToSentry } from '../graph/utils';
import { parseData } from '../parsing_utils';
import { generateLinksData } from './drawing_utils';
@@ -87,6 +88,9 @@ export default {
this.$emit('highlightedJobsChange', jobs);
},
},
+ errorCaptured(err, _vm, info) {
+ reportToSentry(this.$options.name, `error: ${err}, info: ${info}`);
+ },
mounted() {
if (!isEmpty(this.pipelineData)) {
this.prepareLinkData();
@@ -101,8 +105,9 @@ export default {
const arrayOfJobs = this.pipelineData.flatMap(({ groups }) => groups);
const parsedData = parseData(arrayOfJobs);
this.links = generateLinksData(parsedData, this.containerId, `-${this.pipelineId}`);
- } catch {
+ } catch (err) {
this.$emit('error', DRAW_FAILURE);
+ reportToSentry(this.$options.name, err);
}
},
getLinkClasses(link) {
diff --git a/app/assets/javascripts/pipelines/components/graph_shared/links_layer.vue b/app/assets/javascripts/pipelines/components/graph_shared/links_layer.vue
index 1c1bc7ecb2a..af3a3f0adff 100644
--- a/app/assets/javascripts/pipelines/components/graph_shared/links_layer.vue
+++ b/app/assets/javascripts/pipelines/components/graph_shared/links_layer.vue
@@ -1,6 +1,7 @@
<script>
import { GlAlert } from '@gitlab/ui';
import { __ } from '~/locale';
+import { reportToSentry } from '../graph/utils';
import LinksInner from './links_inner.vue';
export default {
@@ -50,6 +51,9 @@ export default {
);
},
},
+ errorCaptured(err, _vm, info) {
+ reportToSentry(this.$options.name, `error: ${err}, info: ${info}`);
+ },
methods: {
dismissAlert() {
this.alertDismissed = true;
diff --git a/app/assets/stylesheets/vendors/atwho.scss b/app/assets/stylesheets/vendors/atwho.scss
index f31dbbeafe8..b92331facee 100644
--- a/app/assets/stylesheets/vendors/atwho.scss
+++ b/app/assets/stylesheets/vendors/atwho.scss
@@ -1,6 +1,7 @@
.atwho-view {
overflow-y: auto;
overflow-x: hidden;
+ max-width: calc(100% - 6px);
.name,
small.aliases,
@@ -80,10 +81,6 @@
}
@include media-breakpoint-down(xs) {
- .atwho-view-ul {
- width: 350px;
- }
-
.atwho-view ul li {
overflow: hidden;
text-overflow: ellipsis;
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index db151126caf..d072bced639 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -564,7 +564,10 @@ module Ci
end
def features
- { trace_sections: true }
+ {
+ trace_sections: true,
+ failure_reasons: self.class.failure_reasons.keys
+ }
end
def merge_request
diff --git a/app/presenters/packages/composer/packages_presenter.rb b/app/presenters/packages/composer/packages_presenter.rb
index ed0e9d3b731..381cf2dd2c9 100644
--- a/app/presenters/packages/composer/packages_presenter.rb
+++ b/app/presenters/packages/composer/packages_presenter.rb
@@ -11,7 +11,7 @@ module Packages
end
def root
- path = api_v4_group___packages_composer_package_name_path({ id: @group.id, package_name: '%package%$%hash%', format: '.json' }, true)
+ path = expose_path(api_v4_group___packages_composer_package_name_path({ id: @group.id, package_name: '%package%$%hash%', format: '.json' }, true))
{ 'packages' => [], 'provider-includes' => { 'p/%hash%.json' => { 'sha256' => provider_sha } }, 'providers-url' => path }
end
diff --git a/changelogs/unreleased/expose-failure-reasons-features.yml b/changelogs/unreleased/expose-failure-reasons-features.yml
new file mode 100644
index 00000000000..1fb7d63b911
--- /dev/null
+++ b/changelogs/unreleased/expose-failure-reasons-features.yml
@@ -0,0 +1,5 @@
+---
+title: Expose `failure_reasons` in `Build#features`
+merge_request: 53964
+author:
+type: added
diff --git a/changelogs/unreleased/fix-overflowing-width-at-mention-selector.yml b/changelogs/unreleased/fix-overflowing-width-at-mention-selector.yml
new file mode 100644
index 00000000000..b28395fccca
--- /dev/null
+++ b/changelogs/unreleased/fix-overflowing-width-at-mention-selector.yml
@@ -0,0 +1,5 @@
+---
+title: Fix overflowing width - at mention container
+merge_request: 54377
+author:
+type: fixed
diff --git a/changelogs/unreleased/john_long-composer-package-relative-url.yml b/changelogs/unreleased/john_long-composer-package-relative-url.yml
new file mode 100644
index 00000000000..d1938a72a9b
--- /dev/null
+++ b/changelogs/unreleased/john_long-composer-package-relative-url.yml
@@ -0,0 +1,5 @@
+---
+title: Fix relative URL with composer package
+merge_request: 53918
+author:
+type: fixed
diff --git a/changelogs/unreleased/remove-ci_jwt_include_environment-feature-flag.yml b/changelogs/unreleased/remove-ci_jwt_include_environment-feature-flag.yml
new file mode 100644
index 00000000000..459c1f69d32
--- /dev/null
+++ b/changelogs/unreleased/remove-ci_jwt_include_environment-feature-flag.yml
@@ -0,0 +1,5 @@
+---
+title: Add environment to custom CI_JOB_JWT claims
+merge_request: 54168
+author:
+type: added
diff --git a/config/feature_flags/development/ci_jwt_include_environment.yml b/config/feature_flags/development/ci_jwt_include_environment.yml
deleted file mode 100644
index ea55ce0c569..00000000000
--- a/config/feature_flags/development/ci_jwt_include_environment.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: ci_jwt_include_environment
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/53431
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/321206
-milestone: '13.9'
-type: development
-group: group::configure
-default_enabled: false
diff --git a/doc/topics/git/index.md b/doc/topics/git/index.md
index 52e8a42de76..9c3918b89c0 100644
--- a/doc/topics/git/index.md
+++ b/doc/topics/git/index.md
@@ -42,7 +42,7 @@ The following resources will help you get started with Git:
- [Git stash](../../university/training/topics/stash.md)
- [Git file blame](../../user/project/repository/git_blame.md)
- [Git file history](../../user/project/repository/git_history.md)
-- [Git tags](../../university/training/user_training.md#tags)
+- [Git tags](tags.md)
### Concepts
diff --git a/doc/topics/git/tags.md b/doc/topics/git/tags.md
new file mode 100644
index 00000000000..76e3cff3edc
--- /dev/null
+++ b/doc/topics/git/tags.md
@@ -0,0 +1,41 @@
+---
+stage: Create
+group: Source Code
+info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
+---
+
+# Tags
+
+Tags are useful for marking certain deployments and releases for later
+reference. Git supports two types of tags:
+
+- Annotated tags: An unchangeable part of Git history.
+- Lightweight (soft) tags: Tags that can be set and removed as needed.
+
+Many projects combine an annotated release tag with a stable branch. Consider
+setting deployment or release tags automatically.
+
+## Tags sample workflow
+
+1. Create a lightweight tag.
+1. Create an annotated tag.
+1. Push the tags to the remote repository.
+
+```shell
+git checkout master
+
+# Lightweight tag
+git tag my_lightweight_tag
+
+# Annotated tag
+git tag -a v1.0 -m ‘Version 1.0’
+
+# Show list of the existing tags
+git tag
+
+git push origin --tags
+```
+
+## Additional resources
+
+- [Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging) Git reference page
diff --git a/doc/university/training/index.md b/doc/university/training/index.md
index 13cf4184560..f69bd51b341 100644
--- a/doc/university/training/index.md
+++ b/doc/university/training/index.md
@@ -34,7 +34,6 @@ This section contains the following topics:
- [Merge conflicts](topics/merge_conflicts.md).
- [Rollback commits](topics/rollback_commits.md).
- [Subtree](topics/subtree.md).
-- [Tags](topics/tags.md).
- [Unstage](topics/unstage.md).
## Additional Resources
diff --git a/doc/university/training/topics/tags.md b/doc/university/training/topics/tags.md
index ca438e04a55..bb2e3e9b208 100644
--- a/doc/university/training/topics/tags.md
+++ b/doc/university/training/topics/tags.md
@@ -1,52 +1,8 @@
---
-stage: none
-group: unassigned
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
-comments: false
-type: reference
+redirect_to: '../../../topics/git/tags.md'
---
-# Tags
+This document was moved to [another location](../../../topics/git/tags.md).
-- Useful for marking deployments and releases
-- Annotated tags are an unchangeable part of Git history
-- Soft/lightweight tags can be set and removed at will
-- Many projects combine an annotated release tag with a stable branch
-- Consider setting deployment/release tags automatically
-
-## Tags sample workflow
-
-- Create a lightweight tag
-- Create an annotated tag
-- Push the tags to the remote repository
-
-```shell
-git checkout master
-
-# Lightweight tag
-git tag my_lightweight_tag
-
-# Annotated tag
-git tag -a v1.0 -m ‘Version 1.0’
-
-# Show list of the existing tags
-git tag
-
-git push origin --tags
-```
-
-**Additional resources**
-
-<https://git-scm.com/book/en/Git-Basics-Tagging>
-
-<!-- ## Troubleshooting
-
-Include any troubleshooting steps that you can foresee. If you know beforehand what issues
-one might have when setting this up, or when something is changed, or on upgrading, it's
-important to describe those, too. Think of things that may go wrong and include them here.
-This is important to minimize requests for support, and to avoid doc comments with
-questions that you know someone might ask.
-
-Each scenario can be a third-level heading, e.g. `### Getting error message X`.
-If you have none to add when creating a doc, leave this section in place
-but commented out to help encourage others to add to it in the future. -->
+<!-- This redirect file can be deleted after <YYYY-MM-DD>. -->
+<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
diff --git a/doc/user/project/merge_requests/getting_started.md b/doc/user/project/merge_requests/getting_started.md
index b1a57d9c3e6..3aa6fd63e06 100644
--- a/doc/user/project/merge_requests/getting_started.md
+++ b/doc/user/project/merge_requests/getting_started.md
@@ -132,7 +132,7 @@ To request it, open the **Reviewers** drop-down box to search for the user you w
#### Approval Rule information for Reviewers **(PREMIUM)**
-> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/233736) in GitLab 13.8. For this version only, GitLab administrators can opt to [enable it](#enable-or-disable-approval-rule-information).
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/233736) in GitLab 13.8.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/293742) in GitLab 13.9.
When editing the **Reviewers** field in a new or existing merge request, GitLab
@@ -231,33 +231,6 @@ forks are not retargeted.
reviews are faster and your changes are less prone to errors.
- Do not use capital letters nor special chars in branch names.
-## Enable or disable Approval Rule information **(PREMIUM SELF)**
-
-> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/293742) in GitLab 13.9.
-
-Merge Request Reviewers is under development and ready for production use.
-It is deployed behind a feature flag that is **enabled by default**.
-[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
-can opt to disable it.
-
-To enable it:
-
-```ruby
-# For the instance
-Feature.enable(:reviewer_approval_rules)
-# For a single project
-Feature.enable(:reviewer_approval_rules, Project.find(<project id>))
-```
-
-To disable it:
-
-```ruby
-# For the instance
-Feature.disable(:reviewer_approval_rules)
-# For a single project
-Feature.disable(:reviewer_approval_rules, Project.find(<project id>))
-```
-
### Enable or disable branch retargeting on merge **(FREE SELF)**
Automatically retargeting merge requests is under development but ready for production use.
diff --git a/lib/csv_builder.rb b/lib/csv_builder.rb
index a9ef5a83ae8..6116009f171 100644
--- a/lib/csv_builder.rb
+++ b/lib/csv_builder.rb
@@ -16,6 +16,7 @@
class CsvBuilder
DEFAULT_ORDER_BY = 'id'.freeze
DEFAULT_BATCH_SIZE = 1000
+ PREFIX_REGEX = /^[=\+\-@;]/.freeze
attr_reader :rows_written
@@ -114,8 +115,8 @@ class CsvBuilder
def excel_sanitize(line)
return if line.nil?
+ return line unless line.is_a?(String) && line.match?(PREFIX_REGEX)
- line = ["'", line].join if line =~ /^[=\+\-@;]/
- line
+ ["'", line].join
end
end
diff --git a/lib/gitlab/ci/jwt.rb b/lib/gitlab/ci/jwt.rb
index 0870c74053a..af06e124736 100644
--- a/lib/gitlab/ci/jwt.rb
+++ b/lib/gitlab/ci/jwt.rb
@@ -60,7 +60,7 @@ module Gitlab
ref_protected: build.protected.to_s
}
- if include_environment_claims?
+ if environment.present?
fields.merge!(
environment: environment.name,
environment_protected: environment_protected?.to_s
@@ -119,10 +119,6 @@ module Gitlab
def environment_protected?
false # Overridden in EE
end
-
- def include_environment_claims?
- Feature.enabled?(:ci_jwt_include_environment) && environment.present?
- end
end
end
end
diff --git a/lib/gitlab/metrics/subscribers/active_record.rb b/lib/gitlab/metrics/subscribers/active_record.rb
index d725d8d7b29..111aa2cab48 100644
--- a/lib/gitlab/metrics/subscribers/active_record.rb
+++ b/lib/gitlab/metrics/subscribers/active_record.rb
@@ -9,6 +9,7 @@ module Gitlab
IGNORABLE_SQL = %w{BEGIN COMMIT}.freeze
DB_COUNTERS = %i{db_count db_write_count db_cached_count}.freeze
+ SQL_COMMANDS_WITH_COMMENTS_REGEX = /\A(\/\*.*\*\/\s)?((?!(.*[^\w'"](DELETE|UPDATE|INSERT INTO)[^\w'"])))(WITH.*)?(SELECT)((?!(FOR UPDATE|FOR SHARE)).)*$/i.freeze
def sql(event)
# Mark this thread as requiring a database connection. This is used
@@ -37,7 +38,7 @@ module Gitlab
private
def select_sql_command?(payload)
- payload[:sql].match(/\A((?!(.*[^\w'"](DELETE|UPDATE|INSERT INTO)[^\w'"])))(WITH.*)?(SELECT)((?!(FOR UPDATE|FOR SHARE)).)*$/i)
+ payload[:sql].match(SQL_COMMANDS_WITH_COMMENTS_REGEX)
end
def increment_db_counters(payload)
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 09a2dc6b5c3..c78da6956a9 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -3517,6 +3517,9 @@ msgstr ""
msgid "An error occurred. Please try again."
msgstr ""
+msgid "An error ocurred while drawing job relationship links."
+msgstr ""
+
msgid "An error ocurred while loading your content. Please try again."
msgstr ""
diff --git a/spec/lib/gitlab/ci/jwt_spec.rb b/spec/lib/gitlab/ci/jwt_spec.rb
index 342ca6b8b75..480a4a05379 100644
--- a/spec/lib/gitlab/ci/jwt_spec.rb
+++ b/spec/lib/gitlab/ci/jwt_spec.rb
@@ -114,17 +114,6 @@ RSpec.describe Gitlab::Ci::Jwt do
expect(payload[:environment]).to eq('production')
expect(payload[:environment_protected]).to eq('false')
end
-
- context ':ci_jwt_include_environment feature flag is disabled' do
- before do
- stub_feature_flags(ci_jwt_include_environment: false)
- end
-
- it 'does not include environment attributes' do
- expect(payload).not_to have_key(:environment)
- expect(payload).not_to have_key(:environment_protected)
- end
- end
end
end
diff --git a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
index edcd5b31941..209eb3f90a4 100644
--- a/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
+++ b/spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
@@ -17,6 +17,15 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
)
end
+ # Emulate Marginalia pre-pending comments
+ def sql(query, comments: true)
+ if comments
+ "/*application:web,controller:badges,action:pipeline,correlation_id:01EYN39K9VMJC56Z7808N7RSRH*/ #{query}"
+ else
+ query
+ end
+ end
+
describe '#sql' do
shared_examples 'track query in metrics' do
before do
@@ -101,7 +110,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
expect { subscriber.sql(event) }.to change { Thread.current[:uses_db_connection] }.from(nil).to(true)
end
- context 'with read query' do
+ shared_examples 'read queries' do
let(:expected_counters) do
{
db_count: 1,
@@ -114,14 +123,14 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
it_behaves_like 'track query in RequestStore'
context 'with only select' do
- let(:payload) { { sql: 'WITH active_milestones AS (SELECT COUNT(*), state FROM milestones GROUP BY state) SELECT * FROM active_milestones' } }
+ let(:payload) { { sql: sql('WITH active_milestones AS (SELECT COUNT(*), state FROM milestones GROUP BY state) SELECT * FROM active_milestones', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
end
- context 'write query' do
+ shared_examples 'write queries' do
let(:expected_counters) do
{
db_count: 1,
@@ -131,7 +140,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
end
context 'with select for update sql event' do
- let(:payload) { { sql: 'SELECT * FROM users WHERE id = 10 FOR UPDATE' } }
+ let(:payload) { { sql: sql('SELECT * FROM users WHERE id = 10 FOR UPDATE', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
@@ -139,7 +148,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
context 'with common table expression' do
context 'with insert' do
- let(:payload) { { sql: 'WITH archived_rows AS (SELECT * FROM users WHERE archived = true) INSERT INTO products_log SELECT * FROM archived_rows' } }
+ let(:payload) { { sql: sql('WITH archived_rows AS (SELECT * FROM users WHERE archived = true) INSERT INTO products_log SELECT * FROM archived_rows', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
@@ -147,27 +156,41 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
end
context 'with delete sql event' do
- let(:payload) { { sql: 'DELETE FROM users where id = 10' } }
+ let(:payload) { { sql: sql('DELETE FROM users where id = 10', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
context 'with insert sql event' do
- let(:payload) { { sql: 'INSERT INTO project_ci_cd_settings (project_id) SELECT id FROM projects' } }
+ let(:payload) { { sql: sql('INSERT INTO project_ci_cd_settings (project_id) SELECT id FROM projects', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
context 'with update sql event' do
- let(:payload) { { sql: 'UPDATE users SET admin = true WHERE id = 10' } }
+ let(:payload) { { sql: sql('UPDATE users SET admin = true WHERE id = 10', comments: comments) } }
it_behaves_like 'track query in metrics'
it_behaves_like 'track query in RequestStore'
end
end
+ context 'without Marginalia comments' do
+ let(:comments) { false }
+
+ it_behaves_like 'write queries'
+ it_behaves_like 'read queries'
+ end
+
+ context 'with Marginalia comments' do
+ let(:comments) { true }
+
+ it_behaves_like 'write queries'
+ it_behaves_like 'read queries'
+ end
+
context 'with cached query' do
let(:expected_counters) do
{
@@ -180,7 +203,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
context 'with cached payload ' do
let(:payload) do
{
- sql: 'SELECT * FROM users WHERE id = 10',
+ sql: sql('SELECT * FROM users WHERE id = 10'),
cached: true
}
end
@@ -192,7 +215,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
context 'with cached payload name' do
let(:payload) do
{
- sql: 'SELECT * FROM users WHERE id = 10',
+ sql: sql('SELECT * FROM users WHERE id = 10'),
name: 'CACHE'
}
end
@@ -208,7 +231,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActiveRecord do
:event,
name: 'sql.active_record',
payload: {
- sql: "SELECT attr.attname FROM pg_attribute attr INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey) WHERE cons.contype = 'p' AND cons.conrelid = '\"projects\"'::regclass",
+ sql: sql("SELECT attr.attname FROM pg_attribute attr INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey) WHERE cons.contype = 'p' AND cons.conrelid = '\"projects\"'::regclass"),
name: 'SCHEMA',
connection_id: 135,
statement_name: nil,
diff --git a/spec/presenters/packages/composer/packages_presenter_spec.rb b/spec/presenters/packages/composer/packages_presenter_spec.rb
index 19d99a62468..0c2631f2b01 100644
--- a/spec/presenters/packages/composer/packages_presenter_spec.rb
+++ b/spec/presenters/packages/composer/packages_presenter_spec.rb
@@ -67,10 +67,14 @@ RSpec.describe ::Packages::Composer::PackagesPresenter do
{
'packages' => [],
'provider-includes' => { 'p/%hash%.json' => { 'sha256' => /^\h+$/ } },
- 'providers-url' => "/api/v4/group/#{group.id}/-/packages/composer/%package%$%hash%.json"
+ 'providers-url' => "prefix/api/v4/group/#{group.id}/-/packages/composer/%package%$%hash%.json"
}
end
+ before do
+ stub_config(gitlab: { relative_url_root: 'prefix' })
+ end
+
it 'returns the provider json' do
expect(subject).to match(expected_json)
end
diff --git a/spec/requests/api/ci/runner/jobs_request_post_spec.rb b/spec/requests/api/ci/runner/jobs_request_post_spec.rb
index 74d8e3f7ae8..3cc27d0e1eb 100644
--- a/spec/requests/api/ci/runner/jobs_request_post_spec.rb
+++ b/spec/requests/api/ci/runner/jobs_request_post_spec.rb
@@ -198,7 +198,12 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
'when' => 'on_success' }]
end
- let(:expected_features) { { 'trace_sections' => true } }
+ let(:expected_features) do
+ {
+ 'trace_sections' => true,
+ 'failure_reasons' => include('script_failure')
+ }
+ end
it 'picks a job' do
request_job info: { platform: :darwin }
@@ -220,7 +225,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
expect(json_response['artifacts']).to eq(expected_artifacts)
expect(json_response['cache']).to eq(expected_cache)
expect(json_response['variables']).to include(*expected_variables)
- expect(json_response['features']).to eq(expected_features)
+ expect(json_response['features']).to match(expected_features)
end
it 'creates persistent ref' do