diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 00:16:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-21 00:16:25 +0300 |
commit | faf60c19a9a1a29ce07d1b51ea3a69466e7129f3 (patch) | |
tree | 8ba3c836fd5ce4431e83301cefe9d9c0c9827c10 | |
parent | 054c9f71bc79eea35d482c4c53bff34214c5deaa (diff) |
Add latest changes from gitlab-org/gitlab@master
69 files changed, 194 insertions, 124 deletions
diff --git a/app/assets/javascripts/ci/pipeline_details/test_reports/test_reports.vue b/app/assets/javascripts/ci/pipeline_details/test_reports/test_reports.vue index 6e9a705c046..5fd9f7cfd4f 100644 --- a/app/assets/javascripts/ci/pipeline_details/test_reports/test_reports.vue +++ b/app/assets/javascripts/ci/pipeline_details/test_reports/test_reports.vue @@ -2,7 +2,12 @@ import { GlLoadingIcon } from '@gitlab/ui'; // eslint-disable-next-line no-restricted-imports import { mapActions, mapGetters, mapState } from 'vuex'; -import { getParameterValues } from '~/lib/utils/url_utility'; +import { + getParameterValues, + updateHistory, + setUrlParams, + removeParams, +} from '~/lib/utils/url_utility'; import EmptyState from './empty_state.vue'; import TestSuiteTable from './test_suite_table.vue'; import TestSummary from './test_summary.vue'; @@ -49,12 +54,28 @@ export default { ]), summaryBackClick() { this.removeSelectedSuiteIndex(); + + updateHistory({ + url: removeParams(['job_name']), + title: document.title, + replace: true, + }); }, summaryTableRowClick(index) { this.setSelectedSuiteIndex(index); // Fetch the test suite when the user clicks to see more details this.fetchTestSuite(index); + + const urlParams = { + job_name: this.getSelectedSuite.name, + }; + + updateHistory({ + url: setUrlParams(urlParams), + title: document.title, + replace: true, + }); }, beforeEnterTransition() { document.documentElement.style.overflowX = 'hidden'; diff --git a/app/assets/javascripts/notes/components/note_form.vue b/app/assets/javascripts/notes/components/note_form.vue index 9aaae960b6f..77ce5ea5910 100644 --- a/app/assets/javascripts/notes/components/note_form.vue +++ b/app/assets/javascripts/notes/components/note_form.vue @@ -352,7 +352,7 @@ export default { </template> </gl-sprintf> </div> - <div class="flash-container timeline-content"></div> + <div class="flash-container"></div> <form :data-line-code="lineCode" class="edit-note common-note-form js-quick-submit gfm-form"> <comment-field-layout :noteable-data="getNoteableData" :is-internal-note="isInternalNote"> <markdown-editor diff --git a/app/assets/stylesheets/framework/flash.scss b/app/assets/stylesheets/framework/flash.scss index 6b4f1478978..56667c10752 100644 --- a/app/assets/stylesheets/framework/flash.scss +++ b/app/assets/stylesheets/framework/flash.scss @@ -96,14 +96,6 @@ $notification-box-shadow-color: rgba(0, 0, 0, 0.25); } } -@include media-breakpoint-down(sm) { - ul.notes { - .flash-container.timeline-content { - margin-left: 0; - } - } -} - .gl-browser-ie .flash-container { position: fixed; max-width: $limited-layout-width; diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 8792c7f9a72..483d151adab 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -88,18 +88,18 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio; margin-top: 5px; } - .timeline-content:not(.flash-container) { + .timeline-content { margin-left: 2.5rem; border: 1px solid $border-color; border-radius: $gl-border-radius-base; padding: $gl-padding-4 $gl-padding-8; } - &:not(.target) .timeline-content:not(.flash-container) { + &:not(.target) .timeline-content { background-color: $white; } - &.draft-note .timeline-content:not(.flash-container) { + &.draft-note .timeline-content { border: 0; } @@ -127,7 +127,7 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio; margin-top: 5px; } - .timeline-content:not(.flash-container) { + .timeline-content { margin-left: 2.5rem; border-left: 1px solid $border-color; border-right: 1px solid $border-color; @@ -138,11 +138,11 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio; } } - &:not(.target) .timeline-content:not(.flash-container) { + &:not(.target) .timeline-content { background-color: $white; } - &.draft-note .timeline-content:not(.flash-container) { + &.draft-note .timeline-content { margin-left: 0; border-top-left-radius: 0; border-top-right-radius: 0; @@ -154,7 +154,7 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio; border-right: 1px solid $border-color; background-color: $white; - .timeline-content:not(.flash-container) { + .timeline-content { padding: $gl-padding-8 $gl-padding-8 $gl-padding-8 18px; } @@ -1057,7 +1057,7 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio; padding-left: 0; ul.notes li.note-wrapper { - .timeline-content:not(.flash-container) { + .timeline-content { padding: $gl-padding-8 $gl-padding-8 $gl-padding-8 $gl-padding; } @@ -1106,7 +1106,7 @@ $system-note-icon-m-left: $avatar-m-left + $icon-size-diff / $avatar-m-ratio; } .draft-note-component.draft-note.timeline-entry { - .timeline-content:not(.flash-container) { + .timeline-content { padding: $gl-padding-8 $gl-padding-8 $gl-padding-8 $gl-padding; } diff --git a/app/services/ci/unlock_pipeline_service.rb b/app/services/ci/unlock_pipeline_service.rb index 88d4a8fd0be..bd42871ffbe 100644 --- a/app/services/ci/unlock_pipeline_service.rb +++ b/app/services/ci/unlock_pipeline_service.rb @@ -84,7 +84,7 @@ module Ci def unlock_job_artifacts start = Time.current - pipeline.builds.each_batch(of: BATCH_SIZE) do |builds| + builds_relation.each_batch(of: BATCH_SIZE) do |builds| # rubocop: disable CodeReuse/ActiveRecord Ci::JobArtifact.where(job_id: builds.pluck(:id)).each_batch(of: BATCH_SIZE) do |job_artifacts| unlocked_count = Ci::JobArtifact @@ -100,6 +100,16 @@ module Ci end end + # Removes the partition_id filter from the query until we get more data in the + # second partition. + def builds_relation + if Feature.enabled?(:disable_ci_partition_pruning, pipeline.project, type: :wip) + Ci::Build.in_pipelines(pipeline) + else + pipeline.builds + end + end + def unlock_pipeline_artifacts @unlocked_pipeline_artifacts_count = pipeline.pipeline_artifacts.update_all(locked: :unlocked) end diff --git a/app/views/shared/notes/_notes_with_form.html.haml b/app/views/shared/notes/_notes_with_form.html.haml index 343a8597444..969ca2084d7 100644 --- a/app/views/shared/notes/_notes_with_form.html.haml +++ b/app/views/shared/notes/_notes_with_form.html.haml @@ -10,7 +10,7 @@ .notes.notes-form.timeline .timeline-entry.note-form .timeline-entry-inner - .flash-container.timeline-content + .flash-container .timeline-content.timeline-content-form = render "shared/notes/form", view: diff_view, supports_autocomplete: autocomplete diff --git a/config/feature_flags/wip/disable_ci_partition_pruning.yml b/config/feature_flags/wip/disable_ci_partition_pruning.yml new file mode 100644 index 00000000000..91e07c50ba2 --- /dev/null +++ b/config/feature_flags/wip/disable_ci_partition_pruning.yml @@ -0,0 +1,9 @@ +--- +name: disable_ci_partition_pruning +feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/435737 +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/140355 +rollout_issue_url: +milestone: '16.8' +group: group::pipeline execution +type: wip +default_enabled: false diff --git a/doc/topics/git/index.md b/doc/topics/git/index.md index c7b1832c8b8..5a6a1aecded 100644 --- a/doc/topics/git/index.md +++ b/doc/topics/git/index.md @@ -4,7 +4,7 @@ group: Source Code info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments" --- -# Git **(FREE ALL)** +# Use Git **(FREE ALL)** Git is a [free and open source](https://git-scm.com/about/free-and-open-source) distributed version control system. It handles projects of all sizes quickly and diff --git a/doc/user/ai_features.md b/doc/user/ai_features.md index 71b5617a4a9..4113233cef3 100644 --- a/doc/user/ai_features.md +++ b/doc/user/ai_features.md @@ -17,7 +17,7 @@ GitLab is creating AI-assisted features across our DevSecOps platform. These fea | Helps you discover or recall Git commands when and where you need them. | [Git suggestions](https://gitlab.com/gitlab-org/gitlab/-/issues/409636) | **(ULTIMATE SAAS EXPERIMENT)** | | Assists with quickly getting everyone up to speed on lengthy conversations to help ensure you are all on the same page. | [Discussion summary](#summarize-issue-discussions-with-discussion-summary) | **(ULTIMATE SAAS EXPERIMENT)** | | Generates issue descriptions. | [Issue description generation](#summarize-an-issue-with-issue-description-generation) | **(ULTIMATE SAAS EXPERIMENT)** | -| Helps you write code more efficiently by viewing code suggestions as you type. <br><br><i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Watch overview](https://www.youtube.com/watch?v=hCAyCTacdAQ) | [Code Suggestions](project/repository/code_suggestions/index.md) | For SaaS: **(FREE BETA)**<br><br> For self-managed: **(ULTIMATE BETA)** | +| Helps you write code more efficiently by viewing code suggestions as you type. <br><br><i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Watch overview](https://www.youtube.com/watch?v=hCAyCTacdAQ) | [Code Suggestions](project/repository/code_suggestions/index.md) | For SaaS: **(FREE BETA)**<br><br> For self-managed: **(PREMIUM BETA)** | | Automates repetitive tasks and helps catch bugs early. | [Test generation](project/merge_requests/ai_in_merge_requests.md#generate-suggested-tests-in-merge-requests) | **(ULTIMATE SAAS EXPERIMENT)** | | Generates a description for the merge request based on the contents of the template. | [Merge request template population](project/merge_requests/ai_in_merge_requests.md#fill-in-merge-request-templates) | **(ULTIMATE SAAS EXPERIMENT)** | | Assists in creating faster and higher-quality reviews by automatically suggesting reviewers for your merge request. <br><br><i class="fa fa-youtube-play youtube" aria-hidden="true"></i> [Watch overview](https://www.youtube.com/watch?v=ivwZQgh4Rxw) | [Suggested Reviewers](project/merge_requests/reviews/index.md#gitlab-duo-suggested-reviewers) | **(ULTIMATE SAAS)** | diff --git a/doc/user/application_security/sast/index.md b/doc/user/application_security/sast/index.md index ab6d5212227..56397a29d47 100644 --- a/doc/user/application_security/sast/index.md +++ b/doc/user/application_security/sast/index.md @@ -54,31 +54,31 @@ For more information about our plans for language support in SAST, see the [cate | Language / framework | [Analyzer](analyzers.md) used for scanning | Minimum supported GitLab version | |------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------| -| .NET (all versions, C# only) | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 15.4 | +| .NET (all versions, C# only) | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 15.4 | | Apex (Salesforce) | [PMD](https://gitlab.com/gitlab-org/security-products/analyzers/pmd-apex) | 12.1 | -| C | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 14.2 | +| C | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 14.2 | | C/C++ | [Flawfinder](https://gitlab.com/gitlab-org/security-products/analyzers/flawfinder) | 10.7 | | Elixir (Phoenix) | [Sobelow](https://gitlab.com/gitlab-org/security-products/analyzers/sobelow) | 11.1 | -| Go | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 14.4 | +| Go | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 14.4 | | Groovy<sup>1</sup> | [SpotBugs](https://gitlab.com/gitlab-org/security-products/analyzers/spotbugs) with the find-sec-bugs plugin | 11.3 (Gradle) & 11.9 (Maven, SBT) | | Helm Charts | [Kubesec](https://gitlab.com/gitlab-org/security-products/analyzers/kubesec) | 13.1 | -| Java (any build system) | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 14.10 | +| Java (any build system) | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 14.10 | | Java (Android) | [MobSF (beta)](https://gitlab.com/gitlab-org/security-products/analyzers/mobsf) | 13.5 | -| JavaScript | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 13.10 | +| JavaScript | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 13.10 | | Kotlin (Android) | [MobSF (beta)](https://gitlab.com/gitlab-org/security-products/analyzers/mobsf) | 13.5 | | Kotlin (General)<sup>1</sup> | [SpotBugs](https://gitlab.com/gitlab-org/security-products/analyzers/spotbugs) with the find-sec-bugs plugin | 13.11 | | Kubernetes manifests | [Kubesec](https://gitlab.com/gitlab-org/security-products/analyzers/kubesec) | 12.6 | | Node.js | [NodeJsScan](https://gitlab.com/gitlab-org/security-products/analyzers/nodejs-scan) | 11.1 | | Objective-C (iOS) | [MobSF (beta)](https://gitlab.com/gitlab-org/security-products/analyzers/mobsf) | 13.5 | | PHP | [phpcs-security-audit](https://gitlab.com/gitlab-org/security-products/analyzers/phpcs-security-audit) | 10.8 | -| Python | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 13.9 | -| React | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 13.10 | +| Python | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 13.9 | +| React | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 13.10 | | Ruby | [brakeman](https://gitlab.com/gitlab-org/security-products/analyzers/brakeman) | 13.9 | | Ruby on Rails | [brakeman](https://gitlab.com/gitlab-org/security-products/analyzers/brakeman) | 10.3 | -| Scala (any build system) | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 16.0 | +| Scala (any build system) | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 16.0 | | Scala<sup>1</sup> | [SpotBugs](https://gitlab.com/gitlab-org/security-products/analyzers/spotbugs) with the find-sec-bugs plugin | 11.0 (SBT) & 11.9 (Gradle, Maven) | | Swift (iOS) | [MobSF (beta)](https://gitlab.com/gitlab-org/security-products/analyzers/mobsf) | 13.5 | -| TypeScript | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/-/blob/main/RULES.md) | 13.10 | +| TypeScript | [Semgrep](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep) with [GitLab-managed rules](https://gitlab.com/gitlab-org/security-products/analyzers/semgrep/#sast-rules) | 13.10 | 1. The SpotBugs-based analyzer supports [Gradle](https://gradle.org/), [Maven](https://maven.apache.org/), and [SBT](https://www.scala-sbt.org/). It can also be used with variants like the [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), diff --git a/lib/gitlab/database/health_status/indicators/prometheus_alert_indicator.rb b/lib/gitlab/database/health_status/indicators/prometheus_alert_indicator.rb index 3d630d21d4c..6e5c4fe8498 100644 --- a/lib/gitlab/database/health_status/indicators/prometheus_alert_indicator.rb +++ b/lib/gitlab/database/health_status/indicators/prometheus_alert_indicator.rb @@ -82,6 +82,7 @@ module Gitlab def sli_query { gitlab_main: prometheus_alert_db_indicators_settings[sli_query_key][:main], + gitlab_main_cell: prometheus_alert_db_indicators_settings[sli_query_key][:main_cell], gitlab_ci: prometheus_alert_db_indicators_settings[sli_query_key][:ci] }.fetch(gitlab_schema) end @@ -90,6 +91,7 @@ module Gitlab def slo { gitlab_main: prometheus_alert_db_indicators_settings[slo_key][:main], + gitlab_main_cell: prometheus_alert_db_indicators_settings[slo_key][:main_cell], gitlab_ci: prometheus_alert_db_indicators_settings[slo_key][:ci] }.fetch(gitlab_schema) end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index dd0c692cadb..217cf6b9d3a 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -2066,6 +2066,9 @@ msgstr "" msgid "AI|There is too much text in the chat. Please try again with a shorter text." msgstr "" +msgid "AI|This is an experiment feature that uses AI to provide recommendations for resolving this vulnerability. Use this feature with caution." +msgstr "" + msgid "AI|To help improve the quality of the content, send your feedback to GitLab team members." msgstr "" @@ -52258,6 +52261,9 @@ msgstr "" msgid "UsageQuota|%{storage_limit_link_start}A namespace storage limit%{link_end} of %{limit} will soon be enforced for the %{strong_start}%{namespace_name}%{strong_end} namespace. %{extra_message}" msgstr "" +msgid "UsageQuota|An error occured while loading the storage usage details. Please refresh the page to try again." +msgstr "" + msgid "UsageQuota|Any additional purchased storage will be displayed here." msgstr "" @@ -52396,9 +52402,6 @@ msgstr "" msgid "UsageQuota|Something went wrong while fetching project storage statistics" msgstr "" -msgid "UsageQuota|Something went wrong while loading usage details" -msgstr "" - msgid "UsageQuota|Storage" msgstr "" diff --git a/spec/features/admin/admin_abuse_reports_spec.rb b/spec/features/admin/admin_abuse_reports_spec.rb index 9c425f83508..5e98d2ffcf3 100644 --- a/spec/features/admin/admin_abuse_reports_spec.rb +++ b/spec/features/admin/admin_abuse_reports_spec.rb @@ -17,7 +17,7 @@ RSpec.describe "Admin::AbuseReports", :js, feature_category: :insider_threat do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_abuse_reports_path end diff --git a/spec/features/admin/admin_appearance_spec.rb b/spec/features/admin/admin_appearance_spec.rb index ec63e43d183..2a9bff55dce 100644 --- a/spec/features/admin/admin_appearance_spec.rb +++ b/spec/features/admin/admin_appearance_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'create new appearance' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path fill_in 'appearance_title', with: 'MyCompany' @@ -39,7 +39,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'preview sign-in page appearance' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path click_link "Sign-in page" @@ -53,7 +53,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'preview new project page appearance', :js do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path click_link "New project page" @@ -64,7 +64,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do context 'Custom system header and footer' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'when system header and footer messages are empty' do @@ -102,7 +102,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'custom new project page', :js do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit new_project_path click_link 'Create blank project' @@ -112,7 +112,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do context 'Profile page with custom profile image guidelines' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path fill_in 'appearance_profile_image_guidelines', with: 'Custom profile image guidelines, please :smile:!' click_button 'Update appearance settings' @@ -128,7 +128,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'appearance logo' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_logo, logo_fixture) @@ -141,7 +141,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'appearance pwa icon' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_pwa_icon, logo_fixture) @@ -154,7 +154,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'header logos' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_header_logo, logo_fixture) @@ -167,7 +167,7 @@ RSpec.describe 'Admin Appearance', feature_category: :shared do it 'Favicon' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_application_settings_appearances_path attach_file(:appearance_favicon, logo_fixture) diff --git a/spec/features/admin/admin_browse_spam_logs_spec.rb b/spec/features/admin/admin_browse_spam_logs_spec.rb index 1f89232759c..f781e2adf07 100644 --- a/spec/features/admin/admin_browse_spam_logs_spec.rb +++ b/spec/features/admin/admin_browse_spam_logs_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'Admin browse spam logs', feature_category: :shared do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'browse spam logs' do diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb index d6d021aeafc..f9510ef296a 100644 --- a/spec/features/admin/admin_deploy_keys_spec.rb +++ b/spec/features/admin/admin_deploy_keys_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'admin deploy keys', :js, feature_category: :system_access do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'show all public deploy keys' do diff --git a/spec/features/admin/admin_dev_ops_reports_spec.rb b/spec/features/admin/admin_dev_ops_reports_spec.rb index e820ae866a1..99d43e6b0da 100644 --- a/spec/features/admin/admin_dev_ops_reports_spec.rb +++ b/spec/features/admin/admin_dev_ops_reports_spec.rb @@ -6,7 +6,7 @@ RSpec.describe 'DevOps Report page', :js, feature_category: :devops_reports do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'without licensed feature devops adoption' do diff --git a/spec/features/admin/admin_disables_git_access_protocol_spec.rb b/spec/features/admin/admin_disables_git_access_protocol_spec.rb index 039968025a9..76620b93557 100644 --- a/spec/features/admin/admin_disables_git_access_protocol_spec.rb +++ b/spec/features/admin/admin_disables_git_access_protocol_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin disables Git access protocol', :js, feature_category: :sou before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'with HTTP disabled' do diff --git a/spec/features/admin/admin_disables_two_factor_spec.rb b/spec/features/admin/admin_disables_two_factor_spec.rb index cb3c8973872..eed20d449cd 100644 --- a/spec/features/admin/admin_disables_two_factor_spec.rb +++ b/spec/features/admin/admin_disables_two_factor_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'Admin disables 2FA for a user', feature_category: :system_access it 'successfully', :js do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) user = create(:user, :two_factor) edit_user(user) @@ -27,7 +27,7 @@ RSpec.describe 'Admin disables 2FA for a user', feature_category: :system_access it 'for a user without 2FA enabled' do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) user = create(:user) edit_user(user) diff --git a/spec/features/admin/admin_groups_spec.rb b/spec/features/admin/admin_groups_spec.rb index 283caddab6a..f071da1835a 100644 --- a/spec/features/admin/admin_groups_spec.rb +++ b/spec/features/admin/admin_groups_spec.rb @@ -15,7 +15,7 @@ RSpec.describe 'Admin Groups', feature_category: :groups_and_projects do before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) stub_application_setting(default_group_visibility: internal) end diff --git a/spec/features/admin/admin_health_check_spec.rb b/spec/features/admin/admin_health_check_spec.rb index fa91159c5f5..66014e676d5 100644 --- a/spec/features/admin/admin_health_check_spec.rb +++ b/spec/features/admin/admin_health_check_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "Admin Health Check", :js, feature_category: :error_budgets do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe '#show' do diff --git a/spec/features/admin/admin_hook_logs_spec.rb b/spec/features/admin/admin_hook_logs_spec.rb index 146c83dbeee..0a537e65b99 100644 --- a/spec/features/admin/admin_hook_logs_spec.rb +++ b/spec/features/admin/admin_hook_logs_spec.rb @@ -9,7 +9,7 @@ RSpec.describe 'Admin::HookLogs', feature_category: :webhooks do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'show list of hook logs' do diff --git a/spec/features/admin/admin_hooks_spec.rb b/spec/features/admin/admin_hooks_spec.rb index 9bdb7ce000f..2aec5baf351 100644 --- a/spec/features/admin/admin_hooks_spec.rb +++ b/spec/features/admin/admin_hooks_spec.rb @@ -9,7 +9,7 @@ RSpec.describe 'Admin::Hooks', feature_category: :webhooks do before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end describe 'GET /admin/hooks' do diff --git a/spec/features/admin/admin_jobs_spec.rb b/spec/features/admin/admin_jobs_spec.rb index fc775c180ff..b3e21d02354 100644 --- a/spec/features/admin/admin_jobs_spec.rb +++ b/spec/features/admin/admin_jobs_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'Admin Jobs', :js, feature_category: :continuous_integration do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'GET /admin/jobs' do diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb index 2fe68363062..47dc8577037 100644 --- a/spec/features/admin/admin_labels_spec.rb +++ b/spec/features/admin/admin_labels_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'admin issues labels', feature_category: :team_planning do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'list' do diff --git a/spec/features/admin/admin_manage_applications_spec.rb b/spec/features/admin/admin_manage_applications_spec.rb index 3e351af6121..b4c77e802a8 100644 --- a/spec/features/admin/admin_manage_applications_spec.rb +++ b/spec/features/admin/admin_manage_applications_spec.rb @@ -10,7 +10,7 @@ RSpec.describe 'admin manage applications', feature_category: :system_access do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end include_examples 'manage applications' diff --git a/spec/features/admin/admin_mode/login_spec.rb b/spec/features/admin/admin_mode/login_spec.rb index 5298407deb3..5e4935ee4b1 100644 --- a/spec/features/admin/admin_mode/login_spec.rb +++ b/spec/features/admin/admin_mode/login_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'Admin Mode Login', feature_category: :system_access do repeated_otp = user.current_otp enter_code(repeated_otp) - enable_admin_mode!(user, use_ui: true) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) @@ -41,7 +41,7 @@ RSpec.describe 'Admin Mode Login', feature_category: :system_access do expect(page).to have_content('Enter verification code') enter_code(user.current_otp) - enable_admin_mode!(user, use_ui: true) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) expect(page).to have_content(_('Enter verification code')) end diff --git a/spec/features/admin/admin_mode/logout_spec.rb b/spec/features/admin/admin_mode/logout_spec.rb index beac36e28c5..584151726a6 100644 --- a/spec/features/admin/admin_mode/logout_spec.rb +++ b/spec/features/admin/admin_mode/logout_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do # TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See # this issue to look into why: https://gitlab.com/gitlab-org/gitlab/-/issues/331851 sign_in(user) - enable_admin_mode!(user, use_ui: true) + gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: false) visit admin_root_path end diff --git a/spec/features/admin/admin_mode/workers_spec.rb b/spec/features/admin/admin_mode/workers_spec.rb index f0cea425bb7..124c43eef9d 100644 --- a/spec/features/admin/admin_mode/workers_spec.rb +++ b/spec/features/admin/admin_mode/workers_spec.rb @@ -34,7 +34,7 @@ RSpec.describe 'Admin mode for workers', :request_store, feature_category: :syst context 'when admin mode enabled', :delete do before do - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end it 'can delete user', :js do @@ -67,6 +67,6 @@ RSpec.describe 'Admin mode for workers', :request_store, feature_category: :syst Sidekiq::Worker.drain_all sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end end diff --git a/spec/features/admin/admin_mode_spec.rb b/spec/features/admin/admin_mode_spec.rb index 29eb24fa9b8..2a655cdb1f4 100644 --- a/spec/features/admin/admin_mode_spec.rb +++ b/spec/features/admin/admin_mode_spec.rb @@ -69,7 +69,7 @@ RSpec.describe 'Admin mode', :js, feature_category: :shared do context 'when in admin_mode' do before do - enable_admin_mode!(admin, use_ui: true) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end it 'contains link to leave admin mode' do diff --git a/spec/features/admin/admin_projects_spec.rb b/spec/features/admin/admin_projects_spec.rb index 978b2176431..b793299e253 100644 --- a/spec/features/admin/admin_projects_spec.rb +++ b/spec/features/admin/admin_projects_spec.rb @@ -14,7 +14,7 @@ RSpec.describe "Admin::Projects", feature_category: :groups_and_projects do before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'when membership is set to expire', :js do diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 2b4ceb05f00..653458710e3 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -11,7 +11,7 @@ RSpec.describe "Admin Runners", feature_category: :fleet_visibility do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe "Admin Runners page", :js do diff --git a/spec/features/admin/admin_search_settings_spec.rb b/spec/features/admin/admin_search_settings_spec.rb index c20a50cf218..3254bf75738 100644 --- a/spec/features/admin/admin_search_settings_spec.rb +++ b/spec/features/admin/admin_search_settings_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'Admin searches application settings', :js, feature_category: :gl before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'in appearances page' do diff --git a/spec/features/admin/admin_sees_background_migrations_spec.rb b/spec/features/admin/admin_sees_background_migrations_spec.rb index 43b920c657c..ae307b8038c 100644 --- a/spec/features/admin/admin_sees_background_migrations_spec.rb +++ b/spec/features/admin/admin_sees_background_migrations_spec.rb @@ -18,7 +18,7 @@ RSpec.describe "Admin > Admin sees background migrations", feature_category: :da before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'can navigate to background migrations', :js do diff --git a/spec/features/admin/admin_sees_project_statistics_spec.rb b/spec/features/admin/admin_sees_project_statistics_spec.rb index 07f90d247cd..d977735daf8 100644 --- a/spec/features/admin/admin_sees_project_statistics_spec.rb +++ b/spec/features/admin/admin_sees_project_statistics_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "Admin > Admin sees project statistics", feature_category: :group before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) visit admin_project_path(project) end diff --git a/spec/features/admin/admin_sees_projects_statistics_spec.rb b/spec/features/admin/admin_sees_projects_statistics_spec.rb index cc6ccbab0a0..3363a67ea90 100644 --- a/spec/features/admin/admin_sees_projects_statistics_spec.rb +++ b/spec/features/admin/admin_sees_projects_statistics_spec.rb @@ -10,7 +10,7 @@ RSpec.describe "Admin > Admin sees projects statistics", feature_category: :grou create(:project, :repository) { |project| project.statistics.destroy! } sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) visit admin_projects_path end diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index d1fdbfc5329..77707a67d58 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -13,7 +13,7 @@ RSpec.describe 'Admin updates settings', feature_category: :shared do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin, use_ui: true) + gitlab_enable_admin_mode_sign_in(admin, use_mock_admin_mode: false) end context 'General page' do diff --git a/spec/features/admin/admin_system_info_spec.rb b/spec/features/admin/admin_system_info_spec.rb index f285fefe6db..71a0b829932 100644 --- a/spec/features/admin/admin_system_info_spec.rb +++ b/spec/features/admin/admin_system_info_spec.rb @@ -6,7 +6,7 @@ RSpec.describe 'Admin System Info', feature_category: :shared do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe 'GET /admin/system_info' do diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index 7cfe0cdbc81..543dc2cc2a6 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Admin > Users > Impersonation Tokens', :js, feature_category: :s before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe "token creation" do diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index f09c1a59b0d..9ab5b1fd3bb 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "Admin::Users", feature_category: :user_management do before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'Tabs' do diff --git a/spec/features/admin/admin_uses_repository_checks_spec.rb b/spec/features/admin/admin_uses_repository_checks_spec.rb index a628344bfeb..05232de35e5 100644 --- a/spec/features/admin/admin_uses_repository_checks_spec.rb +++ b/spec/features/admin/admin_uses_repository_checks_spec.rb @@ -25,7 +25,7 @@ RSpec.describe 'Admin uses repository checks', :request_store, feature_category: context 'when admin mode is enabled' do before do - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'to trigger a single check', :js do diff --git a/spec/features/admin/broadcast_messages_spec.rb b/spec/features/admin/broadcast_messages_spec.rb index 16651ffa07e..e4a2e31ee1c 100644 --- a/spec/features/admin/broadcast_messages_spec.rb +++ b/spec/features/admin/broadcast_messages_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Admin Broadcast Messages', :js, feature_category: :onboarding do it 'previews, creates and edits a broadcast message' do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) # create visit admin_broadcast_messages_path diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb index 9e8f5138815..06f9c531e74 100644 --- a/spec/features/admin/dashboard_spec.rb +++ b/spec/features/admin/dashboard_spec.rb @@ -8,7 +8,7 @@ RSpec.describe 'admin visits dashboard' do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end context 'counting forks', :js, feature_category: :source_code_management do diff --git a/spec/features/admin/users/user_spec.rb b/spec/features/admin/users/user_spec.rb index b7e7a037ffc..d6f53fc6ca4 100644 --- a/spec/features/admin/users/user_spec.rb +++ b/spec/features/admin/users/user_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Admin::Users::User', feature_category: :user_management do before do sign_in(current_user) - enable_admin_mode!(current_user, use_ui: true) + gitlab_enable_admin_mode_sign_in(current_user, use_mock_admin_mode: false) end describe 'GET /admin/users/:id' do diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index 20cedda626b..d2f3b0e8e40 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do before do sign_in(current_user) - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end describe 'GET /admin/users', :js do diff --git a/spec/features/admin_variables_spec.rb b/spec/features/admin_variables_spec.rb index 0fc0ae9e199..caa94209e50 100644 --- a/spec/features/admin_variables_spec.rb +++ b/spec/features/admin_variables_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Instance variables', :js, feature_category: :secrets_management before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit page_path wait_for_requests diff --git a/spec/features/boards/keyboard_shortcut_spec.rb b/spec/features/boards/keyboard_shortcut_spec.rb index d4777fa671c..6f03f6db3ab 100644 --- a/spec/features/boards/keyboard_shortcut_spec.rb +++ b/spec/features/boards/keyboard_shortcut_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Issue Boards shortcut', :js, feature_category: :team_planning do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit project_path(project) end @@ -30,7 +30,7 @@ RSpec.describe 'Issue Boards shortcut', :js, feature_category: :team_planning do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit project_path(project) end diff --git a/spec/features/broadcast_messages_spec.rb b/spec/features/broadcast_messages_spec.rb index 867ed3c3acb..f887242384c 100644 --- a/spec/features/broadcast_messages_spec.rb +++ b/spec/features/broadcast_messages_spec.rb @@ -121,7 +121,7 @@ RSpec.describe 'Broadcast Messages', feature_category: :onboarding do stub_const('Gitlab::Cache::JsonCaches::JsonKeyed::STRATEGY_KEY_COMPONENTS', original_strategy_value) admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_broadcast_messages_path diff --git a/spec/features/clusters/cluster_detail_page_spec.rb b/spec/features/clusters/cluster_detail_page_spec.rb index 78ac752a375..31dec5e38da 100644 --- a/spec/features/clusters/cluster_detail_page_spec.rb +++ b/spec/features/clusters/cluster_detail_page_spec.rb @@ -145,7 +145,7 @@ RSpec.describe 'Clusterable > Show page', feature_category: :deployment_manageme let(:cluster) { create(:cluster, :provided_by_gcp, :instance) } before do - enable_admin_mode!(current_user) + gitlab_enable_admin_mode_sign_in(current_user) end it_behaves_like 'show page' do diff --git a/spec/features/expand_collapse_diffs_spec.rb b/spec/features/expand_collapse_diffs_spec.rb index 523ef8990bb..7fbd6c4e235 100644 --- a/spec/features/expand_collapse_diffs_spec.rb +++ b/spec/features/expand_collapse_diffs_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Expand and collapse diffs', :js, feature_category: :source_code_ allow(Gitlab::CurrentSettings).to receive(:diff_max_patch_bytes).and_return(100.kilobytes) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) wait_for_requests diff --git a/spec/features/gitlab_experiments_spec.rb b/spec/features/gitlab_experiments_spec.rb index 0d0afa801c8..facf4994c44 100644 --- a/spec/features/gitlab_experiments_spec.rb +++ b/spec/features/gitlab_experiments_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "Gitlab::Experiment", :js, feature_category: :activation do before do admin = create(:admin) sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) stub_experiments(null_hypothesis: :candidate) end diff --git a/spec/features/groups/clusters/user_spec.rb b/spec/features/groups/clusters/user_spec.rb index 24552daa11b..9089fba1886 100644 --- a/spec/features/groups/clusters/user_spec.rb +++ b/spec/features/groups/clusters/user_spec.rb @@ -130,7 +130,7 @@ RSpec.describe 'User Cluster', :js, feature_category: :environment_management do gitlab_sign_out gitlab_sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit group_clusters_path(group) end diff --git a/spec/features/groups/members/list_members_spec.rb b/spec/features/groups/members/list_members_spec.rb index b6e0deb2e73..b16d61a5fe4 100644 --- a/spec/features/groups/members/list_members_spec.rb +++ b/spec/features/groups/members/list_members_spec.rb @@ -66,7 +66,7 @@ RSpec.describe 'Groups > Members > List members', :js, feature_category: :groups it 'shows 2FA badge to admins' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit group_group_members_path(group) diff --git a/spec/features/help_dropdown_spec.rb b/spec/features/help_dropdown_spec.rb index 89040ec9ab6..3e4c0bc55fe 100644 --- a/spec/features/help_dropdown_spec.rb +++ b/spec/features/help_dropdown_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "Help Dropdown", :js, feature_category: :shared do context "when severity is #{severity}" do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) allow_next_instance_of(VersionCheck) do |instance| allow(instance).to receive(:response).and_return({ "severity" => severity }) diff --git a/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb b/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb index f52520313b2..7e33946f713 100644 --- a/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb +++ b/spec/features/merge_requests/admin_views_hidden_merge_requests_spec.rb @@ -11,7 +11,7 @@ RSpec.describe 'Admin views hidden merge requests', feature_category: :insider_t before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit(project_merge_requests_path(project)) end diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index e7e419a4c60..c223053606b 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -110,7 +110,7 @@ RSpec.describe 'Gcp Cluster', :js, feature_category: :deployment_management do before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) visit general_admin_application_settings_path end diff --git a/spec/features/projects/clusters/user_spec.rb b/spec/features/projects/clusters/user_spec.rb index bc4d64dad21..067963e06e0 100644 --- a/spec/features/projects/clusters/user_spec.rb +++ b/spec/features/projects/clusters/user_spec.rb @@ -120,7 +120,7 @@ RSpec.describe 'User Cluster', :js, feature_category: :deployment_management do gitlab_sign_out gitlab_sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit project_clusters_path(project) end diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 5f1bc4f86c1..c6a770cee9e 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -153,7 +153,7 @@ RSpec.describe 'Edit Project Settings', feature_category: :groups_and_projects d before do non_member.update_attribute(:admin, true) sign_in(non_member) - enable_admin_mode!(non_member) + gitlab_enable_admin_mode_sign_in(non_member) end it 'renders 404 if feature is disabled' do diff --git a/spec/features/projects/members/manage_members_spec.rb b/spec/features/projects/members/manage_members_spec.rb index 2ab0e63d840..3423c636c2b 100644 --- a/spec/features/projects/members/manage_members_spec.rb +++ b/spec/features/projects/members/manage_members_spec.rb @@ -265,7 +265,7 @@ RSpec.describe 'Projects > Members > Manage members', :js, feature_category: :on it 'shows 2FA badge to admins' do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit_members_page diff --git a/spec/features/projects/user_views_empty_project_spec.rb b/spec/features/projects/user_views_empty_project_spec.rb index 7dc3dd1da1e..ed34b109d29 100644 --- a/spec/features/projects/user_views_empty_project_spec.rb +++ b/spec/features/projects/user_views_empty_project_spec.rb @@ -43,7 +43,7 @@ RSpec.describe 'User views an empty project', feature_category: :groups_and_proj context 'when admin mode is enabled' do before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end it_behaves_like 'allowing push to default branch' diff --git a/spec/features/protected_branches_spec.rb b/spec/features/protected_branches_spec.rb index c29323cba27..41105630204 100644 --- a/spec/features/protected_branches_spec.rb +++ b/spec/features/protected_branches_spec.rb @@ -82,7 +82,7 @@ RSpec.describe 'Protected Branches', :js, feature_category: :source_code_managem context 'logged in as admin' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end describe "explicit protected branches" do diff --git a/spec/features/usage_stats_consent_spec.rb b/spec/features/usage_stats_consent_spec.rb index 5436018250d..ebf1cd9e143 100644 --- a/spec/features/usage_stats_consent_spec.rb +++ b/spec/features/usage_stats_consent_spec.rb @@ -19,7 +19,7 @@ RSpec.describe 'Usage stats consent', feature_category: :service_ping do end gitlab_sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end shared_examples 'dismissible banner' do |button_text| diff --git a/spec/features/user_settings/active_sessions_spec.rb b/spec/features/user_settings/active_sessions_spec.rb index bc0693d79e1..5d1d4bc6490 100644 --- a/spec/features/user_settings/active_sessions_spec.rb +++ b/spec/features/user_settings/active_sessions_spec.rb @@ -47,7 +47,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state, fe ) gitlab_sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) visit admin_user_path(user) diff --git a/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js b/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js index d318aa36bcf..cc660d26b57 100644 --- a/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js +++ b/spec/frontend/ci/pipeline_details/test_reports/test_reports_spec.js @@ -5,7 +5,12 @@ import Vue from 'vue'; import Vuex from 'vuex'; import testReports from 'test_fixtures/pipelines/test_report.json'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import { getParameterValues } from '~/lib/utils/url_utility'; +import { + getParameterValues, + updateHistory, + removeParams, + setUrlParams, +} from '~/lib/utils/url_utility'; import EmptyState from '~/ci/pipeline_details/test_reports/empty_state.vue'; import TestReports from '~/ci/pipeline_details/test_reports/test_reports.vue'; import TestSummary from '~/ci/pipeline_details/test_reports/test_summary.vue'; @@ -17,6 +22,9 @@ Vue.use(Vuex); jest.mock('~/lib/utils/url_utility', () => ({ ...jest.requireActual('~/lib/utils/url_utility'), getParameterValues: jest.fn().mockReturnValue([]), + updateHistory: jest.fn().mockName('updateHistory'), + removeParams: jest.fn().mockName('removeParams'), + setUrlParams: jest.fn().mockName('setUrlParams'), })); describe('Test reports app', () => { @@ -128,9 +136,11 @@ describe('Test reports app', () => { testSummaryTable().vm.$emit('row-click', 0); }); - it('should call setSelectedSuiteIndex and fetchTestSuite', () => { + it('should call setSelectedSuiteIndex, fetchTestSuite and updateHistory', () => { expect(actionSpies.setSelectedSuiteIndex).toHaveBeenCalled(); expect(actionSpies.fetchTestSuite).toHaveBeenCalled(); + expect(setUrlParams).toHaveBeenCalledWith({ job_name: undefined }); + expect(updateHistory).toHaveBeenCalledWith({ replace: true, title: '', url: undefined }); }); }); @@ -140,8 +150,10 @@ describe('Test reports app', () => { testSummary().vm.$emit('on-back-click'); }); - it('should call removeSelectedSuiteIndex', () => { + it('should call removeSelectedSuiteIndex and updateHistory', () => { expect(actionSpies.removeSelectedSuiteIndex).toHaveBeenCalled(); + expect(removeParams).toHaveBeenCalledWith(['job_name']); + expect(updateHistory).toHaveBeenCalledWith({ replace: true, title: '', url: undefined }); }); }); }); diff --git a/spec/services/ci/unlock_pipeline_service_spec.rb b/spec/services/ci/unlock_pipeline_service_spec.rb index 1a1150dca9e..16537ce5eaa 100644 --- a/spec/services/ci/unlock_pipeline_service_spec.rb +++ b/spec/services/ci/unlock_pipeline_service_spec.rb @@ -39,6 +39,28 @@ RSpec.describe Ci::UnlockPipelineService, :unlock_pipelines, :clean_gitlab_redis ) end + context 'when disable_ci_partition_pruning is disabled' do + before do + stub_feature_flags(disable_ci_partition_pruning: false) + end + + it 'unlocks the pipeline and all its artifacts' do + expect { execute } + .to change { pipeline.reload.locked }.from('artifacts_locked').to('unlocked') + .and change { pipeline.reload.job_artifacts.all?(&:artifact_unlocked?) }.to(true) + .and change { pipeline.reload.pipeline_artifacts.all?(&:artifact_unlocked?) }.to(true) + + expect(execute).to eq( + status: :success, + skipped_already_leased: false, + skipped_already_unlocked: false, + exec_timeout: false, + unlocked_job_artifacts: pipeline.job_artifacts.count, + unlocked_pipeline_artifacts: pipeline.pipeline_artifacts.count + ) + end + end + context 'and pipeline is already unlocked' do before do described_class.new(pipeline).execute diff --git a/spec/support/helpers/admin_mode_helpers.rb b/spec/support/helpers/admin_mode_helpers.rb index 8b71552f928..a6e31791127 100644 --- a/spec/support/helpers/admin_mode_helpers.rb +++ b/spec/support/helpers/admin_mode_helpers.rb @@ -5,30 +5,17 @@ module AdminModeHelper # Administrators are logged in by default in user mode and have to switch to admin # mode for accessing any administrative functionality. This helper lets a user - # access the admin area in two different ways: - # - # * Fast (use_ui: false) and suitable form the most use cases: fakes calls and grants - # access to the admin area without requiring a second authentication step (provided the - # user is an admin) - # * Slow (use_ui: true): visits the admin UI and enters the users password. A second - # authentication step may be needed. + # be in admin mode without requiring a second authentication step (provided + # the user is an admin) # # See also tag :enable_admin_mode in spec/spec_helper.rb for a spec-wide # alternative - def enable_admin_mode!(user, use_ui: false) - if use_ui - visit new_admin_session_path - fill_in 'user_password', with: user.password - click_button 'Enter admin mode' - - wait_for_requests - else - fake_user_mode = instance_double(Gitlab::Auth::CurrentUserMode) + def enable_admin_mode!(user) + fake_user_mode = instance_double(Gitlab::Auth::CurrentUserMode) - allow(Gitlab::Auth::CurrentUserMode).to receive(:new).and_call_original + allow(Gitlab::Auth::CurrentUserMode).to receive(:new).and_call_original - allow(Gitlab::Auth::CurrentUserMode).to receive(:new).with(user).and_return(fake_user_mode) - allow(fake_user_mode).to receive(:admin_mode?).and_return(user&.admin?) - end + allow(Gitlab::Auth::CurrentUserMode).to receive(:new).with(user).and_return(fake_user_mode) + allow(fake_user_mode).to receive(:admin_mode?).and_return(user&.admin?) end end diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index ff1c528d94a..0cdddeaa84a 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -49,6 +49,18 @@ module LoginHelpers @current_user = user end + def gitlab_enable_admin_mode_sign_in(user, use_mock_admin_mode: true) + if use_mock_admin_mode + enable_admin_mode!(user) + else + visit new_admin_session_path + fill_in 'user_password', with: user.password + click_button 'Enter admin mode' + + wait_for_requests + end + end + def gitlab_sign_in_via(provider, user, uid, saml_response = nil) mock_auth_hash_with_saml_xml(provider, uid, user.email, saml_response) visit new_user_session_path diff --git a/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb b/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb index 678199a35ea..c740917cec4 100644 --- a/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb +++ b/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb @@ -7,7 +7,7 @@ RSpec.shared_context 'instance integration activation' do before do sign_in(user) - enable_admin_mode!(user) + gitlab_enable_admin_mode_sign_in(user) end def visit_instance_integrations diff --git a/spec/support/shared_examples/features/inviting_groups_shared_examples.rb b/spec/support/shared_examples/features/inviting_groups_shared_examples.rb index d21e69b72e1..4921676a065 100644 --- a/spec/support/shared_examples/features/inviting_groups_shared_examples.rb +++ b/spec/support/shared_examples/features/inviting_groups_shared_examples.rb @@ -9,7 +9,7 @@ RSpec.shared_examples 'inviting groups search results' do before do sign_in(admin) - enable_admin_mode!(admin) + gitlab_enable_admin_mode_sign_in(admin) end it 'shows groups where the admin has no direct membership' do |