diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 00:10:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-08 00:10:42 +0000 |
commit | 9f1ce98c1d456b962fc43ec99180e042592fa307 (patch) | |
tree | 9083abfee167f7d31738571b0d29ecd2d8b12820 | |
parent | 919e3e3cd83e76dba137ef9bcc4746214c2085ff (diff) | |
download | gitlab-ce-9f1ce98c1d456b962fc43ec99180e042592fa307.tar.gz |
Add latest changes from gitlab-org/gitlab@master
18 files changed, 71 insertions, 123 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index c3ee1a551a8..c416e63c45e 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -10880feb242899156d4a1d5224cb445f1ff6680c +ac4a86a34094f43541fb68f8e80dd1bc9875e9e6 diff --git a/app/assets/javascripts/nav/components/top_nav_dropdown_menu.vue b/app/assets/javascripts/nav/components/top_nav_dropdown_menu.vue index 97856eaf256..0f069670d09 100644 --- a/app/assets/javascripts/nav/components/top_nav_dropdown_menu.vue +++ b/app/assets/javascripts/nav/components/top_nav_dropdown_menu.vue @@ -76,7 +76,11 @@ export default { :class="menuClass" data-testid="menu-sidebar" > - <top-nav-menu-sections :sections="menuSections" @menu-item-click="onMenuItemClick" /> + <top-nav-menu-sections + :sections="menuSections" + :is-primary-section="true" + @menu-item-click="onMenuItemClick" + /> </div> <keep-alive-slots v-show="activeView" diff --git a/app/assets/javascripts/nav/components/top_nav_menu_sections.vue b/app/assets/javascripts/nav/components/top_nav_menu_sections.vue index 97e63c7324e..1f3f11dc624 100644 --- a/app/assets/javascripts/nav/components/top_nav_menu_sections.vue +++ b/app/assets/javascripts/nav/components/top_nav_menu_sections.vue @@ -1,7 +1,7 @@ <script> import TopNavMenuItem from './top_nav_menu_item.vue'; -const BORDER_CLASSES = 'gl-pt-3 gl-border-1 gl-border-t-solid gl-border-gray-50'; +const BORDER_CLASSES = 'gl-pt-3 gl-border-1 gl-border-t-solid'; export default { components: { @@ -17,6 +17,11 @@ export default { required: false, default: false, }, + isPrimarySection: { + type: Boolean, + required: false, + default: false, + }, }, methods: { onClick(menuItem) { @@ -30,8 +35,11 @@ export default { getMenuSectionClasses(index) { // This is a method instead of a computed so we don't have to incur the cost of // creating a whole new array/object. + const hasBorder = this.withTopBorder || index > 0; return { - [BORDER_CLASSES]: this.withTopBorder || index > 0, + [BORDER_CLASSES]: hasBorder, + 'gl-border-gray-100': hasBorder && this.isPrimarySection, + 'gl-border-gray-50': hasBorder && !this.isPrimarySection, 'gl-mt-3': index > 0, }; }, diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index 0669f051457..980275147ae 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -246,7 +246,16 @@ module IssuableActions end def bulk_update_params - params.require(:update).permit(bulk_update_permitted_keys) + clean_bulk_update_params( + params.require(:update).permit(bulk_update_permitted_keys) + ) + end + + def clean_bulk_update_params(permitted_params) + assignee_ids = permitted_params[:assignee_ids] + return permitted_params unless assignee_ids.is_a?(Array) && assignee_ids.compact.empty? + + permitted_params.except(:assignee_ids) end def bulk_update_permitted_keys diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb index 8fa80dc3513..75e1adec41b 100644 --- a/app/services/merge_requests/create_service.rb +++ b/app/services/merge_requests/create_service.rb @@ -39,11 +39,7 @@ module MergeRequests # open while the Gitaly RPC waits. To avoid an idle in transaction # timeout, we do this before we attempt to save the merge request. - if Feature.enabled?(:async_merge_request_diff_creation, merge_request.target_project) - merge_request.skip_ensure_merge_request_diff = true - else - merge_request.eager_fetch_ref! - end + merge_request.skip_ensure_merge_request_diff = true end def set_projects! diff --git a/config/feature_flags/development/async_merge_request_diff_creation.yml b/config/feature_flags/development/async_merge_request_diff_creation.yml deleted file mode 100644 index 8e4bdd13b2b..00000000000 --- a/config/feature_flags/development/async_merge_request_diff_creation.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: async_merge_request_diff_creation -introduced_by_url: "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100390" -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/376759 -milestone: '15.6' -type: development -group: group::code review -default_enabled: false diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md index fd511b05770..fd9e885e097 100644 --- a/doc/development/documentation/index.md +++ b/doc/development/documentation/index.md @@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w description: Learn how to contribute to GitLab Documentation. --- -# GitLab documentation +# Contribute to the GitLab documentation The GitLab documentation is [intended as the single source of truth (SSOT)](https://about.gitlab.com/handbook/documentation/) for information about how to configure, use, and troubleshoot GitLab. The documentation contains use cases and usage instructions for every GitLab feature, organized by product area and subject. This includes topics and workflows that span multiple GitLab features and the use of GitLab with other applications. diff --git a/doc/development/service_ping/implement.md b/doc/development/service_ping/implement.md index 1e5f4191375..ef2e7e6edf5 100644 --- a/doc/development/service_ping/implement.md +++ b/doc/development/service_ping/implement.md @@ -356,8 +356,6 @@ Implemented using Redis methods [PFADD](https://redis.io/commands/pfadd/) and [P `{users}_creating_epics-2020-34`. If `redis_slot` is not defined the Redis key will be `{users_creating_epics}-2020-34`. Recommended slots to use are: `users`, `projects`. This is the value we count. - - `expiry`: expiry time in days. Default: 29 days for daily aggregation and 6 weeks for weekly - aggregation. - `aggregation`: may be set to a `:daily` or `:weekly` key. Defines how counting data is stored in Redis. Aggregation on a `daily` basis does not pull more fine grained data. - `feature_flag`: if no feature flag is set then the tracking is enabled. One feature flag can be used for multiple events. For details, see our [GitLab internal Feature flags](../feature_flags/index.md) documentation. The feature flags are owned by the group adding the event tracking. @@ -498,9 +496,6 @@ Next, get the unique events for the current week. We have the following recommendations for [adding new events](#add-new-events): - Event aggregation: weekly. -- Key expiry time: - - Daily: 29 days. - - Weekly: 42 days. - When adding new metrics, use a [feature flag](../../operations/feature_flags.md) to control the impact. - For feature flags triggered by another service, set `default_enabled: false`, - Events can be triggered using the `UsageData` API, which helps when there are > 10 events per change diff --git a/doc/integration/advanced_search/elasticsearch.md b/doc/integration/advanced_search/elasticsearch.md index 9a42a6112e7..09c7873922d 100644 --- a/doc/integration/advanced_search/elasticsearch.md +++ b/doc/integration/advanced_search/elasticsearch.md @@ -612,7 +612,6 @@ In addition to the Rake tasks, there are some environment variables that can be | Environment Variable | Data Type | What it does | | -------------------- |:---------:| ---------------------------------------------------------------------------- | -| `UPDATE_INDEX` | Boolean | Tells the indexer to overwrite any existing index data (true/false). | | `ID_TO` | Integer | Tells the indexer to only index projects less than or equal to the value. | | `ID_FROM` | Integer | Tells the indexer to only index projects greater than or equal to the value. | @@ -770,21 +769,7 @@ Make sure to prepare for this task by having a NOTE: Sometimes the project indexing jobs queued by `gitlab:elastic:index_projects` can get interrupted. This may happen for many reasons, but it's always safe - to run the indexing task again. It skips repositories that have - already been indexed. - - As the indexer stores the last commit SHA of every indexed repository in the - database, you can run the indexer with the special parameter `UPDATE_INDEX` and - it checks every project repository again to make sure that every commit in - a repository is indexed, which can be useful in case if your index is outdated: - - ```shell - # Omnibus installations - sudo gitlab-rake gitlab:elastic:index_projects UPDATE_INDEX=true ID_TO=1000 - - # Installations from source - bundle exec rake gitlab:elastic:index_projects UPDATE_INDEX=true ID_TO=1000 RAILS_ENV=production - ``` + to run the indexing task again. You can also use the `gitlab:elastic:clear_index_status` Rake task to force the indexer to "forget" all progress, so it retries the indexing process from the diff --git a/doc/user/project/merge_requests/creating_merge_requests.md b/doc/user/project/merge_requests/creating_merge_requests.md index bda747671ba..9dce203f328 100644 --- a/doc/user/project/merge_requests/creating_merge_requests.md +++ b/doc/user/project/merge_requests/creating_merge_requests.md @@ -82,7 +82,7 @@ merge request is merged. You can create a merge request when you add, edit, or upload a file to a repository. -1. Add, edit, or upload a file to the repository. +1. [Add, edit, or upload](../repository/web_editor.md) a file to the repository. 1. In the **Commit message**, enter a reason for the commit. 1. Select the **Target branch** or create a new branch by typing the name (without spaces, capital letters, or special chars). 1. Select the **Start a new merge request with these changes** checkbox or toggle. This checkbox or toggle is visible only diff --git a/lib/gitlab/usage_data_counters/hll_redis_counter.rb b/lib/gitlab/usage_data_counters/hll_redis_counter.rb index 992cec2d174..b809e6c4e42 100644 --- a/lib/gitlab/usage_data_counters/hll_redis_counter.rb +++ b/lib/gitlab/usage_data_counters/hll_redis_counter.rb @@ -35,7 +35,6 @@ module Gitlab # - name: g_compliance_dashboard # Unique event name # redis_slot: compliance # Optional slot name, if not defined it will use name as a slot, used for totals # category: compliance # Group events in categories - # expiry: 29 # Optional expiration time in days, default value 29 days for daily and 6.weeks for weekly # aggregation: daily # Aggregation level, keys are stored daily or weekly # feature_flag: # The event feature flag # @@ -203,8 +202,6 @@ module Gitlab end def expiry(event) - return event[:expiry].days if event[:expiry].present? - event[:aggregation].to_sym == :daily ? DEFAULT_DAILY_KEY_EXPIRY_LENGTH : DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH end diff --git a/lib/gitlab/usage_data_counters/known_events/common.yml b/lib/gitlab/usage_data_counters/known_events/common.yml index 861f3dd952d..ae15530f0d0 100644 --- a/lib/gitlab/usage_data_counters/known_events/common.yml +++ b/lib/gitlab/usage_data_counters/known_events/common.yml @@ -3,22 +3,18 @@ - name: g_edit_by_web_ide category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: g_edit_by_sfe category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: g_edit_by_snippet_ide category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: g_edit_by_live_preview category: ide_edit redis_slot: edit - expiry: 29 aggregation: daily - name: i_search_total category: search @@ -310,7 +306,6 @@ - name: unique_active_user category: manage aggregation: weekly - expiry: 42 # Environments page - name: users_visiting_environments_pages category: environments diff --git a/spec/frontend/nav/components/top_nav_container_view_spec.js b/spec/frontend/nav/components/top_nav_container_view_spec.js index 0218f09af0a..293fe361fa9 100644 --- a/spec/frontend/nav/components/top_nav_container_view_spec.js +++ b/spec/frontend/nav/components/top_nav_container_view_spec.js @@ -103,6 +103,7 @@ describe('~/nav/components/top_nav_container_view.vue', () => { expect(findMenuSections().props()).toEqual({ sections, withTopBorder: true, + isPrimarySection: false, }); }); }); diff --git a/spec/frontend/nav/components/top_nav_dropdown_menu_spec.js b/spec/frontend/nav/components/top_nav_dropdown_menu_spec.js index 048fca846ad..8a0340087ec 100644 --- a/spec/frontend/nav/components/top_nav_dropdown_menu_spec.js +++ b/spec/frontend/nav/components/top_nav_dropdown_menu_spec.js @@ -56,6 +56,7 @@ describe('~/nav/components/top_nav_dropdown_menu.vue', () => { { id: 'secondary', menuItems: TEST_NAV_DATA.secondary }, ], withTopBorder: false, + isPrimarySection: true, }); }); diff --git a/spec/frontend/nav/components/top_nav_menu_sections_spec.js b/spec/frontend/nav/components/top_nav_menu_sections_spec.js index 0ed5cffd93f..7a5a8475ab7 100644 --- a/spec/frontend/nav/components/top_nav_menu_sections_spec.js +++ b/spec/frontend/nav/components/top_nav_menu_sections_spec.js @@ -80,7 +80,11 @@ describe('~/nav/components/top_nav_menu_sections.vue', () => { }), }, { - classes: [...TopNavMenuSections.BORDER_CLASSES.split(' '), 'gl-mt-3'], + classes: [ + ...TopNavMenuSections.BORDER_CLASSES.split(' '), + 'gl-border-gray-50', + 'gl-mt-3', + ], menuItems: TEST_SECTIONS[1].menuItems.map((menuItem, index) => { const classes = menuItem.type === 'header' ? [...headerClasses] : [...itemClasses]; if (index > 0) classes.push(menuItem.type === 'header' ? 'gl-pt-3!' : 'gl-mt-1'); @@ -117,8 +121,21 @@ describe('~/nav/components/top_nav_menu_sections.vue', () => { it('renders border classes for top section', () => { expect(findSectionModels().map((x) => x.classes)).toEqual([ - [...TopNavMenuSections.BORDER_CLASSES.split(' ')], - [...TopNavMenuSections.BORDER_CLASSES.split(' '), 'gl-mt-3'], + [...TopNavMenuSections.BORDER_CLASSES.split(' '), 'gl-border-gray-50'], + [...TopNavMenuSections.BORDER_CLASSES.split(' '), 'gl-border-gray-50', 'gl-mt-3'], + ]); + }); + }); + + describe('with isPrimarySection=true', () => { + beforeEach(() => { + createComponent({ isPrimarySection: true }); + }); + + it('renders border classes for top section', () => { + expect(findSectionModels().map((x) => x.classes)).toEqual([ + [], + [...TopNavMenuSections.BORDER_CLASSES.split(' '), 'gl-border-gray-100', 'gl-mt-3'], ]); }); }); diff --git a/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb index 1d980c48c72..f955fd265e5 100644 --- a/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb @@ -64,7 +64,6 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s "name" => "ce_event", "redis_slot" => "analytics", "category" => "analytics", - "expiry" => 84, "aggregation" => "weekly" } end @@ -106,13 +105,13 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s let(:known_events) do [ - { name: weekly_event, redis_slot: "analytics", category: analytics_category, expiry: 84, aggregation: "weekly", feature_flag: feature }, - { name: daily_event, redis_slot: "analytics", category: analytics_category, expiry: 84, aggregation: "daily" }, + { name: weekly_event, redis_slot: "analytics", category: analytics_category, aggregation: "weekly", feature_flag: feature }, + { name: daily_event, redis_slot: "analytics", category: analytics_category, aggregation: "daily" }, { name: category_productivity_event, redis_slot: "analytics", category: productivity_category, aggregation: "weekly" }, { name: compliance_slot_event, redis_slot: "compliance", category: compliance_category, aggregation: "weekly" }, { name: no_slot, category: global_category, aggregation: "daily" }, { name: different_aggregation, category: global_category, aggregation: "monthly" }, - { name: context_event, category: other_category, expiry: 6, aggregation: 'weekly' } + { name: context_event, category: other_category, aggregation: 'weekly' } ].map(&:with_indifferent_access) end @@ -196,7 +195,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s it 'tracks events with multiple values' do values = [entity1, entity2] - expect(Gitlab::Redis::HLL).to receive(:add).with(key: /g_{analytics}_contribution/, value: values, expiry: 84.days) + expect(Gitlab::Redis::HLL).to receive(:add).with(key: /g_{analytics}_contribution/, value: values, + expiry: described_class::DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH) described_class.track_event(:g_analytics_contribution, values: values) end @@ -233,20 +233,7 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s end context 'for weekly events' do - it 'sets the keys in Redis to expire automatically after the given expiry time' do - described_class.track_event("g_analytics_contribution", values: entity1) - - Gitlab::Redis::SharedState.with do |redis| - keys = redis.scan_each(match: "g_{analytics}_contribution-*").to_a - expect(keys).not_to be_empty - - keys.each do |key| - expect(redis.ttl(key)).to be_within(5.seconds).of(12.weeks) - end - end - end - - it 'sets the keys in Redis to expire automatically after 6 weeks by default' do + it 'sets the keys in Redis to expire' do described_class.track_event("g_compliance_dashboard", values: entity1) Gitlab::Redis::SharedState.with do |redis| @@ -254,27 +241,14 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s expect(keys).not_to be_empty keys.each do |key| - expect(redis.ttl(key)).to be_within(5.seconds).of(6.weeks) + expect(redis.ttl(key)).to be_within(5.seconds).of(described_class::DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH) end end end end context 'for daily events' do - it 'sets the keys in Redis to expire after the given expiry time' do - described_class.track_event("g_analytics_search", values: entity1) - - Gitlab::Redis::SharedState.with do |redis| - keys = redis.scan_each(match: "*-g_{analytics}_search").to_a - expect(keys).not_to be_empty - - keys.each do |key| - expect(redis.ttl(key)).to be_within(5.seconds).of(84.days) - end - end - end - - it 'sets the keys in Redis to expire after 29 days by default' do + it 'sets the keys in Redis to expire' do described_class.track_event("no_slot", values: entity1) Gitlab::Redis::SharedState.with do |redis| @@ -282,7 +256,7 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s expect(keys).not_to be_empty keys.each do |key| - expect(redis.ttl(key)).to be_within(5.seconds).of(29.days) + expect(redis.ttl(key)).to be_within(5.seconds).of(described_class::DEFAULT_DAILY_KEY_EXPIRY_LENGTH) end end end @@ -302,7 +276,9 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s it 'tracks events with multiple values' do values = [entity1, entity2] - expect(Gitlab::Redis::HLL).to receive(:add).with(key: /g_{analytics}_contribution/, value: values, expiry: 84.days) + expect(Gitlab::Redis::HLL).to receive(:add).with(key: /g_{analytics}_contribution/, + value: values, + expiry: described_class::DEFAULT_WEEKLY_KEY_EXPIRY_LENGTH) described_class.track_event_in_context(:g_analytics_contribution, values: values, context: default_context) end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index fd5d33a9b6f..466c5574146 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -320,7 +320,7 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev describe '#ensure_merge_request_diff' do let(:merge_request) { build(:merge_request) } - context 'when async_merge_request_diff_creation is true' do + context 'when skip_ensure_merge_request_diff is true' do before do merge_request.skip_ensure_merge_request_diff = true end @@ -332,7 +332,7 @@ RSpec.describe MergeRequest, factory_default: :keep, feature_category: :code_rev end end - context 'when async_merge_request_diff_creation is false' do + context 'when skip_ensure_merge_request_diff is false' do before do merge_request.skip_ensure_merge_request_diff = false end diff --git a/spec/services/merge_requests/create_service_spec.rb b/spec/services/merge_requests/create_service_spec.rb index da8e8d944d6..24b15d2b18f 100644 --- a/spec/services/merge_requests/create_service_spec.rb +++ b/spec/services/merge_requests/create_service_spec.rb @@ -501,40 +501,12 @@ RSpec.describe MergeRequests::CreateService, :clean_gitlab_redis_shared_state do project.add_developer(user) end - context 'when async_merge_request_diff_creation is enabled' do - before do - stub_feature_flags(async_merge_request_diff_creation: true) - end - - it 'creates the merge request', :sidekiq_inline do - expect_next_instance_of(MergeRequest) do |instance| - expect(instance).not_to receive(:eager_fetch_ref!) - end - - merge_request = described_class.new(project: project, current_user: user, params: opts).execute - - expect(merge_request).to be_persisted - expect(merge_request.iid).to be > 0 - expect(merge_request.merge_request_diff).not_to be_empty - end - end - - context 'when async_merge_request_diff_creation is disabled' do - before do - stub_feature_flags(async_merge_request_diff_creation: false) - end - - it 'creates the merge request' do - expect_next_instance_of(MergeRequest) do |instance| - expect(instance).to receive(:eager_fetch_ref!).and_call_original - end - - merge_request = described_class.new(project: project, current_user: user, params: opts).execute + it 'creates the merge request', :sidekiq_inline do + merge_request = described_class.new(project: project, current_user: user, params: opts).execute - expect(merge_request).to be_persisted - expect(merge_request.iid).to be > 0 - expect(merge_request.merge_request_diff).not_to be_empty - end + expect(merge_request).to be_persisted + expect(merge_request.iid).to be > 0 + expect(merge_request.merge_request_diff).not_to be_empty end it 'does not create the merge request when the target project is archived' do |