diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-18 09:10:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-18 09:10:06 +0300 |
commit | c277e21e169cfd6cd102e7e5ec9619d0553c0887 (patch) | |
tree | d65c29538e29d5f9061eb6cfcf4fee8bd2776da8 | |
parent | 417c94872d8c680d3d68c2d884d3d51aaddceb08 (diff) |
Add latest changes from gitlab-org/gitlab@master
22 files changed, 97 insertions, 188 deletions
diff --git a/.rubocop_todo/style/conditional_assignment.yml b/.rubocop_todo/style/conditional_assignment.yml deleted file mode 100644 index d16f2f7c3a7..00000000000 --- a/.rubocop_todo/style/conditional_assignment.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# Cop supports --autocorrect. -Style/ConditionalAssignment: - Exclude: - - 'app/helpers/icons_helper.rb' diff --git a/.rubocop_todo/style/each_for_simple_loop.yml b/.rubocop_todo/style/each_for_simple_loop.yml deleted file mode 100644 index e7f99d69528..00000000000 --- a/.rubocop_todo/style/each_for_simple_loop.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# Cop supports --autocorrect. -Style/EachForSimpleLoop: - Exclude: - - 'ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb' - - 'spec/services/members/invitation_reminder_email_service_spec.rb' diff --git a/.rubocop_todo/style/next.yml b/.rubocop_todo/style/next.yml deleted file mode 100644 index 6800ba2baf3..00000000000 --- a/.rubocop_todo/style/next.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# Cop supports --autocorrect. -Style/Next: - Exclude: - - 'lib/gitlab/fogbugz_import/importer.rb' diff --git a/.rubocop_todo/style/redundant_condition.yml b/.rubocop_todo/style/redundant_condition.yml deleted file mode 100644 index 535dfa9e462..00000000000 --- a/.rubocop_todo/style/redundant_condition.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -# Cop supports --autocorrect. -Style/RedundantCondition: - Exclude: - - 'spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb' diff --git a/.rubocop_todo/style/redundant_parentheses.yml b/.rubocop_todo/style/redundant_parentheses.yml deleted file mode 100644 index 3516277bbdc..00000000000 --- a/.rubocop_todo/style/redundant_parentheses.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# Cop supports --autocorrect. -Style/RedundantParentheses: - Exclude: - - 'spec/graphql/types/ci/job_kind_enum_spec.rb' - - 'spec/lib/gitlab/import_export/command_line_util_spec.rb' - - 'spec/requests/verifies_with_email_spec.rb' - - 'spec/services/projects/create_service_spec.rb' diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index b208d518ea5..ebebdfa56e6 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -125,51 +125,49 @@ module IconsHelper def file_type_icon_class(type, mode, name) if type == 'folder' - icon_class = 'folder-o' + 'folder-o' elsif type == 'archive' - icon_class = 'archive' + 'archive' elsif mode == '120000' - icon_class = 'share' + 'share' else # Guess which icon to choose based on file extension. # If you think a file extension is missing, feel free to add it on PR case File.extname(name).downcase when '.pdf' - icon_class = 'document' + 'document' when '.jpg', '.jpeg', '.jif', '.jfif', - '.jp2', '.jpx', '.j2k', '.j2c', - '.apng', '.png', '.gif', '.tif', '.tiff', - '.svg', '.ico', '.bmp', '.webp' - icon_class = 'doc-image' + '.jp2', '.jpx', '.j2k', '.j2c', + '.apng', '.png', '.gif', '.tif', '.tiff', + '.svg', '.ico', '.bmp', '.webp' + 'doc-image' when '.zip', '.zipx', '.tar', '.gz', '.gzip', '.tgz', '.bz', '.bzip', - '.bz2', '.bzip2', '.car', '.tbz', '.xz', 'txz', '.rar', '.7z', - '.lz', '.lzma', '.tlz' - icon_class = 'doc-compressed' + '.bz2', '.bzip2', '.car', '.tbz', '.xz', 'txz', '.rar', '.7z', + '.lz', '.lzma', '.tlz' + 'doc-compressed' when '.mp3', '.wma', '.ogg', '.oga', '.wav', '.flac', '.aac', '.3ga', - '.ac3', '.midi', '.m4a', '.ape', '.mpa' - icon_class = 'volume-up' + '.ac3', '.midi', '.m4a', '.ape', '.mpa' + 'volume-up' when '.mp4', '.m4p', '.m4v', - '.mpg', '.mp2', '.mpeg', '.mpe', '.mpv', - '.mpg', '.mpeg', '.m2v', '.m2ts', - '.avi', '.mkv', '.flv', '.ogv', '.mov', - '.3gp', '.3g2' - icon_class = 'live-preview' + '.mpg', '.mp2', '.mpeg', '.mpe', '.mpv', + '.mpg', '.mpeg', '.m2v', '.m2ts', + '.avi', '.mkv', '.flv', '.ogv', '.mov', + '.3gp', '.3g2' + 'live-preview' when '.doc', '.dot', '.docx', '.docm', '.dotx', '.dotm', '.docb', - '.odt', '.ott', '.uot', '.rtf' - icon_class = 'doc-text' + '.odt', '.ott', '.uot', '.rtf' + 'doc-text' when '.xls', '.xlt', '.xlm', '.xlsx', '.xlsm', '.xltx', '.xltm', - '.xlsb', '.xla', '.xlam', '.xll', '.xlw', '.ots', '.ods', '.uos' - icon_class = 'document' + '.xlsb', '.xla', '.xlam', '.xll', '.xlw', '.ots', '.ods', '.uos' + 'document' when '.ppt', '.pot', '.pps', '.pptx', '.pptm', '.potx', '.potm', - '.ppam', '.ppsx', '.ppsm', '.sldx', '.sldm', '.odp', '.otp', '.uop' - icon_class = 'doc-chart' + '.ppam', '.ppsx', '.ppsm', '.sldx', '.sldm', '.odp', '.otp', '.uop' + 'doc-chart' else - icon_class = 'doc-text' + 'doc-text' end end - - icon_class end private diff --git a/app/helpers/integrations_helper.rb b/app/helpers/integrations_helper.rb index 5dc8ba54ca8..a88be976337 100644 --- a/app/helpers/integrations_helper.rb +++ b/app/helpers/integrations_helper.rb @@ -277,11 +277,11 @@ module IntegrationsHelper s_("ProjectService|Trigger event for new comments.") when "confidential_note", "confidential_note_events" s_("ProjectService|Trigger event for new comments on confidential issues.") - when "issue", "issue_events" + when "issue", "issue_events", "issues_events" s_("ProjectService|Trigger event when an issue is created, updated, or closed.") - when "confidential_issue", "confidential_issue_events" + when "confidential_issue", "confidential_issue_events", "confidential_issues_events" s_("ProjectService|Trigger event when a confidential issue is created, updated, or closed.") - when "merge_request", "merge_request_events" + when "merge_request", "merge_request_events", "merge_requests_events" s_("ProjectService|Trigger event when a merge request is created, updated, or merged.") when "pipeline", "pipeline_events" s_("ProjectService|Trigger event when a pipeline status changes.") @@ -289,16 +289,20 @@ module IntegrationsHelper s_("ProjectService|Trigger event when a wiki page is created or updated.") when "commit", "commit_events" s_("ProjectService|Trigger event when a commit is created or updated.") - when "deployment" + when "deployment", "deployment_events" s_("ProjectService|Trigger event when a deployment starts or finishes.") - when "alert" + when "alert", "alert_events" s_("ProjectService|Trigger event when a new, unique alert is recorded.") - when "incident" + when "incident", "incident_events" s_("ProjectService|Trigger event when an incident is created.") when "group_mention" s_("ProjectService|Trigger event when a group is mentioned in a public context.") when "group_confidential_mention" s_("ProjectService|Trigger event when a group is mentioned in a confidential context.") + when "build_events" + s_("ProjectService|Trigger event when a build is created.") + when "archive_trace_events" + s_('When enabled, job logs are collected by Datadog and displayed along with pipeline execution traces.') end end # rubocop:enable Metrics/CyclomaticComplexity diff --git a/app/models/integrations/base_slack_notification.rb b/app/models/integrations/base_slack_notification.rb index 38f3498c81b..65aec8b278f 100644 --- a/app/models/integrations/base_slack_notification.rb +++ b/app/models/integrations/base_slack_notification.rb @@ -25,12 +25,15 @@ module Integrations override :supported_events def supported_events - additional = %w[alert] - additional += %w[group_mention group_confidential_mention] if group_level? + additional = group_level? ? %w[group_mention group_confidential_mention] : [] (super + additional).freeze end + def self.supported_events + super + %w[alert] + end + override :configurable_channels? def configurable_channels? true diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 066b2ef98dd..4a7aa9a86ab 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -13,7 +13,7 @@ .merge-request-title.title %span.merge-request-title-text.js-onboarding-mr-item = hidden_merge_request_icon(merge_request) - = link_to markdown_field(merge_request, :title), merge_request_path(merge_request), class: 'js-prefetch-document' + = link_to merge_request.title, merge_request_path(merge_request), class: 'js-prefetch-document' - if merge_request.tasks? %span.task-status.d-none.d-sm-inline-block.gl-font-sm diff --git a/db/post_migrate/20230907204731_add_index_to_sbom_occurrences_licenses.rb b/db/post_migrate/20230907204731_add_index_to_sbom_occurrences_licenses.rb new file mode 100644 index 00000000000..9ed60941c96 --- /dev/null +++ b/db/post_migrate/20230907204731_add_index_to_sbom_occurrences_licenses.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class AddIndexToSbomOccurrencesLicenses < Gitlab::Database::Migration[2.1] + INDEX_NAME = "index_sbom_occurrences_on_licenses_spdx_identifier" + + disable_ddl_transaction! + + def up + return if index_exists_by_name?(:sbom_occurrences, INDEX_NAME) + + disable_statement_timeout do + execute <<~SQL + CREATE INDEX CONCURRENTLY #{INDEX_NAME} + ON sbom_occurrences + USING BTREE (project_id, (licenses#>'{0,spdx_identifier}'), (licenses#>'{1,spdx_identifier}')) + SQL + end + end + + def down + remove_concurrent_index_by_name :sbom_occurrences, INDEX_NAME + end +end diff --git a/db/schema_migrations/20230907204731 b/db/schema_migrations/20230907204731 new file mode 100644 index 00000000000..9b10980eae0 --- /dev/null +++ b/db/schema_migrations/20230907204731 @@ -0,0 +1 @@ +e5448d02414f99074a52337c271310277a1d76b386a9e2e1bd3c1b806a70c462
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 0b9d8d914d7..622c5988d2a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -33653,6 +33653,8 @@ CREATE INDEX index_sbom_occurrences_on_component_id_and_id ON sbom_occurrences U CREATE INDEX index_sbom_occurrences_on_component_version_id ON sbom_occurrences USING btree (component_version_id); +CREATE INDEX index_sbom_occurrences_on_licenses_spdx_identifier ON sbom_occurrences USING btree (project_id, ((licenses #> '{0,spdx_identifier}'::text[])), ((licenses #> '{1,spdx_identifier}'::text[]))); + CREATE INDEX index_sbom_occurrences_on_pipeline_id ON sbom_occurrences USING btree (pipeline_id); CREATE INDEX index_sbom_occurrences_on_project_id ON sbom_occurrences USING btree (project_id); diff --git a/lib/api/helpers/integrations_helpers.rb b/lib/api/helpers/integrations_helpers.rb index c1290c1e293..8f846fe7348 100644 --- a/lib/api/helpers/integrations_helpers.rb +++ b/lib/api/helpers/integrations_helpers.rb @@ -124,95 +124,6 @@ module API ].freeze end - def self.chat_notification_events - [ - { - required: false, - name: :commit_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for commit_events' - }, - { - required: false, - name: :push_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for push_events' - }, - { - required: false, - name: :issues_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for issues_events' - }, - { - required: false, - name: :incident_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for incident_events' - }, - { - required: false, - name: :alert_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for alert_events' - }, - { - required: false, - name: :confidential_issues_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for confidential_issues_events' - }, - { - required: false, - name: :merge_requests_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for merge_requests_events' - }, - { - required: false, - name: :note_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for note_events' - }, - { - required: false, - name: :confidential_note_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for confidential_note_events' - }, - { - required: false, - name: :tag_push_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for tag_push_events' - }, - { - required: false, - name: :deployment_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for deployment_events' - }, - { - required: false, - name: :job_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for job_events' - }, - { - required: false, - name: :pipeline_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for pipeline_events' - }, - { - required: false, - name: :wiki_page_events, - type: ::Grape::API::Boolean, - desc: 'Enable notifications for wiki_page_events' - } - ].freeze - end - def self.integrations { 'apple-app-store' => [ @@ -453,7 +364,6 @@ module API desc: 'Branches for which notifications are to be sent' }, chat_notification_flags, - chat_notification_events, chat_notification_channels ].flatten, 'drone-ci' => [ @@ -548,8 +458,7 @@ module API name: :branches_to_be_notified, type: String, desc: 'Branches for which notifications are to be sent' - }, - chat_notification_events + } ].flatten, 'harbor' => [ { @@ -813,8 +722,7 @@ module API name: :webhook, type: String, desc: 'The Pumble chat webhook. For example, https://api.pumble.com/workspaces/x/...' - }, - chat_notification_events + } ].flatten, 'pushover' => [ { @@ -919,8 +827,7 @@ module API 'slack' => [ chat_notification_settings, chat_notification_flags, - chat_notification_channels, - chat_notification_events + chat_notification_channels ].flatten, 'microsoft-teams' => [ { @@ -940,8 +847,7 @@ module API 'mattermost' => [ chat_notification_settings, chat_notification_flags, - chat_notification_channels, - chat_notification_events + chat_notification_channels ].flatten, 'teamcity' => [ { @@ -988,8 +894,7 @@ module API type: String, desc: 'Unique identifier for the target chat or username of the target channel (in the format @channelusername)' }, - chat_notification_flags, - chat_notification_events + chat_notification_flags ].flatten, 'unify-circuit' => [ { @@ -997,8 +902,7 @@ module API name: :webhook, type: String, desc: 'The Unify Circuit webhook. e.g. https://circuit.com/rest/v2/webhooks/incoming/…' - }, - chat_notification_events + } ].flatten, 'webex-teams' => [ { @@ -1006,8 +910,7 @@ module API name: :webhook, type: String, desc: 'The Webex Teams webhook. For example, https://api.ciscospark.com/v1/webhooks/incoming/...' - }, - chat_notification_events + } ].flatten, 'zentao' => [ { @@ -1083,12 +986,17 @@ module API ::Integrations::PipelinesEmail, ::Integrations::Pivotaltracker, ::Integrations::Prometheus, + ::Integrations::Pumble, ::Integrations::Pushover, ::Integrations::Redmine, + ::Integrations::Shimo, ::Integrations::Slack, ::Integrations::SlackSlashCommands, ::Integrations::SquashTm, ::Integrations::Teamcity, + ::Integrations::Telegram, + ::Integrations::UnifyCircuit, + ::Integrations::WebexTeams, ::Integrations::Youtrack, ::Integrations::Zentao ] diff --git a/lib/api/integrations.rb b/lib/api/integrations.rb index 3ec0a723808..a73e34f54a3 100644 --- a/lib/api/integrations.rb +++ b/lib/api/integrations.rb @@ -31,7 +31,7 @@ module API INTEGRATIONS[integration.to_param.tr("_", "-")] << { required: false, name: event_name.to_sym, - type: String, + type: ::Grape::API::Boolean, desc: IntegrationsHelper.integration_event_description(integration, event_name) } end diff --git a/lib/gitlab/fogbugz_import/importer.rb b/lib/gitlab/fogbugz_import/importer.rb index ca1a2b2a077..b3f4f4fb933 100644 --- a/lib/gitlab/fogbugz_import/importer.rb +++ b/lib/gitlab/fogbugz_import/importer.rb @@ -115,13 +115,13 @@ module Gitlab labels = [] [bug['sCategory'], bug['sPriority']].each do |label| - unless label.blank? - labels << label + next if label.blank? - unless @known_labels.include?(label) - create_label(label) - @known_labels << label - end + labels << label + + unless @known_labels.include?(label) + create_label(label) + @known_labels << label end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 840af45c1fb..a4c9567a2c4 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -36791,6 +36791,9 @@ msgstr "" msgid "ProjectService|Trigger event for pushes to the repository." msgstr "" +msgid "ProjectService|Trigger event when a build is created." +msgstr "" + msgid "ProjectService|Trigger event when a commit is created or updated." msgstr "" diff --git a/spec/graphql/types/ci/job_kind_enum_spec.rb b/spec/graphql/types/ci/job_kind_enum_spec.rb index b48d20b71e2..a09cd89ec8b 100644 --- a/spec/graphql/types/ci/job_kind_enum_spec.rb +++ b/spec/graphql/types/ci/job_kind_enum_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe GitlabSchema.types['CiJobKind'] do it 'exposes some job type values' do expect(described_class.values.keys).to match_array( - (%w[BRIDGE BUILD]) + %w[BRIDGE BUILD] ) end end diff --git a/spec/lib/gitlab/import_export/command_line_util_spec.rb b/spec/lib/gitlab/import_export/command_line_util_spec.rb index 8ed3a60d7fc..76a35d07c7f 100644 --- a/spec/lib/gitlab/import_export/command_line_util_spec.rb +++ b/spec/lib/gitlab/import_export/command_line_util_spec.rb @@ -203,7 +203,7 @@ RSpec.describe Gitlab::ImportExport::CommandLineUtil, feature_category: :importe it 'throws a blocked url error' do Tempfile.create('test') do |file| - expect { subject.download(url, file.path) }.to raise_error((Gitlab::HTTP::BlockedUrlError)) + expect { subject.download(url, file.path) }.to raise_error(Gitlab::HTTP::BlockedUrlError) end end diff --git a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb index 0cbf9eab3d8..a27e723e392 100644 --- a/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb +++ b/spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb @@ -402,11 +402,7 @@ RSpec.describe Gitlab::SidekiqMiddleware::ServerMetrics do include Sidekiq::Worker include WorkerAttributes - if category - feature_category category - else - feature_category :not_owned - end + feature_category category || :not_owned def perform; end end diff --git a/spec/requests/verifies_with_email_spec.rb b/spec/requests/verifies_with_email_spec.rb index cc85ebc7ade..c8a0c0975a3 100644 --- a/spec/requests/verifies_with_email_spec.rb +++ b/spec/requests/verifies_with_email_spec.rb @@ -171,8 +171,8 @@ RSpec.describe 'VerifiesWithEmail', :clean_gitlab_redis_sessions, :clean_gitlab_ it 'adds a verification error message' do expect(json_response) - .to include('message' => (s_('IdentityVerification|The code is incorrect. '\ - 'Enter it again, or send a new code.'))) + .to include('message' => s_('IdentityVerification|The code is incorrect. '\ + 'Enter it again, or send a new code.')) end end @@ -184,7 +184,7 @@ RSpec.describe 'VerifiesWithEmail', :clean_gitlab_redis_sessions, :clean_gitlab_ it 'adds a verification error message' do expect(json_response) - .to include('message' => (s_('IdentityVerification|The code has expired. Send a new code and try again.'))) + .to include('message' => s_('IdentityVerification|The code has expired. Send a new code and try again.')) end end diff --git a/spec/services/members/invitation_reminder_email_service_spec.rb b/spec/services/members/invitation_reminder_email_service_spec.rb index 2b72a4919b4..a3c2e994c2e 100644 --- a/spec/services/members/invitation_reminder_email_service_spec.rb +++ b/spec/services/members/invitation_reminder_email_service_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Members::InvitationReminderEmailService, feature_category: :group with_them do # Create an invitation today with an expiration date from 0 to 10 days in the future or without an expiration date # We chose 10 days here, because we fetch invitations that were created at most 10 days ago. - (0..10).each do |day| + 11.times do |day| it 'sends an invitation reminder only on the expected days' do next if day > (expires_at_days || 10) # We don't need to test after the invitation has already expired diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index f0e9ea20030..24b81d78758 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -156,7 +156,7 @@ RSpec.describe Projects::CreateService, '#execute', feature_category: :groups_an project = create_project(bot_user, opts) expect(project.errors.errors.length).to eq 1 - expect(project.errors.messages[:namespace].first).to eq(("is not valid")) + expect(project.errors.messages[:namespace].first).to eq("is not valid") end end end |