Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-10-14 03:10:15 +00:00
parent dcd075c981
commit 7ad11b777a
26 changed files with 211 additions and 55 deletions

View File

@ -1,21 +1,22 @@
---
# Cop supports --auto-correct.
Style/NumericLiteralPrefix:
# Offense count: 148
# Temporarily disabled due to too many offenses
Enabled: false
Details: grace period
Exclude:
- 'app/models/container_repository.rb'
- 'app/services/packages/debian/generate_distribution_key_service.rb'
- 'config/initializers/01_secret_token.rb'
- 'config/initializers/1_settings.rb'
- 'db/post_migrate/20220131000001_schedule_trace_expiry_removal.rb'
- 'ee/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size.rb'
- 'ee/lib/gitlab/geo/replication/blob_downloader.rb'
- 'ee/spec/lib/bulk_imports/groups/pipelines/iterations_pipeline_spec.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size_spec.rb'
- 'ee/spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb'
- 'ee/spec/lib/gitlab/geo/replication/blob_downloader_spec.rb'
- 'ee/spec/migrations/schedule_trace_expiry_removal_spec.rb'
- 'ee/spec/models/analytics/devops_adoption/snapshot_spec.rb'
- 'ee/spec/models/ci/minutes/usage_spec.rb'
- 'ee/spec/models/ee/group_spec.rb'
- 'ee/spec/models/gitlab/seat_link_data_spec.rb'
- 'ee/spec/services/incident_management/oncall_schedules/update_service_spec.rb'
@ -27,18 +28,17 @@ Style/NumericLiteralPrefix:
- 'lib/gitlab/jwt_authenticatable.rb'
- 'lib/system_check/app/uploads_path_permission_check.rb'
- 'lib/system_check/app/uploads_path_tmp_permission_check.rb'
- 'lib/tasks/gitlab/backup.rake'
- 'lib/tasks/tanuki_emoji.rake'
- 'metrics_server/metrics_server.rb'
- 'qa/qa/support/ssh.rb'
- 'qa/spec/support/ssh_spec.rb'
- 'scripts/security-harness'
- 'spec/finders/personal_access_tokens_finder_spec.rb'
- 'spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb'
- 'spec/lib/gitlab/database/background_migration/batched_job_spec.rb'
- 'spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb'
- 'spec/lib/gitlab/encoding_helper_spec.rb'
- 'spec/lib/gitlab/git/diff_spec.rb'
- 'spec/lib/gitlab/git/repository_spec.rb'
- 'spec/lib/gitlab/git/tree_spec.rb'
- 'spec/lib/gitlab/gitaly_client/blobs_stitcher_spec.rb'
- 'spec/lib/gitlab/gitaly_client/conflict_files_stitcher_spec.rb'
- 'spec/lib/gitlab/gitaly_client/diff_spec.rb'
@ -65,10 +65,11 @@ Style/NumericLiteralPrefix:
- 'spec/lib/gitlab/puma_logging/json_formatter_spec.rb'
- 'spec/lib/gitlab/relative_positioning/range_spec.rb'
- 'spec/metrics_server/metrics_server_spec.rb'
- 'spec/migrations/20220506154054_create_sync_namespace_details_trigger_spec.rb'
- 'spec/migrations/20220524184149_create_sync_project_namespace_details_trigger_spec.rb'
- 'spec/models/issue_spec.rb'
- 'spec/models/repository_spec.rb'
- 'spec/support/helpers/repo_helpers.rb'
- 'spec/support/helpers/test_env.rb'
- 'spec/models/personal_access_token_spec.rb'
- 'spec/requests/api/personal_access_tokens_spec.rb'
- 'spec/support/import_export/export_file_helper.rb'
- 'spec/support/shared_examples/requests/api/nuget_packages_shared_examples.rb'
- 'spec/support/shared_examples/services/packages/debian/generate_distribution_shared_examples.rb'

View File

