Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-09-17 00:09:10 +00:00
parent 7503a3227d
commit 86eb30c847
7 changed files with 16 additions and 34 deletions

View File

@ -1,8 +0,0 @@
---
name: track_all_ci_template_inclusions
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69204
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/339684
milestone: '14.3'
type: development
group: group::pipeline authoring
default_enabled: false

View File

@ -249,6 +249,8 @@
- 1
- - namespaces_onboarding_user_added
- 1
- - namespaces_sync_namespace_name
- 1
- - new_epic
- 2
- - new_issue

View File

@ -29,5 +29,5 @@
documentation_url: # (optional) This is a link to the current documentation page
image_url: # (optional) This is a link to a thumbnail image depicting the feature
video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg
announcement_date: # (optional - may be required in the future) YYYY-MM-DD format - the date of the milestone release when this feature was first announced as deprecated
announcement_date: # YYYY-MM-DD format - the date of the milestone release when this feature was first announced as deprecated
removal_date: # (optional - may be required in the future) YYYY-MM-DD format - the date of the milestone release when this feature is planned to be removed

View File

@ -5,6 +5,14 @@ info: To determine the technical writer assigned to the Stage/Group associated w
description: Learn how to contribute to GitLab Documentation.
---
<!---
The clean_redirects Rake task in the gitlab-docs repository manually
excludes this file. If the line containing remove_date is moved to a new
document, update the Rake task with the new location.
https://gitlab.com/gitlab-org/gitlab-docs/-/blob/1979f985708d64558bb487fbe9ed5273729c01b7/Rakefile#L306
--->
# Redirects in GitLab documentation
Moving or renaming a document is the same as changing its location. Be sure

View File

@ -390,7 +390,7 @@ end
**Creating a new table when we have two foreign keys:**
Only one foreign key should be created per migration. This is because [the addition of a foreign key constraint requires a `SHARE ROW EXCLUSIVE` lock on the referenced table](https://www.postgresql.org/docs/12/sql-createtable.html#:~:text=The%20addition%20of%20a%20foreign%20key%20constraint%20requires%20a%20SHARE%20ROW%20EXCLUSIVE%20lock%20on%20the%20referenced%20table), and locking multiple tables in the same transaction should be avoided.
Only one foreign key should be created per transaction. This is because [the addition of a foreign key constraint requires a `SHARE ROW EXCLUSIVE` lock on the referenced table](https://www.postgresql.org/docs/12/sql-createtable.html#:~:text=The%20addition%20of%20a%20foreign%20key%20constraint%20requires%20a%20SHARE%20ROW%20EXCLUSIVE%20lock%20on%20the%20referenced%20table), and locking multiple tables in the same transaction should be avoided.
For this, we need three migrations:

View File

@ -21,8 +21,6 @@ module Gitlab::UsageDataCounters
class << self
def track_unique_project_event(project_id:, template:, config_source:)
return unless TEMPLATE_TO_EVENT[template] || Feature.enabled?(:track_all_ci_template_inclusions, default_enabled: :yaml)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event(ci_template_event_name(template, config_source), values: project_id)
end

View File

@ -90,29 +90,11 @@ RSpec.describe Gitlab::UsageDataCounters::CiTemplateUniqueCounter do
end.not_to raise_error
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(track_all_ci_template_inclusions: false)
end
it "tracks #{template}" do
expected_template_event_name = described_class.ci_template_event_name(template, :repository_source)
expect(Gitlab::UsageDataCounters::HLLRedisCounter).to(receive(:track_event)).with(expected_template_event_name, values: project_id)
it "does not track #{template}" do
expect(Gitlab::UsageDataCounters::HLLRedisCounter).not_to(receive(:track_event))
described_class.track_unique_project_event(project_id: project_id, template: template, config_source: config_source)
end
end
context 'when feature flag is enabled' do
before do
stub_feature_flags(track_all_ci_template_inclusions: true)
end
it "tracks #{template}" do
expected_template_event_name = described_class.ci_template_event_name(template, :repository_source)
expect(Gitlab::UsageDataCounters::HLLRedisCounter).to(receive(:track_event)).with(expected_template_event_name, values: project_id)
described_class.track_unique_project_event(project_id: project_id, template: template, config_source: config_source)
end
described_class.track_unique_project_event(project_id: project_id, template: template, config_source: config_source)
end
end
end