From 6e92fea02d2f57643cee95b404595f6be64fa8df Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sat, 4 Nov 2023 03:11:50 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo/style/inline_disable_annotation.yml | 22 ++++++++++-------- app/assets/javascripts/entrypoints/analytics.js | 6 +++++ .../repository/components/commit_info.vue | 6 +++++ .../super_sidebar/components/user_bar.vue | 1 + app/assets/javascripts/tracking/constants.js | 3 +++ .../source_viewer/components/blame_info.vue | 1 + .../source_viewer/queries/blame_data.query.graphql | 3 +++ locale/gitlab.pot | 15 ++++++++++++ qa/qa/page/main/login.rb | 7 +++++- qa/qa/page/main/menu.rb | 8 +++++-- qa/qa/runtime/canary.rb | 27 ++++++++++++++++++++++ .../repository/components/commit_info_spec.js | 20 ++++++++++++++-- .../tracking/tracking_initialization_spec.js | 2 ++ .../source_viewer/components/blame_info_spec.js | 3 ++- .../components/source_viewer/mock_data.js | 11 ++++++++- 15 files changed, 118 insertions(+), 17 deletions(-) create mode 100644 qa/qa/runtime/canary.rb diff --git a/.rubocop_todo/style/inline_disable_annotation.yml b/.rubocop_todo/style/inline_disable_annotation.yml index c235c35c043..d2774f1b8e5 100644 --- a/.rubocop_todo/style/inline_disable_annotation.yml +++ b/.rubocop_todo/style/inline_disable_annotation.yml @@ -526,6 +526,7 @@ Style/InlineDisableAnnotation: - 'app/policies/concerns/member_policy_helpers.rb' - 'app/policies/email_policy.rb' - 'app/policies/event_policy.rb' + - 'app/policies/group_group_link_policy.rb' - 'app/policies/issue_policy.rb' - 'app/policies/list_policy.rb' - 'app/policies/namespace_ci_cd_setting_policy.rb' @@ -666,7 +667,6 @@ Style/InlineDisableAnnotation: - 'app/services/lfs/locks_finder_service.rb' - 'app/services/lfs/unlock_file_service.rb' - 'app/services/loose_foreign_keys/cleaner_service.rb' - - 'app/services/members/create_service.rb' - 'app/services/members/invite_member_builder.rb' - 'app/services/members/projects/creator_service.rb' - 'app/services/members/standard_member_builder.rb' @@ -802,7 +802,6 @@ Style/InlineDisableAnnotation: - 'app/workers/build_hooks_worker.rb' - 'app/workers/build_queue_worker.rb' - 'app/workers/build_success_worker.rb' - - 'app/workers/bulk_import_worker.rb' - 'app/workers/bulk_imports/finish_batched_pipeline_worker.rb' - 'app/workers/bulk_imports/pipeline_batch_worker.rb' - 'app/workers/bulk_imports/pipeline_worker.rb' @@ -1204,7 +1203,9 @@ Style/InlineDisableAnnotation: - 'db/migrate/20230915103259_create_ci_finished_build_ch_sync_events.rb' - 'db/migrate/20230917144717_add_package_name_pattern_query_to_packages_protection_rule.rb' - 'db/migrate/20230921081527_add_queued_migration_version_to_batched_background_migrations.rb' + - 'db/migrate/20231017135207_add_fields_to_ml_model.rb' - 'db/migrate/20231019180421_add_name_description_to_catalog_resources.rb' + - 'db/migrate/20231024142236_add_fields_to_bulk_import_failures.rb' - 'db/post_migrate/20220328100456_schedule20220328_reset_duplicate_ci_runners_token_encrypted_values_on_projects.rb' - 'db/post_migrate/20220328100457_schedule20220328_reset_duplicate_ci_runners_token_values_on_projects.rb' - 'db/post_migrate/20220504083836_cleanup_after_fixing_regression_with_new_users_emails.rb' @@ -1274,6 +1275,8 @@ Style/InlineDisableAnnotation: - 'db/post_migrate/20231019003052_swap_columns_for_ci_pipelines_pipeline_id_bigint_v2.rb' - 'db/post_migrate/20231019084731_swap_columns_for_ci_stages_pipeline_id_bigint_v2.rb' - 'db/post_migrate/20231024025629_cleanup_ci_pipeline_chat_data_pipeline_id_bigint.rb' + - 'db/post_migrate/20231024080150_cleanup_ci_sources_pipelines_pipeline_id_bigint.rb' + - 'db/post_migrate/20231025031337_cleanup_ci_pipeline_messages_pipeline_id_bigint.rb' - 'ee/app/controllers/admin/application_settings/scim_oauth_controller.rb' - 'ee/app/controllers/admin/emails_controller.rb' - 'ee/app/controllers/admin/namespace_limits_controller.rb' @@ -1443,6 +1446,7 @@ Style/InlineDisableAnnotation: - 'ee/app/graphql/types/scanned_resource_type.rb' - 'ee/app/graphql/types/security/training_type.rb' - 'ee/app/graphql/types/security_orchestration/approval_group_type.rb' + - 'ee/app/graphql/types/security_orchestration/approval_scan_result_policy_type.rb' - 'ee/app/graphql/types/security_orchestration/group_security_policy_source_type.rb' - 'ee/app/graphql/types/security_orchestration/project_security_policy_source_type.rb' - 'ee/app/graphql/types/security_orchestration/scan_execution_policy_type.rb' @@ -1662,8 +1666,6 @@ Style/InlineDisableAnnotation: - 'ee/app/services/security/security_orchestration_policies/fetch_policy_approvers_service.rb' - 'ee/app/services/security/security_orchestration_policies/policy_branches_service.rb' - 'ee/app/services/security/security_orchestration_policies/process_scan_result_policy_service.rb' - - 'ee/app/services/security/security_orchestration_policies/protected_branches_deletion_check_service.rb' - - 'ee/app/services/security/security_orchestration_policies/protected_branches_force_push_service.rb' - 'ee/app/services/security/security_orchestration_policies/rule_schedule_service.rb' - 'ee/app/services/security/security_orchestration_policies/update_violations_service.rb' - 'ee/app/services/security/security_orchestration_policies/validate_policy_service.rb' @@ -2005,6 +2007,7 @@ Style/InlineDisableAnnotation: - 'ee/lib/gitlab/geo/log_cursor/event_logs.rb' - 'ee/lib/gitlab/geo/replication/blob_downloader.rb' - 'ee/lib/gitlab/geo/replicator.rb' + - 'ee/lib/gitlab/git_audit_event.rb' - 'ee/lib/gitlab/graphql/loaders/oncall_participant_loader.rb' - 'ee/lib/gitlab/group_plans_preloader.rb' - 'ee/lib/gitlab/insights/executors/dora_executor.rb' @@ -2203,6 +2206,7 @@ Style/InlineDisableAnnotation: - 'ee/spec/services/security/security_orchestration_policies/policy_branches_service_spec.rb' - 'ee/spec/services/security/token_revocation_service_spec.rb' - 'ee/spec/spec_helper.rb' + - 'ee/spec/support/helpers/duo_chat_fixture_helpers.rb' - 'ee/spec/support/matchers/locked_schema.rb' - 'ee/spec/support/shared_contexts/graphql/geo/registries_shared_context.rb' - 'ee/spec/support/shared_contexts/remote_development/remote_development_shared_contexts.rb' @@ -2315,7 +2319,6 @@ Style/InlineDisableAnnotation: - 'lib/api/sidekiq_metrics.rb' - 'lib/api/snippet_repository_storage_moves.rb' - 'lib/api/users.rb' - - 'lib/api/v3/github.rb' - 'lib/atlassian/jira_connect/serializers/build_entity.rb' - 'lib/backup/manager.rb' - 'lib/banzai/filter/issuable_reference_expansion_filter.rb' @@ -2549,6 +2552,7 @@ Style/InlineDisableAnnotation: - 'lib/gitlab/database/query_analyzers/prevent_set_operator_mismatch/node.rb' - 'lib/gitlab/database/reindexing/reindex_action.rb' - 'lib/gitlab/database/schema_cache_with_renamed_table.rb' + - 'lib/gitlab/database/schema_cache_with_renamed_table_legacy.rb' - 'lib/gitlab/database/with_lock_retries.rb' - 'lib/gitlab/database_importers/work_items/base_type_importer.rb' - 'lib/gitlab/database_importers/work_items/related_links_restrictions_importer.rb' @@ -2591,12 +2595,8 @@ Style/InlineDisableAnnotation: - 'lib/gitlab/git/diff.rb' - 'lib/gitlab/git/patches/collection.rb' - 'lib/gitlab/git/repository.rb' - - 'lib/gitlab/git/rugged_impl/commit.rb' - - 'lib/gitlab/git/rugged_impl/repository.rb' - - 'lib/gitlab/git/rugged_impl/use_rugged.rb' - 'lib/gitlab/git/tag.rb' - 'lib/gitlab/git/tree.rb' - - 'lib/gitlab/git_audit_event.rb' - 'lib/gitlab/gitaly_client.rb' - 'lib/gitlab/gitaly_client/operation_service.rb' - 'lib/gitlab/gitaly_client/ref_service.rb' @@ -2814,7 +2814,6 @@ Style/InlineDisableAnnotation: - 'qa/chemlab-library-gitlab.gemspec' - 'qa/qa/ee/page/admin/subscription.rb' - 'qa/qa/ee/page/component/secure_report.rb' - - 'qa/qa/ee/page/file/show.rb' - 'qa/qa/ee/page/main/banner.rb' - 'qa/qa/ee/page/project/monitor/on_call_schedule/index.rb' - 'qa/qa/ee/page/project/settings/merge_request.rb' @@ -2939,6 +2938,7 @@ Style/InlineDisableAnnotation: - 'spec/factories/events.rb' - 'spec/factories/go_module_commits.rb' - 'spec/factories/ml/experiments.rb' + - 'spec/factories/ml/models.rb' - 'spec/factories/packages/packages.rb' - 'spec/factories/packages/rpm/rpm_repository_files.rb' - 'spec/factories/projects.rb' @@ -3113,6 +3113,7 @@ Style/InlineDisableAnnotation: - 'spec/lib/gitlab/quick_actions/dsl_spec.rb' - 'spec/lib/gitlab/redis/cross_slot_spec.rb' - 'spec/lib/gitlab/redis/multi_store_spec.rb' + - 'spec/lib/gitlab/search/abuse_detection_spec.rb' - 'spec/lib/gitlab/shard_health_cache_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/server_metrics_spec.rb' - 'spec/lib/gitlab/sidekiq_middleware/size_limiter/server_spec.rb' @@ -3150,6 +3151,7 @@ Style/InlineDisableAnnotation: - 'spec/migrations/20230817143637_swap_award_emoji_note_id_to_bigint_for_self_hosts_spec.rb' - 'spec/migrations/20230906204934_restart_self_hosted_sent_notifications_bigint_conversion_spec.rb' - 'spec/migrations/20230906204935_restart_self_hosted_sent_notifications_backfill_spec.rb' + - 'spec/migrations/20231016001000_fix_design_user_mentions_design_id_note_id_index_for_self_managed_spec.rb' - 'spec/migrations/add_namespaces_emails_enabled_column_data_spec.rb' - 'spec/migrations/add_projects_emails_enabled_column_data_spec.rb' - 'spec/migrations/cleanup_bigint_conversion_for_merge_request_metrics_for_self_hosts_spec.rb' diff --git a/app/assets/javascripts/entrypoints/analytics.js b/app/assets/javascripts/entrypoints/analytics.js index 8eb265cb1e8..e18c4bc8742 100644 --- a/app/assets/javascripts/entrypoints/analytics.js +++ b/app/assets/javascripts/entrypoints/analytics.js @@ -14,4 +14,10 @@ if (appId && host) { errorTracking: false, }, }); + + const userId = window.gl?.snowplowStandardContext?.data?.user_id; + + if (userId) { + window.glClient?.identify(userId); + } } diff --git a/app/assets/javascripts/repository/components/commit_info.vue b/app/assets/javascripts/repository/components/commit_info.vue index 5c1737eb310..b6674114a20 100644 --- a/app/assets/javascripts/repository/components/commit_info.vue +++ b/app/assets/javascripts/repository/components/commit_info.vue @@ -26,6 +26,11 @@ export default { type: Object, required: true, }, + prevBlameLink: { + type: String, + required: false, + default: null, + }, }, data() { return { showDescription: false }; @@ -114,5 +119,6 @@ export default {
+
diff --git a/app/assets/javascripts/super_sidebar/components/user_bar.vue b/app/assets/javascripts/super_sidebar/components/user_bar.vue index 88ea4d828b7..3c47245a1a6 100644 --- a/app/assets/javascripts/super_sidebar/components/user_bar.vue +++ b/app/assets/javascripts/super_sidebar/components/user_bar.vue @@ -115,6 +115,7 @@ export default { diff --git a/app/assets/javascripts/tracking/constants.js b/app/assets/javascripts/tracking/constants.js index 46278152879..bc416b20e80 100644 --- a/app/assets/javascripts/tracking/constants.js +++ b/app/assets/javascripts/tracking/constants.js @@ -1,5 +1,7 @@ export const SNOWPLOW_JS_SOURCE = 'gitlab-javascript'; +export const MAX_LOCAL_STORAGE_QUEUE_SIZE = 100; + export const DEFAULT_SNOWPLOW_OPTIONS = { namespace: 'gl', hostname: window.location.hostname, @@ -15,6 +17,7 @@ export const DEFAULT_SNOWPLOW_OPTIONS = { forms: { allow: [] }, fields: { allow: [] }, }, + maxLocalStorageQueueSize: MAX_LOCAL_STORAGE_QUEUE_SIZE, }; export const ACTION_ATTR_SELECTOR = '[data-track-action]'; diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/components/blame_info.vue b/app/assets/javascripts/vue_shared/components/source_viewer/components/blame_info.vue index aad54184374..e2fd4477f0a 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer/components/blame_info.vue +++ b/app/assets/javascripts/vue_shared/components/source_viewer/components/blame_info.vue @@ -30,6 +30,7 @@ export default { class="gl-display-flex gl-absolute gl-px-3" :style="{ top: blame.blameOffset }" :commit="blame.commit" + :prev-blame-link="blame.commitData && blame.commitData.projectBlameLink" /> diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/queries/blame_data.query.graphql b/app/assets/javascripts/vue_shared/components/source_viewer/queries/blame_data.query.graphql index 22a8f8911d0..a5f3f348cfc 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer/queries/blame_data.query.graphql +++ b/app/assets/javascripts/vue_shared/components/source_viewer/queries/blame_data.query.graphql @@ -24,6 +24,9 @@ query getBlameData($fullPath: ID!, $filePath: String!, $fromLine: Int, $toLine: } sha } + commitData { + projectBlameLink + } } } } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6edb19a1df3..5b32b637b96 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -42809,6 +42809,9 @@ msgstr "" msgid "SecurityOrchestration|Any merge request" msgstr "" +msgid "SecurityOrchestration|Apply this policy to all projects %{projectScopeType} named %{exceptionType} %{projectSelector}" +msgstr "" + msgid "SecurityOrchestration|Are you sure you want to delete this policy? This action cannot be undone." msgstr "" @@ -43009,6 +43012,9 @@ msgstr "" msgid "SecurityOrchestration|Policy editor" msgstr "" +msgid "SecurityOrchestration|Policy scope" +msgstr "" + msgid "SecurityOrchestration|Policy status" msgstr "" @@ -43231,6 +43237,9 @@ msgstr "" msgid "SecurityOrchestration|all namespaces" msgstr "" +msgid "SecurityOrchestration|all projects in this group" +msgstr "" + msgid "SecurityOrchestration|any" msgstr "" @@ -43279,12 +43288,18 @@ msgstr "" msgid "SecurityOrchestration|or from:" msgstr "" +msgid "SecurityOrchestration|projects with compliance frameworks" +msgstr "" + msgid "SecurityOrchestration|scanner finds" msgstr "" msgid "SecurityOrchestration|scanners find" msgstr "" +msgid "SecurityOrchestration|specific projects" +msgstr "" + msgid "SecurityOrchestration|targeting %{branchTypeText}" msgstr "" diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 1fd0b5b453c..e528c29bb87 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -5,6 +5,7 @@ module QA module Main class Login < Page::Base include Layout::Flash + include Runtime::Canary view 'app/views/devise/passwords/edit.html.haml' do element :password_field @@ -250,7 +251,11 @@ module QA wait_for_gitlab_to_respond - Page::Main::Menu.validate_elements_present! unless skip_page_validation + return if skip_page_validation + + Page::Main::Menu.validate_elements_present! + + # validate_canary! end def fill_in_credential(user) diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 73d48c6fcbf..0a023c757ee 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -14,6 +14,10 @@ module QA element :navbar, required: true # TODO: rename to sidebar once it's default implementation end + view 'app/assets/javascripts/super_sidebar/components/user_bar.vue' do + element 'canary-badge-link' + end + view 'app/assets/javascripts/super_sidebar/components/user_menu.vue' do element 'user-dropdown', required: !Runtime::Env.phone_layout? element :user_avatar_content, required: !Runtime::Env.phone_layout? @@ -176,13 +180,13 @@ module QA end # To verify whether the user has been directed to a canary web node - # @return [Boolean] result of checking existence of :canary_badge_link element + # @return [Boolean] result of checking existence of 'canary-badge-link' element # @example: # Menu.perform do |menu| # expect(menu.canary?).to be(true) # end def canary? - has_element?(:canary_badge_link) + has_element?('canary-badge-link') end private diff --git a/qa/qa/runtime/canary.rb b/qa/qa/runtime/canary.rb new file mode 100644 index 00000000000..9a6b8c0dc8d --- /dev/null +++ b/qa/qa/runtime/canary.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module QA + module Runtime + module Canary + CanaryValidationError = Class.new(StandardError) + + def validate_canary! + return unless QA::Runtime::Env.qa_cookies.to_s.include?("gitlab_canary=true") + + canary_cookie = Capybara.current_session.driver.browser.manage.all_cookies.find do |cookie| + cookie[:name] == 'gitlab_canary' + end + + unless canary_cookie && canary_cookie[:value] == 'true' + raise Canary::CanaryValidationError, + "gitlab_canary=true cookie was expected but not set in browser. QA_COOKIES: #{QA::Runtime::Env.qa_cookies}" + end + + return if Page::Main::Menu.perform(&:canary?) + + raise Canary::CanaryValidationError, + "gitlab_canary=true cookie was set in browser but 'Next' badge was not shown on UI" + end + end + end +end diff --git a/spec/frontend/repository/components/commit_info_spec.js b/spec/frontend/repository/components/commit_info_spec.js index 468aaf3dc1c..4e570346d97 100644 --- a/spec/frontend/repository/components/commit_info_spec.js +++ b/spec/frontend/repository/components/commit_info_spec.js @@ -21,9 +21,9 @@ const findAuthorName = () => wrapper.findByText(`${commit.authorName} authored`) const findCommitRowDescription = () => wrapper.find('pre'); const findTitleHtml = () => wrapper.findByText(commit.titleHtml); -const createComponent = async ({ commitMock = {} } = {}) => { +const createComponent = async ({ commitMock = {}, prevBlameLink } = {}) => { wrapper = shallowMountExtended(CommitInfo, { - propsData: { commit: { ...commit, ...commitMock } }, + propsData: { commit: { ...commit, ...commitMock }, prevBlameLink }, }); await nextTick(); @@ -80,6 +80,22 @@ describe('Repository last commit component', () => { }); }); + describe('previous blame link', () => { + const prevBlameLink = 'Previous blame link'; + + it('renders a previous blame link when it is present', () => { + createComponent({ prevBlameLink }); + + expect(wrapper.html()).toContain(prevBlameLink); + }); + + it('does not render a previous blame link when it is not present', () => { + createComponent({ prevBlameLink: null }); + + expect(wrapper.html()).not.toContain(prevBlameLink); + }); + }); + it('sets correct CSS class if the commit message is empty', () => { createComponent({ commitMock: { message: '' } }); diff --git a/spec/frontend/tracking/tracking_initialization_spec.js b/spec/frontend/tracking/tracking_initialization_spec.js index 2dc3c6ab41c..adaac7441f0 100644 --- a/spec/frontend/tracking/tracking_initialization_spec.js +++ b/spec/frontend/tracking/tracking_initialization_spec.js @@ -1,6 +1,7 @@ import { TRACKING_CONTEXT_SCHEMA } from '~/experimentation/constants'; import { getExperimentData, getAllExperimentContexts } from '~/experimentation/utils'; import Tracking, { initUserTracking, initDefaultTrackers, InternalEvents } from '~/tracking'; +import { MAX_LOCAL_STORAGE_QUEUE_SIZE } from '~/tracking/constants'; import getStandardContext from '~/tracking/get_standard_context'; jest.mock('~/experimentation/utils', () => ({ @@ -65,6 +66,7 @@ describe('Tracking', () => { fields: { allow: [] }, forms: { allow: [] }, }, + maxLocalStorageQueueSize: MAX_LOCAL_STORAGE_QUEUE_SIZE, }); }); }); diff --git a/spec/frontend/vue_shared/components/source_viewer/components/blame_info_spec.js b/spec/frontend/vue_shared/components/source_viewer/components/blame_info_spec.js index 884ea621ec7..121bc691041 100644 --- a/spec/frontend/vue_shared/components/source_viewer/components/blame_info_spec.js +++ b/spec/frontend/vue_shared/components/source_viewer/components/blame_info_spec.js @@ -24,10 +24,11 @@ describe('BlameInfo component', () => { it.each(BLAME_DATA_MOCK)( 'sets the correct data and positioning for the commitInfo', - ({ commit, index, blameOffset }) => { + ({ commit, commitData, index, blameOffset }) => { const commitInfoComponent = findCommitInfoComponents().at(index); expect(commitInfoComponent.props('commit')).toEqual(commit); + expect(commitInfoComponent.props('prevBlameLink')).toBe(commitData?.projectBlameLink || null); expect(commitInfoComponent.element.style.top).toBe(blameOffset); }, ); diff --git a/spec/frontend/vue_shared/components/source_viewer/mock_data.js b/spec/frontend/vue_shared/components/source_viewer/mock_data.js index 8e8f374b45d..cfff3a15b77 100644 --- a/spec/frontend/vue_shared/components/source_viewer/mock_data.js +++ b/spec/frontend/vue_shared/components/source_viewer/mock_data.js @@ -42,8 +42,16 @@ export const SOURCE_CODE_CONTENT_MOCK = ` `; +const COMMIT_DATA_MOCK = { projectBlameLink: 'project/blame/link' }; + export const BLAME_DATA_MOCK = [ - { lineno: 1, commit: { author: 'Peter', sha: 'abc' }, index: 0, blameOffset: '0px' }, + { + lineno: 1, + commit: { author: 'Peter', sha: 'abc' }, + index: 0, + blameOffset: '0px', + commitData: COMMIT_DATA_MOCK, + }, { lineno: 2, commit: { author: 'Sarah', sha: 'def' }, index: 1, blameOffset: '1px' }, { lineno: 3, commit: { author: 'Peter', sha: 'ghi' }, index: 2, blameOffset: '2px' }, ]; @@ -76,6 +84,7 @@ export const BLAME_DATA_QUERY_RESPONSE_MOCK = { author: {}, sha: '13b0aca4142d1d55931577f69289a792f216f805', }, + commitData: COMMIT_DATA_MOCK, }, ], }, -- cgit v1.2.3