diff options
50 files changed, 531 insertions, 47 deletions
@@ -71,7 +71,7 @@ gem 'omniauth-oauth2-generic', '~> 0.2.2' gem 'omniauth-saml', '~> 2.0.0' gem 'omniauth-twitter', '~> 1.4' gem 'omniauth_crowd', '~> 2.4.0', path: 'vendor/gems/omniauth_crowd' # See vendor/gems/omniauth_crowd/README.md -gem 'omniauth_openid_connect', '~> 0.6.0' +gem 'omniauth_openid_connect', '~> 0.6.1' # Locked until Ruby 3.0 upgrade since upgrading will pull in an updated net-smtp gem. # See https://docs.gitlab.com/ee/development/emails.html#rationale. gem 'openid_connect', '= 1.3.0' diff --git a/Gemfile.checksum b/Gemfile.checksum index 2dbcae42f0f..4ccdddc27d4 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -401,7 +401,7 @@ {"name":"omniauth-oauth2-generic","version":"0.2.8","platform":"ruby","checksum":"ce6e8539019d5ebf2f48867072b9f248f148bb4cbe7166dee655865abfae7613"}, {"name":"omniauth-saml","version":"2.0.0","platform":"ruby","checksum":"02594fd6630de26a9e65a2e64223e9ad32324fa97a6c7f1f22a1553ea3dd44c7"}, {"name":"omniauth-twitter","version":"1.4.0","platform":"ruby","checksum":"c5cc6c77cd767745ffa9ebbd5fbd694a3fa99d1d2d82a4d7def0bf3b6131b264"}, -{"name":"omniauth_openid_connect","version":"0.6.0","platform":"ruby","checksum":"b8e48ca67fdea2dff56cc161855b88707a290ae01125149dbe0f8c94e818cfd3"}, +{"name":"omniauth_openid_connect","version":"0.6.1","platform":"ruby","checksum":"5f1318f5b19b05e339ff494def060b57a503b1e3ea83c3a0ced6cc014407d423"}, {"name":"open4","version":"1.3.4","platform":"ruby","checksum":"a1df037310624ecc1ea1d81264b11c83e96d0c3c1c6043108d37d396dcd0f4b1"}, {"name":"openid_connect","version":"1.3.0","platform":"ruby","checksum":"a796855096850cc01140e37ea6ae9fd14f2be818b9b5bc698418063dfe228770"}, {"name":"openssl","version":"2.2.2","platform":"ruby","checksum":"53f72382bac046c36c37049c7ec9d5597d42628d140b5cfbcd61e0226c0ca077"}, diff --git a/Gemfile.lock b/Gemfile.lock index a3d6dc31fb6..dced424b042 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1025,7 +1025,7 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack - omniauth_openid_connect (0.6.0) + omniauth_openid_connect (0.6.1) omniauth (>= 1.9, < 3) openid_connect (~> 1.1) open4 (1.3.4) @@ -1781,7 +1781,7 @@ DEPENDENCIES omniauth-saml (~> 2.0.0) omniauth-twitter (~> 1.4) omniauth_crowd (~> 2.4.0)! - omniauth_openid_connect (~> 0.6.0) + omniauth_openid_connect (~> 0.6.1) openid_connect (= 1.3.0) openssl (= 2.2.2) org-ruby (~> 0.9.12) diff --git a/app/assets/javascripts/notes/components/comment_field_layout.vue b/app/assets/javascripts/notes/components/comment_field_layout.vue index cc372520c70..02d128eb119 100644 --- a/app/assets/javascripts/notes/components/comment_field_layout.vue +++ b/app/assets/javascripts/notes/components/comment_field_layout.vue @@ -76,7 +76,7 @@ export default { ></div> <noteable-warning v-if="hasWarning" - class="gl-border-b-1 gl-border-b-solid gl-border-b-gray-100 gl-rounded-base gl-rounded-bottom-left-none gl-rounded-bottom-right-none" + class="gl-py-4 gl-border-b-1 gl-border-b-solid gl-border-b-gray-100 gl-rounded-base gl-rounded-bottom-left-none gl-rounded-bottom-right-none" :is-locked="isLocked" :is-confidential="isConfidential" :noteable-type="noteableType" diff --git a/app/assets/javascripts/notes/components/discussion_locked_widget.vue b/app/assets/javascripts/notes/components/discussion_locked_widget.vue index 8ac3f6bea68..bcf9b4cf893 100644 --- a/app/assets/javascripts/notes/components/discussion_locked_widget.vue +++ b/app/assets/javascripts/notes/components/discussion_locked_widget.vue @@ -33,8 +33,10 @@ export default { </script> <template> - <div class="disabled-comment text-center"> - <span class="issuable-note-warning inline"> + <div class="disabled-comments gl-mt-3"> + <span + class="issuable-note-warning gl-display-inline-block gl-w-full gl-px-5 gl-py-4 gl-rounded-base" + > <gl-icon :size="16" name="lock" class="icon" /> <span v-if="isProjectArchived"> {{ projectArchivedWarning }} diff --git a/app/assets/javascripts/super_sidebar/components/user_menu.vue b/app/assets/javascripts/super_sidebar/components/user_menu.vue index 09cf167c285..7700b7fa3f8 100644 --- a/app/assets/javascripts/super_sidebar/components/user_menu.vue +++ b/app/assets/javascripts/super_sidebar/components/user_menu.vue @@ -23,6 +23,7 @@ export default { editStatus: s__('SetStatusModal|Edit status'), editProfile: s__('CurrentUser|Edit profile'), preferences: s__('CurrentUser|Preferences'), + gitlabNext: s__('CurrentUser|Switch to GitLab Next'), }, provideFeedback: s__('NorthstarNavigation|Provide feedback'), startTrial: s__('CurrentUser|Start an Ultimate trial'), @@ -82,6 +83,12 @@ export default { href: this.data.settings.profile_preferences_path, }; }, + gitlabNextItem() { + return { + text: this.$options.i18n.user.gitlabNext, + href: this.data.canary_toggle_com_url, + }; + }, feedbackItem() { return { text: this.$options.i18n.provideFeedback, @@ -169,6 +176,12 @@ export default { <gl-disclosure-dropdown-item :item="editProfileItem" data-testid="edit-profile-item" /> <gl-disclosure-dropdown-item :item="preferencesItem" data-testid="preferences-item" /> + + <gl-disclosure-dropdown-item + v-if="data.gitlab_com_but_not_canary" + :item="gitlabNextItem" + data-testid="gitlab-next-item" + /> </gl-disclosure-dropdown-group> <gl-disclosure-dropdown-group bordered> diff --git a/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue b/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue index f837d025b7f..007dbf8a9eb 100644 --- a/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue +++ b/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue @@ -45,8 +45,10 @@ export default { </script> <template> - <div class="disabled-comment text-center"> - <span class="issuable-note-warning gl-display-inline-block"> + <div class="disabled-comments gl-mt-3"> + <span + class="issuable-note-warning gl-display-inline-block gl-w-full gl-px-5 gl-py-4 gl-rounded-base" + > <gl-icon name="lock" class="gl-mr-2" /> <template v-if="isProjectArchived"> {{ $options.constantOptions.projectArchivedWarning }} diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 04190bc442b..afd55684c65 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -498,6 +498,10 @@ module ProjectsHelper format_cached_count(1000, number) end + def remote_mirror_setting_enabled? + false + end + private def localized_access_names diff --git a/app/helpers/sidebars_helper.rb b/app/helpers/sidebars_helper.rb index 16d9f0dde21..577352bb377 100644 --- a/app/helpers/sidebars_helper.rb +++ b/app/helpers/sidebars_helper.rb @@ -75,7 +75,9 @@ module SidebarsHelper whats_new_version_digest: whats_new_version_digest, show_version_check: show_version_check?, gitlab_version: Gitlab.version_info, - gitlab_version_check: gitlab_version_check + gitlab_version_check: gitlab_version_check, + gitlab_com_but_not_canary: Gitlab.com_but_not_canary?, + canary_toggle_com_url: Gitlab::Saas.canary_toggle_com_url } end diff --git a/app/services/base_container_service.rb b/app/services/base_container_service.rb index 86df0236a7f..f46e8d5ec42 100644 --- a/app/services/base_container_service.rb +++ b/app/services/base_container_service.rb @@ -10,13 +10,17 @@ # the top of the original BaseService. class BaseContainerService include BaseServiceUtility + include ::Gitlab::Utils::StrongMemoize + attr_accessor :project, :group attr_reader :container, :current_user, :params def initialize(container:, current_user: nil, params: {}) @container = container @current_user = current_user @params = params.dup + + handle_container_type(container) end def project_container? @@ -30,4 +34,22 @@ class BaseContainerService def namespace_container? container.is_a?(::Namespace) end + + def project_group + project&.group + end + strong_memoize_attr :project_group + + private + + def handle_container_type(container) + case container + when Project + @project = container + when Group + @group = container + when Namespaces::ProjectNamespace + @project = container.project + end + end end diff --git a/app/services/issuable/clone/base_service.rb b/app/services/issuable/clone/base_service.rb index 02beaaf5d83..a4e815e70fc 100644 --- a/app/services/issuable/clone/base_service.rb +++ b/app/services/issuable/clone/base_service.rb @@ -7,11 +7,6 @@ module Issuable alias_method :old_project, :project - # TODO: this is to be removed once we get to rename the IssuableBaseService project param to container - def initialize(container:, current_user: nil, params: {}) - super(project: container, current_user: current_user, params: params) - end - def execute(original_entity, target_parent) @original_entity = original_entity @target_parent = target_parent diff --git a/app/services/issuable/destroy_service.rb b/app/services/issuable/destroy_service.rb index 4c3e518d62b..261afb767bb 100644 --- a/app/services/issuable/destroy_service.rb +++ b/app/services/issuable/destroy_service.rb @@ -4,7 +4,7 @@ module Issuable class DestroyService < IssuableBaseService # TODO: this is to be removed once we get to rename the IssuableBaseService project param to container def initialize(container:, current_user: nil, params: {}) - super(project: container, current_user: current_user, params: params) + super(container: container, current_user: current_user, params: params) end def execute(issuable) diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 911d04d6b7a..c630d01cd84 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class IssuableBaseService < ::BaseProjectService +class IssuableBaseService < ::BaseContainerService private def self.constructor_container_arg(value) @@ -10,13 +10,15 @@ class IssuableBaseService < ::BaseProjectService # Follow on issue to address this: # https://gitlab.com/gitlab-org/gitlab/-/issues/328438 - { project: value } + { container: value } end attr_accessor :params, :skip_milestone_email - def initialize(project:, current_user: nil, params: {}) - super + def initialize(container:, current_user: nil, params: {}) + # we need to exclude project params since they may come from external requests. project should always + # be passed as part of the service's initializer + super(container: container, current_user: current_user, params: params.except(:project, :project_id)) @skip_milestone_email = @params.delete(:skip_milestone_email) end diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index fa46ba748e8..75ef9f735ab 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -6,10 +6,6 @@ module Issues include IncidentManagement::UsageData include IssueTypeHelpers - def initialize(container:, current_user: nil, params: {}) - super(project: container, current_user: current_user, params: params) - end - def hook_data(issue, action, old_associations: {}) hook_data = issue.to_hook_data(current_user, old_associations: old_associations) hook_data[:object_attributes][:action] = action diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index f03599242c1..ec5f9ea8167 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -18,7 +18,7 @@ module Issues super(container: container, current_user: current_user, params: params) @spam_params = spam_params @build_service = build_service || - BuildService.new(container: container, current_user: current_user, params: params) + BuildService.new(container: project, current_user: current_user, params: params) end def execute(skip_system_notes: false) diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index f6cbe889128..97ca96043fb 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -5,6 +5,12 @@ module MergeRequests extend ::Gitlab::Utils::Override include MergeRequests::AssignsMergeParams + delegate :repository, to: :project + + def initialize(project:, current_user: nil, params: {}) + super(container: project, current_user: current_user, params: params) + end + def create_note(merge_request, state = merge_request.state) SystemNoteService.change_status(merge_request, merge_request.target_project, current_user, state, nil) end @@ -94,6 +100,10 @@ module MergeRequests private + def self.constructor_container_arg(value) + { project: value } + end + def refresh_pipelines_on_merge_requests(merge_request, allow_duplicate: false) create_pipeline_for(merge_request, current_user, async: true, allow_duplicate: allow_duplicate) end diff --git a/app/services/tasks_to_be_done/base_service.rb b/app/services/tasks_to_be_done/base_service.rb index 5851a2cb9e5..ba52e9abeb2 100644 --- a/app/services/tasks_to_be_done/base_service.rb +++ b/app/services/tasks_to_be_done/base_service.rb @@ -11,7 +11,7 @@ module TasksToBeDone description: description, add_labels: label_name } - super(project: container, current_user: current_user, params: params) + super(container: container, current_user: current_user, params: params) end def execute diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index a089dd60e7d..b493a8d0ce8 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -8,7 +8,7 @@ .project-edit-errors = render 'projects/errors' - .js-new-project-creation{ data: { is_ci_cd_available: (ci_cd_projects_available? if Gitlab.ee?).to_s, has_errors: @project.errors.any?.to_s, new_project_guidelines: brand_new_project_guidelines, push_to_create_project_command: push_to_create_project_command, working_with_projects_help_path: help_page_path("user/project/working_with_projects"), parent_group_url: @project.parent && group_url(@project.parent), parent_group_name: @project.parent&.name } } + .js-new-project-creation{ data: { is_ci_cd_available: remote_mirror_setting_enabled?.to_s, has_errors: @project.errors.any?.to_s, new_project_guidelines: brand_new_project_guidelines, push_to_create_project_command: push_to_create_project_command, working_with_projects_help_path: help_page_path("user/project/working_with_projects"), parent_group_url: @project.parent && group_url(@project.parent), parent_group_name: @project.parent&.name } } .row{ 'v-cloak': true } #blank-project-pane.tab-pane.active diff --git a/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb b/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb new file mode 100644 index 00000000000..36e2f0f34f3 --- /dev/null +++ b/db/post_migrate/20230222101420_remove_fk_to_ci_build_ci_pending_build_on_build_id.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class RemoveFkToCiBuildCiPendingBuildOnBuildId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + SOURCE_TABLE_NAME = :ci_pending_builds + TARGET_TABLE_NAME = :ci_builds + COLUMN = :build_id + TARGET_COLUMN = :id + FK_NAME = :fk_rails_725a2644a3 + + def up + with_lock_retries do + remove_foreign_key_if_exists( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + name: FK_NAME, + reverse_lock_order: true + ) + end + end + + def down + add_concurrent_foreign_key( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + column: COLUMN, + target_column: TARGET_COLUMN, + validate: true, + reverse_lock_order: true, + on_delete: :cascade, + name: FK_NAME + ) + end +end diff --git a/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb b/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb new file mode 100644 index 00000000000..d3cbfa649c3 --- /dev/null +++ b/db/post_migrate/20230222102421_remove_fk_to_ci_build_ci_running_build_on_build_id.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +class RemoveFkToCiBuildCiRunningBuildOnBuildId < Gitlab::Database::Migration[2.1] + disable_ddl_transaction! + + SOURCE_TABLE_NAME = :ci_running_builds + TARGET_TABLE_NAME = :ci_builds + COLUMN = :build_id + TARGET_COLUMN = :id + FK_NAME = :fk_rails_da45cfa165 + + def up + with_lock_retries do + remove_foreign_key_if_exists( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + name: FK_NAME, + reverse_lock_order: true + ) + end + end + + def down + add_concurrent_foreign_key( + SOURCE_TABLE_NAME, + TARGET_TABLE_NAME, + column: COLUMN, + target_column: TARGET_COLUMN, + validate: true, + reverse_lock_order: true, + on_delete: :cascade, + name: FK_NAME + ) + end +end diff --git a/db/schema_migrations/20230222101420 b/db/schema_migrations/20230222101420 new file mode 100644 index 00000000000..f0cd65454ac --- /dev/null +++ b/db/schema_migrations/20230222101420 @@ -0,0 +1 @@ +74413d13062dd7a48d07f9839b4a22db3f7358cffda403a036dfa1686fb693c8
\ No newline at end of file diff --git a/db/schema_migrations/20230222102421 b/db/schema_migrations/20230222102421 new file mode 100644 index 00000000000..2b186e0e34a --- /dev/null +++ b/db/schema_migrations/20230222102421 @@ -0,0 +1 @@ +52ca4df8ee309791bb7fc4078a1298555b962137f1d07585e361b008d591164c
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 34b480a90ed..335ce18eb3b 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -35655,9 +35655,6 @@ ALTER TABLE ONLY project_custom_attributes ADD CONSTRAINT fk_rails_719c3dccc5 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; ALTER TABLE ONLY ci_pending_builds - ADD CONSTRAINT fk_rails_725a2644a3 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; - -ALTER TABLE ONLY ci_pending_builds ADD CONSTRAINT fk_rails_725a2644a3_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE security_findings @@ -36330,9 +36327,6 @@ ALTER TABLE ONLY merge_request_reviewers ADD CONSTRAINT fk_rails_d9fec24b9d FOREIGN KEY (merge_request_id) REFERENCES merge_requests(id) ON DELETE CASCADE; ALTER TABLE ONLY ci_running_builds - ADD CONSTRAINT fk_rails_da45cfa165 FOREIGN KEY (build_id) REFERENCES ci_builds(id) ON DELETE CASCADE; - -ALTER TABLE ONLY ci_running_builds ADD CONSTRAINT fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE; ALTER TABLE ONLY jira_imports diff --git a/doc/administration/packages/container_registry.md b/doc/administration/packages/container_registry.md index f96b2c7e490..fa12246b147 100644 --- a/doc/administration/packages/container_registry.md +++ b/doc/administration/packages/container_registry.md @@ -627,6 +627,8 @@ storage: trimlegacyrootprefix: true ``` +By default, Azure Storage Driver uses the `core.windows.net` realm. You can set another value for `realm` in the `azure` section (for example, `core.usgovcloudapi.net` for Azure Government Cloud). For more information, see the [Docker documentation](https://docs.docker.com/registry/storage-drivers/azure/). + ### Disable redirect for storage driver By default, users accessing a registry configured with a remote backend are redirected to the default backend for the storage driver. For example, registries can be configured using the `s3` storage driver, which redirects requests to a remote S3 bucket to alleviate load on the GitLab server. diff --git a/doc/ci/large_repositories/index.md b/doc/ci/large_repositories/index.md index 5a553228ba1..f728e9b9e17 100644 --- a/doc/ci/large_repositories/index.md +++ b/doc/ci/large_repositories/index.md @@ -255,7 +255,7 @@ For very active repositories with a large number of references and files, you ca enabled on all Gitaly servers, we found that we no longer need a pre-clone step for `gitlab-org/gitlab` development. - Optimize your CI/CD jobs by seeding repository data in a pre-clone step with the [`pre_clone_script`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section) of GitLab Runner. See - [SaaS runners on Linux](../runners/saas/linux_saas_runner.md#pre-clone-script) for details. + [SaaS runners on Linux](../runners/saas/linux_saas_runner.md#pre-clone-script-deprecated) for details. Besides speeding up pipelines in large and active projects, seeding the repository data also helps avoid `429 Too many requests` errors from Cloudflare. diff --git a/doc/ci/runners/saas/linux_saas_runner.md b/doc/ci/runners/saas/linux_saas_runner.md index 58c8a6d0815..da78f7f911c 100644 --- a/doc/ci/runners/saas/linux_saas_runner.md +++ b/doc/ci/runners/saas/linux_saas_runner.md @@ -92,8 +92,11 @@ The final disk space your jobs can use is less than 25 GB. Some disk space allocated to the instance is occupied by the operating system, the Docker image, and a copy of your cloned repository. -## Pre-clone script +## Pre-clone script (deprecated) +WARNING: +This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/391896) in GitLab 15.9 +and is planned for removal in 15.11. Use [`pre_get_sources_script`](../../../ci/yaml/index.md#hookspre_get_sources_script) instead. This change is a breaking change. With SaaS runners on Linux, you can run commands in a CI/CD job before the runner attempts to run `git init` and `git fetch` to download a GitLab repository. The diff --git a/doc/ci/runners/saas/macos/environment.md b/doc/ci/runners/saas/macos/environment.md index 1fc7afea7e6..7aa0f33fc59 100644 --- a/doc/ci/runners/saas/macos/environment.md +++ b/doc/ci/runners/saas/macos/environment.md @@ -20,11 +20,11 @@ Each time you run a job that requires tooling or dependencies not available in t GitLab SaaS provides macOS build machines on Apple servers with Intel x86-64 processors. The expectation is that virtual machines running on the Apple M1 chip will be available in the second half of 2022. -At this time there is only one available machine type offered, `gbc-macos-large`. +At this time there is only one available machine type offered, `shared-macos-amd64`. | Instance type | vCPUS | Memory (GB) | | --------- | --- | ------- | -| `gbc-macos-large` | 4 | 10 | +| `shared-macos-amd64` | 4 | 10 | ## VM images diff --git a/doc/development/pipelines/performance.md b/doc/development/pipelines/performance.md index 5f2df91edf3..d0eef0c86bd 100644 --- a/doc/development/pipelines/performance.md +++ b/doc/development/pipelines/performance.md @@ -147,4 +147,4 @@ We no longer use this optimization for `gitlab-org/gitlab` because the [pack-obj allows Gitaly to serve the full CI/CD fetch traffic now. See [Git fetch caching](#git-fetch-caching). The pre-clone step works by using the `CI_PRE_CLONE_SCRIPT` variable -[defined by GitLab.com shared runners](../../ci/runners/saas/linux_saas_runner.md#pre-clone-script). +[defined by GitLab.com shared runners](../../ci/runners/saas/linux_saas_runner.md#pre-clone-script-deprecated). diff --git a/doc/user/project/issues/create_issues.md b/doc/user/project/issues/create_issues.md index 5ebb2fc2e1c..b6931149ede 100644 --- a/doc/user/project/issues/create_issues.md +++ b/doc/user/project/issues/create_issues.md @@ -100,7 +100,7 @@ To create an issue from a project issue board: 1. On the top bar, select **Main menu > Projects** and find your project. 1. Select **Issues > Boards**. -1. At the top of a board list, select **New issue** (**{plus-square}**). +1. At the top of a board list, select **List actions** (**{ellipsis_v}**) **> Create new issue**. 1. Enter the issue's title. 1. Select **Create issue**. @@ -108,7 +108,7 @@ To create an issue from a group issue board: 1. On the top bar, select **Main menu > Groups** and find your group. 1. Select **Issues > Boards**. -1. At the top of a board list, select **New issue** (**{plus-square}**). +1. At the top of a board list, select **List actions** (**{ellipsis_v}**) **> Create new issue**. 1. Enter the issue's title. 1. Under **Projects**, select the project in the group that the issue should belong to. 1. Select **Create issue**. @@ -118,9 +118,6 @@ example, if the list is scoped to a label `Frontend`, the new issue also has thi ## By sending an email -> - Generated email address format changed in GitLab 11.7. -> - The older format is still supported, so existing aliases and contacts still work. - You can send an email to create an issue in a project on the project's **Issues List** page. diff --git a/lib/generators/batched_background_migration/USAGE b/lib/generators/batched_background_migration/USAGE new file mode 100644 index 00000000000..9e93385fa94 --- /dev/null +++ b/lib/generators/batched_background_migration/USAGE @@ -0,0 +1,11 @@ +Description: + Generates files required for batched background migration. + +Example: + rails g batched_background_migration my_batched_migration --table_name=users --column_name=id --feature_category=gitaly + + This will create: + db/post_migrate/20230213215230_queue_my_batched_migration.rb + spec/migrations/20230213215230_queue_my_batched_migration_spec.rb + lib/gitlab/background_migration/my_batched_migration.rb + spec/lib/gitlab/background_migration/my_batched_migration_spec.rb diff --git a/lib/generators/batched_background_migration/batched_background_migration_generator.rb b/lib/generators/batched_background_migration/batched_background_migration_generator.rb new file mode 100644 index 00000000000..7b62cd47899 --- /dev/null +++ b/lib/generators/batched_background_migration/batched_background_migration_generator.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require 'rails/generators/active_record' + +module BatchedBackgroundMigration + class BatchedBackgroundMigrationGenerator < ActiveRecord::Generators::Base + source_root File.expand_path('templates', __dir__) + + class_option :table_name + class_option :column_name + class_option :feature_category + + def validate! + raise ArgumentError, "table_name is required" unless table_name.present? + raise ArgumentError, "column_name is required" unless column_name.present? + raise ArgumentError, "feature_category is required" unless feature_category.present? + end + + def create_post_migration_and_specs + migration_template( + "queue_batched_background_migration.template", + File.join(db_migrate_path, "queue_#{file_name}.rb") + ) + + template( + "queue_batched_background_migration_spec.template", + File.join("spec/migrations/#{migration_number}_queue_#{file_name}_spec.rb") + ) + end + + def create_batched_background_migration_class_and_specs + template( + "batched_background_migration_job.template", + File.join("lib/gitlab/background_migration/#{file_name}.rb") + ) + + template( + "batched_background_migration_job_spec.template", + File.join("spec/lib/gitlab/background_migration/#{file_name}_spec.rb") + ) + end + + def db_migrate_path + super.sub("migrate", "post_migrate") + end + + private + + def table_name + options[:table_name] + end + + def column_name + options[:column_name] + end + + def feature_category + options[:feature_category] + end + end +end diff --git a/lib/generators/batched_background_migration/templates/batched_background_migration_job.template b/lib/generators/batched_background_migration/templates/batched_background_migration_job.template new file mode 100644 index 00000000000..c57ac637cb8 --- /dev/null +++ b/lib/generators/batched_background_migration/templates/batched_background_migration_job.template @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/database/batched_background_migrations.html +# for more information on how to use batched background migrations + +# Update below commented lines with appropriate values. + +module Gitlab + module BackgroundMigration + class <%= class_name %> < BatchedMigrationJob + # operation_name :my_operation + # scope_to ->(relation) { relation.where(column: "value") } + feature_category :<%= feature_category %> + + def perform + each_sub_batch do |sub_batch| + # Your action on each sub_batch + end + end + end + end +end diff --git a/lib/generators/batched_background_migration/templates/batched_background_migration_job_spec.template b/lib/generators/batched_background_migration/templates/batched_background_migration_job_spec.template new file mode 100644 index 00000000000..c41b8107c95 --- /dev/null +++ b/lib/generators/batched_background_migration/templates/batched_background_migration_job_spec.template @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::BackgroundMigration::<%= class_name %>, schema: <%= migration_number %>, feature_category: :<%= feature_category %> do # rubocop:disable Layout/LineLength + # Tests go here +end diff --git a/lib/generators/batched_background_migration/templates/queue_batched_background_migration.template b/lib/generators/batched_background_migration/templates/queue_batched_background_migration.template new file mode 100644 index 00000000000..502edf2c1d7 --- /dev/null +++ b/lib/generators/batched_background_migration/templates/queue_batched_background_migration.template @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/database/batched_background_migrations.html +# for more information on when/how to queue batched background migrations + +# Update below commented lines with appropriate values. + +class <%= migration_class_name %> < Gitlab::Database::Migration[<%= Gitlab::Database::Migration.current_version %>] + MIGRATION = "<%= class_name %>" + # DELAY_INTERVAL = 2.minutes + # BATCH_SIZE = <%= Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::BATCH_SIZE %> + # SUB_BATCH_SIZE = <%= Gitlab::Database::Migrations::BatchedBackgroundMigrationHelpers::SUB_BATCH_SIZE %> + + def up + queue_batched_background_migration( + MIGRATION, + :<%= table_name %>, + :<%= column_name %>, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :<%= table_name.to_sym %>, :<%= column_name.to_sym %>, []) + end +end diff --git a/lib/generators/batched_background_migration/templates/queue_batched_background_migration_spec.template b/lib/generators/batched_background_migration/templates/queue_batched_background_migration_spec.template new file mode 100644 index 00000000000..e0a3078114e --- /dev/null +++ b/lib/generators/batched_background_migration/templates/queue_batched_background_migration_spec.template @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe <%= migration_class_name %>, feature_category: :<%= feature_category.to_sym %> do + # let!(:batched_migration) { described_class::MIGRATION } + + # it 'schedules a new batched migration' do + # reversible_migration do |migration| + # migration.before -> { + # expect(batched_migration).not_to have_scheduled_batched_migration + # } + + # migration.after -> { + # expect(batched_migration).to have_scheduled_batched_migration( + # table_name: :<%= table_name %>, + # column_name: :<%= column_name %>, + # interval: described_class::DELAY_INTERVAL, + # batch_size: described_class::BATCH_SIZE, + # sub_batch_size: described_class::SUB_BATCH_SIZE + # ) + # } + # end + # end +end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 53fd5ef720f..d6d849a15fe 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -12337,6 +12337,9 @@ msgstr "" msgid "CurrentUser|Start an Ultimate trial" msgstr "" +msgid "CurrentUser|Switch to GitLab Next" +msgstr "" + msgid "Currently unable to fetch data for this pipeline." msgstr "" diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 45b2d259bfd..6a7539aeb2f 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -43,12 +43,12 @@ RSpec.describe 'Database schema', feature_category: :database do ci_job_artifacts: %w[partition_id job_id], ci_job_variables: %w[partition_id], ci_namespace_monthly_usages: %w[namespace_id], - ci_pending_builds: %w[partition_id], + ci_pending_builds: %w[partition_id build_id], ci_pipeline_variables: %w[partition_id], ci_pipelines: %w[partition_id], ci_resources: %w[partition_id build_id], ci_runner_projects: %w[runner_id], - ci_running_builds: %w[partition_id], + ci_running_builds: %w[partition_id build_id], ci_sources_pipelines: %w[partition_id source_partition_id], ci_stages: %w[partition_id], ci_trigger_requests: %w[commit_id], diff --git a/spec/features/issues/discussion_lock_spec.rb b/spec/features/issues/discussion_lock_spec.rb index 33fc9a6fd96..47865d2b6ba 100644 --- a/spec/features/issues/discussion_lock_spec.rb +++ b/spec/features/issues/discussion_lock_spec.rb @@ -99,7 +99,7 @@ RSpec.describe 'Discussion Lock', :js, feature_category: :team_planning do it 'the user can not create a comment' do page.within('#notes') do expect(page).not_to have_selector('js-main-target-form') - expect(page.find('.disabled-comment')) + expect(page.find('.disabled-comments')) .to have_content('This issue is locked. Only project members can comment.') end end diff --git a/spec/frontend/super_sidebar/components/user_menu_spec.js b/spec/frontend/super_sidebar/components/user_menu_spec.js index 9641cc40cc5..8fad65ff29e 100644 --- a/spec/frontend/super_sidebar/components/user_menu_spec.js +++ b/spec/frontend/super_sidebar/components/user_menu_spec.js @@ -176,6 +176,25 @@ describe('UserMenu component', () => { }); }); + describe('GitLab Next item', () => { + describe('on gitlab.com', () => { + it('should render a link to switch to GitLab Next', () => { + createWrapper({ gitlab_com_but_not_canary: true }); + const item = wrapper.findByTestId('gitlab-next-item'); + expect(item.text()).toBe(UserMenu.i18n.user.gitlabNext); + expect(item.find('a').attributes('href')).toBe(userMenuMockData.canary_toggle_com_url); + }); + }); + + describe('anywhere else', () => { + it('should not render the GitLab Next link', () => { + createWrapper({ gitlab_com_but_not_canary: false }); + const item = wrapper.findByTestId('gitlab-next-item'); + expect(item.exists()).toBe(false); + }); + }); + }); + describe('New navigation toggle item', () => { it('should render menu item with new navigation toggle', () => { createWrapper(); diff --git a/spec/frontend/super_sidebar/mock_data.js b/spec/frontend/super_sidebar/mock_data.js index d8a6ae85f0d..df830b63b81 100644 --- a/spec/frontend/super_sidebar/mock_data.js +++ b/spec/frontend/super_sidebar/mock_data.js @@ -109,4 +109,6 @@ export const userMenuMockData = { }, can_sign_out: false, sign_out_link: invalidUrl, + gitlab_com_but_not_canary: true, + canary_toggle_com_url: 'https://next.gitlab.com', }; diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 477b5cd7753..3c8a692b0b3 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -1378,4 +1378,10 @@ RSpec.describe ProjectsHelper, feature_category: :source_code_management do end end end + + describe '#remote_mirror_setting_enabled?' do + it 'returns false' do + expect(helper.remote_mirror_setting_enabled?).to be_falsy + end + end end diff --git a/spec/helpers/sidebars_helper_spec.rb b/spec/helpers/sidebars_helper_spec.rb index 1e1087e72f6..fa4d4071e37 100644 --- a/spec/helpers/sidebars_helper_spec.rb +++ b/spec/helpers/sidebars_helper_spec.rb @@ -121,7 +121,9 @@ RSpec.describe SidebarsHelper, feature_category: :navigation do whats_new_version_digest: helper.whats_new_version_digest, show_version_check: helper.show_version_check?, gitlab_version: Gitlab.version_info, - gitlab_version_check: helper.gitlab_version_check + gitlab_version_check: helper.gitlab_version_check, + gitlab_com_but_not_canary: Gitlab.com_but_not_canary?, + canary_toggle_com_url: Gitlab::Saas.canary_toggle_com_url }) end diff --git a/spec/lib/generators/batched_background_migration/batched_background_migration_generator_spec.rb b/spec/lib/generators/batched_background_migration/batched_background_migration_generator_spec.rb new file mode 100644 index 00000000000..957be21f5eb --- /dev/null +++ b/spec/lib/generators/batched_background_migration/batched_background_migration_generator_spec.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'rails/generators/testing/behaviour' +require 'rails/generators/testing/assertions' + +RSpec.describe BatchedBackgroundMigration::BatchedBackgroundMigrationGenerator, feature_category: :database do + include Rails::Generators::Testing::Behaviour + include Rails::Generators::Testing::Assertions + include FileUtils + + tests described_class + destination File.expand_path('tmp', __dir__) + + before do + prepare_destination + end + + after do + rm_rf(destination_root) + end + + context 'with valid arguments' do + let(:expected_migration_file) { load_expected_file('queue_my_batched_migration.txt') } + let(:expected_migration_spec_file) { load_expected_file('queue_my_batched_migration_spec.txt') } + let(:expected_migration_job_file) { load_expected_file('my_batched_migration.txt') } + let(:expected_migration_job_spec_file) { load_expected_file('my_batched_migration_spec_matcher.txt') } + + it 'generates expected files' do + run_generator %w[my_batched_migration --table_name=projects --column_name=id --feature_category=database] + + assert_migration('db/post_migrate/queue_my_batched_migration.rb') do |migration_file| + expect(migration_file).to eq(expected_migration_file) + end + + assert_migration('spec/migrations/queue_my_batched_migration_spec.rb') do |migration_spec_file| + expect(migration_spec_file).to eq(expected_migration_spec_file) + end + + assert_file('lib/gitlab/background_migration/my_batched_migration.rb') do |migration_job_file| + expect(migration_job_file).to eq(expected_migration_job_file) + end + + assert_file('spec/lib/gitlab/background_migration/my_batched_migration_spec.rb') do |migration_job_spec_file| + # Regex is used to match the dynamic schema: <version> in the specs + expect(migration_job_spec_file).to match(/#{expected_migration_job_spec_file}/) + end + end + end + + context 'without required arguments' do + it 'throws table_name is required error' do + expect do + run_generator %w[my_batched_migration] + end.to raise_error(ArgumentError, 'table_name is required') + end + + it 'throws column_name is required error' do + expect do + run_generator %w[my_batched_migration --table_name=projects] + end.to raise_error(ArgumentError, 'column_name is required') + end + + it 'throws feature_category is required error' do + expect do + run_generator %w[my_batched_migration --table_name=projects --column_name=id] + end.to raise_error(ArgumentError, 'feature_category is required') + end + end + + private + + def load_expected_file(file_name) + File.read(File.expand_path("expected_files/#{file_name}", __dir__)) + end +end diff --git a/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt b/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt new file mode 100644 index 00000000000..b2378b414b1 --- /dev/null +++ b/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration.txt @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/database/batched_background_migrations.html +# for more information on how to use batched background migrations + +# Update below commented lines with appropriate values. + +module Gitlab + module BackgroundMigration + class MyBatchedMigration < BatchedMigrationJob + # operation_name :my_operation + # scope_to ->(relation) { relation.where(column: "value") } + feature_category :database + + def perform + each_sub_batch do |sub_batch| + # Your action on each sub_batch + end + end + end + end +end diff --git a/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration_spec_matcher.txt b/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration_spec_matcher.txt new file mode 100644 index 00000000000..2728d65d54b --- /dev/null +++ b/spec/lib/generators/batched_background_migration/expected_files/my_batched_migration_spec_matcher.txt @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::BackgroundMigration::MyBatchedMigration, schema: [0-9]+, feature_category: :database do # rubocop:disable Layout/LineLength + # Tests go here +end diff --git a/spec/lib/generators/batched_background_migration/expected_files/queue_my_batched_migration.txt b/spec/lib/generators/batched_background_migration/expected_files/queue_my_batched_migration.txt new file mode 100644 index 00000000000..536e07d56aa --- /dev/null +++ b/spec/lib/generators/batched_background_migration/expected_files/queue_my_batched_migration.txt @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/database/batched_background_migrations.html +# for more information on when/how to queue batched background migrations + +# Update below commented lines with appropriate values. + +class QueueMyBatchedMigration < Gitlab::Database::Migration[2.1] + MIGRATION = "MyBatchedMigration" + # DELAY_INTERVAL = 2.minutes + # BATCH_SIZE = 1000 + # SUB_BATCH_SIZE = 100 + + def up + queue_batched_background_migration( + MIGRATION, + :projects, + :id, + job_interval: DELAY_INTERVAL, + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :projects, :id, []) + end +end diff --git a/spec/lib/generators/batched_background_migration/expected_files/queue_my_batched_migration_spec.txt b/spec/lib/generators/batched_background_migration/expected_files/queue_my_batched_migration_spec.txt new file mode 100644 index 00000000000..6f33de4ae83 --- /dev/null +++ b/spec/lib/generators/batched_background_migration/expected_files/queue_my_batched_migration_spec.txt @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe QueueMyBatchedMigration, feature_category: :database do + # let!(:batched_migration) { described_class::MIGRATION } + + # it 'schedules a new batched migration' do + # reversible_migration do |migration| + # migration.before -> { + # expect(batched_migration).not_to have_scheduled_batched_migration + # } + + # migration.after -> { + # expect(batched_migration).to have_scheduled_batched_migration( + # table_name: :projects, + # column_name: :id, + # interval: described_class::DELAY_INTERVAL, + # batch_size: described_class::BATCH_SIZE, + # sub_batch_size: described_class::SUB_BATCH_SIZE + # ) + # } + # end + # end +end diff --git a/spec/services/issues/base_service_spec.rb b/spec/services/issues/base_service_spec.rb new file mode 100644 index 00000000000..94165d557d8 --- /dev/null +++ b/spec/services/issues/base_service_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Issues::BaseService, feature_category: :team_planning do + describe '#constructor_container_arg' do + it { expect(described_class.constructor_container_arg("some-value")).to eq({ container: "some-value" }) } + end +end diff --git a/spec/services/issues/issuable_base_service_spec.rb b/spec/services/issues/issuable_base_service_spec.rb new file mode 100644 index 00000000000..e1680d5c908 --- /dev/null +++ b/spec/services/issues/issuable_base_service_spec.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe IssuableBaseService, feature_category: :team_planning do + describe '#constructor_container_arg' do + it { expect(described_class.constructor_container_arg("some-value")).to eq({ container: "some-value" }) } + end +end diff --git a/spec/services/merge_requests/base_service_spec.rb b/spec/services/merge_requests/base_service_spec.rb index bd907ba6015..deabb1c9804 100644 --- a/spec/services/merge_requests/base_service_spec.rb +++ b/spec/services/merge_requests/base_service_spec.rb @@ -123,4 +123,8 @@ RSpec.describe MergeRequests::BaseService, feature_category: :code_review_workfl end end end + + describe '#constructor_container_arg' do + it { expect(described_class.constructor_container_arg("some-value")).to eq({ project: "some-value" }) } + end end |