@ -19,8 +19,14 @@ export const temporaryConfig = {
WorkItem: {
fields: {
widgets: {
merge(_, incoming) {
return incoming;
merge(existing = [], incoming) {
if (existing.length === 0) {
return incoming;
}
return existing.map((existingWidget) => {
const incomingWidget = incoming.find((w) => w.type === existingWidget.type);
return incomingWidget || existingWidget;
});
},
},
},

View File

@ -1,4 +1,3 @@
#import "~/graphql_shared/fragments/user.fragment.graphql"
#import "ee_else_ce/work_items/graphql/work_item_widgets.fragment.graphql"
fragment WorkItem on WorkItem {

View File

@ -1,9 +1,21 @@
#import "./work_item.fragment.graphql"
#import "~/graphql_shared/fragments/user.fragment.graphql"
subscription issuableAssignees($issuableId: IssuableID!) {
issuableAssigneesUpdated(issuableId: $issuableId) {
... on WorkItem {
...WorkItem
id
widgets {
... on WorkItemWidgetAssignees {
type
allowsMultipleAssignees
canInviteMembers
assignees {
nodes {
...User
}
}
}
}
}
}
}

View File

@ -1,9 +1,14 @@
#import "./work_item.fragment.graphql"
subscription issuableDatesUpdated($issuableId: IssuableID!) {
issuableDatesUpdated(issuableId: $issuableId) {
... on WorkItem {
...WorkItem
id
widgets {
... on WorkItemWidgetStartAndDueDate {
type
dueDate
startDate
}
}
}
}
}

View File

@ -58,5 +58,13 @@ module WorkItems
def payload(work_item)
{ work_item: work_item }
end
def handle_label_changes(issuable, old_labels)
return false unless super
Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter.track_work_item_labels_changed_action(
author: current_user
)
end
end
end

View File

@ -1,5 +1,3 @@
-# "MaxBuilds" is a runner configuration keyword so it must not be translated.
- link = link_to 'MaxBuilds', 'https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersmachine-section', target: '_blank', rel: 'noopener noreferrer'
- shared_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('ci/runners/runners_scope.md', anchor: 'shared-runners') }
%h4
@ -9,5 +7,3 @@
%p= s_('Runners|%{link_start}These runners%{link_end} are available to all groups and projects.').html_safe % { link_start: shared_link_start, link_end: '</a>'.html_safe }
- if Gitlab::CurrentSettings.shared_runners_text.present?
= markdown(Gitlab::CurrentSettings.current_application_settings.shared_runners_text)
- else
%p= _('The same shared runner executes code from multiple projects, unless you configure autoscaling with %{link} set to 1 (which it is on GitLab.com).').html_safe % { link: link }

View File

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/366662
milestone: '15.5'
type: development
group: group::geo
default_enabled: false
default_enabled: true

View File

@ -20,6 +20,7 @@ options:
- users_creating_work_items
- users_updating_work_item_title
- users_updating_work_item_dates
- users_updating_work_item_labels
data_category: optional
distribution:
- ce

View File

@ -20,6 +20,7 @@ options:
- users_creating_work_items
- users_updating_work_item_title
- users_updating_work_item_dates
- users_updating_work_item_labels
data_category: optional
distribution:
- ce

View File

@ -20,6 +20,7 @@ options:
- users_creating_work_items
- users_updating_work_item_title
- users_updating_work_item_dates
- users_updating_work_item_labels
data_category: optional
distribution:
- ce

View File

@ -0,0 +1,25 @@
---
key_path: redis_hll_counters.work_items.users_updating_work_item_labels_monthly
description: Unique users updating a work item's labels
product_category: team_planning
product_section: dev
product_stage: plan
product_group: project_management
value_type: number
status: active
milestone: '15.5'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100485
time_frame: 28d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- users_updating_work_item_labels
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View File

@ -20,6 +20,7 @@ options:
- users_creating_work_items
- users_updating_work_item_title
- users_updating_work_item_dates
- users_updating_work_item_labels
data_category: optional
distribution:
- ce

View File

@ -20,6 +20,7 @@ options:
- users_creating_work_items
- users_updating_work_item_title
- users_updating_work_item_dates
- users_updating_work_item_labels
data_category: optional
distribution:
- ce

View File

@ -20,6 +20,7 @@ options:
- users_creating_work_items
- users_updating_work_item_title
- users_updating_work_item_dates
- users_updating_work_item_labels
data_category: optional
distribution:
- ce

View File

@ -0,0 +1,25 @@
---
key_path: redis_hll_counters.work_items.users_updating_work_item_labels_weekly
description: Unique users updating a work item's labels
product_category: team_planning
product_section: dev
product_stage: plan
product_group: project_management
value_type: number
status: active
milestone: '15.5'
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100485
time_frame: 7d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- users_updating_work_item_labels
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

View File

@ -436,6 +436,25 @@ of the Code Review Comments page on the Go wiki for more details.
Most editors/IDEs allow you to run commands before/after saving a file, you can set it
up to run `goimports -local gitlab.com/gitlab-org` so that it's applied to every file when saving.
### Naming branches
Only use the characters `a-z`, `0-9` or `-` in branch names. This restriction is due to the fact that `go get` doesn't work as expected when a branch name contains certain characters, such as a slash `/`:
```shell
$ go get -u gitlab.com/gitlab-org/security-products/analyzers/report/v3@some-user/some-feature
go get: gitlab.com/gitlab-org/security-products/analyzers/report/v3@some-user/some-feature: invalid version: version "some-user/some-feature" invalid: disallowed version string
```
If a branch name contains a slash, it forces us to refer to the commit SHA instead, which is less flexible. For example:
```shell
$ go get -u gitlab.com/gitlab-org/security-products/analyzers/report/v3@5c9a4279fa1263755718cf069d54ba8051287954
go: downloading gitlab.com/gitlab-org/security-products/analyzers/report/v3 v3.15.3-0.20221012172609-5c9a4279fa12
...
```
### Initializing slices
If initializing a slice, provide a capacity where possible to avoid extra

View File

@ -41,6 +41,7 @@ module API
resource :bulk_imports do
desc 'Start a new GitLab Migration' do
detail 'This feature was introduced in GitLab 14.2.'
success Entities::BulkImport
end
params do
requires :configuration, type: Hash, desc: 'The source GitLab instance configuration' do
@ -87,6 +88,7 @@ module API
desc 'List all GitLab Migrations' do
detail 'This feature was introduced in GitLab 14.1.'
success Entities::BulkImport
end
params do
use :pagination
@ -101,6 +103,7 @@ module API
desc "List all GitLab Migrations' entities" do
detail 'This feature was introduced in GitLab 14.1.'
success Entities::BulkImports::Entity
end
params do
use :pagination
@ -120,6 +123,7 @@ module API
desc 'Get GitLab Migration details' do
detail 'This feature was introduced in GitLab 14.1.'
success Entities::BulkImport
end
params do
requires :import_id, type: Integer, desc: "The ID of user's GitLab Migration"
@ -130,6 +134,7 @@ module API
desc "List GitLab Migration entities" do
detail 'This feature was introduced in GitLab 14.1.'
success Entities::BulkImports::Entity
end
params do
requires :import_id, type: Integer, desc: "The ID of user's GitLab Migration"
@ -143,6 +148,7 @@ module API
desc 'Get GitLab Migration entity details' do
detail 'This feature was introduced in GitLab 14.1.'
success Entities::BulkImports::Entity
end
params do
requires :import_id, type: Integer, desc: "The ID of user's GitLab Migration"

View File

@ -14,3 +14,8 @@
redis_slot: users
aggregation: weekly
feature_flag: track_work_items_activity
- name: users_updating_work_item_labels
category: work_items
redis_slot: users
aggregation: weekly
feature_flag: track_work_items_activity

View File

@ -6,6 +6,7 @@ module Gitlab
WORK_ITEM_CREATED = 'users_creating_work_items'
WORK_ITEM_TITLE_CHANGED = 'users_updating_work_item_title'
WORK_ITEM_DATE_CHANGED = 'users_updating_work_item_dates'
WORK_ITEM_LABELS_CHANGED = 'users_updating_work_item_labels'
class << self
def track_work_item_created_action(author:)
@ -20,6 +21,10 @@ module Gitlab
track_unique_action(WORK_ITEM_DATE_CHANGED, author)
end
def track_work_item_labels_changed_action(author:)
track_unique_action(WORK_ITEM_LABELS_CHANGED, author)
end
private
def track_unique_action(action, author)

View File

@ -40452,9 +40452,6 @@ msgstr ""
msgid "The resource that you are attempting to access does not exist or you don't have permission to perform this action."
msgstr ""
msgid "The same shared runner executes code from multiple projects, unless you configure autoscaling with %{link} set to 1 (which it is on GitLab.com)."
msgstr ""
msgid "The scan has been created."
msgstr ""

View File

@ -160,16 +160,6 @@ RSpec.describe 'Runners' do
end
context 'shared runner text' do
context 'when application settings have no shared_runners_text' do
it 'user sees default shared runners description' do
visit project_runners_path(project)
page.within("[data-testid='shared-runners-description']") do
expect(page).to have_content('The same shared runner executes code from multiple projects')
end
end
end
context 'when application settings have shared_runners_text' do
let(:shared_runners_text) { 'custom **shared** runners description' }
let(:shared_runners_html) { 'custom shared runners description' }

View File

@ -28,4 +28,12 @@ RSpec.describe Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter, :clean_
it_behaves_like 'work item unique counter'
end
describe '.track_work_item_labels_changed_action' do
subject(:track_event) { described_class.track_work_item_labels_changed_action(author: user) }
let(:event_name) { described_class::WORK_ITEM_LABELS_CHANGED }
it_behaves_like 'work item unique counter'
end
end

View File

@ -108,24 +108,6 @@ RSpec.describe WorkItems::UpdateService do
end
end
context 'when labels are updated' do
let_it_be(:label_a) { create(:label, project: project) }
let_it_be(:label_b) { create(:label, project: project) }
let(:issuable) { work_item }
it_behaves_like 'broadcasting issuable labels updates' do
def update_issuable(update_params)
described_class.new(
project: project,
current_user: current_user,
params: update_params,
spam_params: spam_params,
widget_params: widget_params
).execute(work_item)
end
end
end
context 'when updating state_event' do
context 'when state_event is close' do
let(:opts) { { state_event: 'close' } }
@ -330,5 +312,65 @@ RSpec.describe WorkItems::UpdateService do
end
end
end
describe 'label updates' do
let_it_be(:label1) { create(:label, project: project) }
let_it_be(:label2) { create(:label, project: project) }
context 'when labels are changed' do
let(:label) { create(:label, project: project) }
let(:opts) { { label_ids: [label1.id] } }
it 'tracks users updating work item labels' do
expect(Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter).to receive(:track_work_item_labels_changed_action).with(author: current_user)
update_work_item
end
it_behaves_like 'broadcasting issuable labels updates' do
let(:issuable) { work_item }
let(:label_a) { label1 }
let(:label_b) { label2 }
def update_issuable(update_params)
described_class.new(
project: project,
current_user: current_user,
params: update_params,
spam_params: spam_params,
widget_params: widget_params
).execute(work_item)
end
end
end
context 'when labels are not changed' do
shared_examples 'work item update that does not track label updates' do
it 'does not track users updating work item labels' do
expect(Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter).not_to receive(:track_work_item_labels_changed_action)
update_work_item
end
end
context 'when labels param is not provided' do
let(:opts) { { title: 'not updating labels' } }
it_behaves_like 'work item update that does not track label updates'
end
context 'when labels param is provided but labels remain unchanged' do
let(:opts) { { label_ids: [] } }
it_behaves_like 'work item update that does not track label updates'
end
context 'when labels param is provided invalid values' do
let(:opts) { { label_ids: [non_existing_record_id] } }
it_behaves_like 'work item update that does not track label updates'
end
end
end
end
end

View File

@ -34,7 +34,7 @@ require (
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
golang.org/x/tools v0.1.12
google.golang.org/grpc v1.49.0
google.golang.org/grpc v1.50.0
google.golang.org/protobuf v1.28.1
honnef.co/go/tools v0.3.3
)

View File

@ -1549,8 +1549,9 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw=
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=