diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index ab8671d3cb2..9939279407b 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -24,10 +24,6 @@ .decomposed-database-rspec: extends: .decomposed-database - variables: - # For decomposition phase 3, uncomment line below: - # GITLAB_LOAD_BALANCING_REUSE_PRIMARY_ci: "main" - GITLAB_USE_MODEL_LOAD_BALANCING: "true" .rspec-base: extends: @@ -381,6 +377,8 @@ db:migrate:reset decomposed: - db:migrate:reset - .decomposed-database - .rails:rules:decomposed-databases + variables: + GITLAB_USE_MODEL_LOAD_BALANCING: "false" db:migrate-from-previous-major-version: extends: .db-job-base @@ -389,6 +387,7 @@ db:migrate-from-previous-major-version: SETUP_DB: "false" PROJECT_TO_CHECKOUT: "gitlab-foss" TAG_TO_CHECKOUT: "v13.12.9" + GITLAB_USE_MODEL_LOAD_BALANCING: "false" before_script: - !reference [.default-before_script, before_script] - '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab"' diff --git a/.rubocop_todo/graphql/field_method.yml b/.rubocop_todo/graphql/field_method.yml index 7c336451c41..6a05b3c23b8 100644 --- a/.rubocop_todo/graphql/field_method.yml +++ b/.rubocop_todo/graphql/field_method.yml @@ -1,8 +1,4 @@ --- GraphQL/FieldMethod: Exclude: - - app/graphql/types/ci/job_type.rb - - app/graphql/types/merge_request_type.rb - - app/graphql/types/metrics/dashboards/annotation_type.rb - app/graphql/types/packages/package_details_type.rb - - app/graphql/types/project_type.rb diff --git a/app/assets/javascripts/security_configuration/graphql/security_training_vulnerability.query.graphql b/app/assets/javascripts/security_configuration/graphql/security_training_vulnerability.query.graphql index 0d44040e40d..2edaa685a18 100644 --- a/app/assets/javascripts/security_configuration/graphql/security_training_vulnerability.query.graphql +++ b/app/assets/javascripts/security_configuration/graphql/security_training_vulnerability.query.graphql @@ -1,5 +1,5 @@ query getSecurityTrainingVulnerability($id: ID!) { - vulnerability(id: $id) { + vulnerability(id: $id) @client { id identifiers { externalType diff --git a/app/assets/javascripts/terraform/components/empty_state.vue b/app/assets/javascripts/terraform/components/empty_state.vue index a5a613b7282..fd9177bef3f 100644 --- a/app/assets/javascripts/terraform/components/empty_state.vue +++ b/app/assets/javascripts/terraform/components/empty_state.vue @@ -16,7 +16,7 @@ export default { }, computed: { docsUrl() { - return helpPagePath('user/infrastructure/terraform_state'); + return helpPagePath('user/infrastructure/iac/terraform_state'); }, }, }; diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 47e1b93687d..83054553bd8 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -61,7 +61,7 @@ module Types field :coverage, GraphQL::Types::Float, null: true, description: 'Coverage level of the job.' field :created_by_tag, GraphQL::Types::Boolean, null: false, - description: 'Whether the job was created by a tag.' + description: 'Whether the job was created by a tag.', method: :tag? field :detailed_status, Types::Ci::DetailedStatusType, null: true, description: 'Detailed status of the job.' field :downstream_pipeline, Types::Ci::PipelineType, null: true, @@ -173,10 +173,6 @@ module Types object&.coverage end - def created_by_tag - object.tag? - end - def manual_job object.try(:action?) end diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index da73d2c3c10..95b7438460d 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -179,7 +179,7 @@ module Types description: 'Total time reported as spent on the merge request.' field :approved_by, Types::UserType.connection_type, null: true, - description: 'Users who approved the merge request.' + description: 'Users who approved the merge request.', method: :approved_by_users field :auto_merge_strategy, GraphQL::Types::String, null: true, description: 'Selected auto merge strategy.' field :available_auto_merge_strategies, [GraphQL::Types::String], null: true, calls_gitaly: true, @@ -208,10 +208,6 @@ module Types markdown_field :title_html, null: true markdown_field :description_html, null: true - def approved_by - object.approved_by_users - end - def user_notes_count BatchLoader::GraphQL.for(object.id).batch(key: :merge_request_user_notes_count) do |ids, loader, args| counts = Note.count_for_collection(ids, 'MergeRequest').index_by(&:noteable_id) diff --git a/app/graphql/types/metrics/dashboards/annotation_type.rb b/app/graphql/types/metrics/dashboards/annotation_type.rb index 0c787476f54..0621cf4d674 100644 --- a/app/graphql/types/metrics/dashboards/annotation_type.rb +++ b/app/graphql/types/metrics/dashboards/annotation_type.rb @@ -14,17 +14,14 @@ module Types description: 'ID of the annotation.' field :panel_id, GraphQL::Types::String, null: true, - description: 'ID of a dashboard panel to which the annotation should be scoped.' + description: 'ID of a dashboard panel to which the annotation should be scoped.', + method: :panel_xid field :starting_at, Types::TimeType, null: true, description: 'Timestamp marking start of annotated time span.' field :ending_at, Types::TimeType, null: true, description: 'Timestamp marking end of annotated time span.' - - def panel_id - object.panel_xid - end end end end diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 40fc99f493a..47e9a6c11fc 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -32,10 +32,10 @@ module Types field :tag_list, GraphQL::Types::String, null: true, deprecated: { reason: 'Use `topics`', milestone: '13.12' }, - description: 'List of project topics (not Git tags).' + description: 'List of project topics (not Git tags).', method: :topic_list field :topics, [GraphQL::Types::String], null: true, - description: 'List of project topics.' + description: 'List of project topics.', method: :topic_list field :http_url_to_repo, GraphQL::Types::String, null: true, description: 'URL to connect to the project via HTTPS.' @@ -461,14 +461,6 @@ module Types object.service_desk_address end - def tag_list - object.topic_list - end - - def topics - object.topic_list - end - private def project diff --git a/data/deprecations/templates/14-9-deprecation-htpassword-authentication-container-registry.yml b/data/deprecations/templates/14-9-deprecation-htpassword-authentication-container-registry.yml new file mode 100644 index 00000000000..14c6b235a1a --- /dev/null +++ b/data/deprecations/templates/14-9-deprecation-htpassword-authentication-container-registry.yml @@ -0,0 +1,11 @@ +- name: "htpasswd Authentication for the Container Registry" + announcement_milestone: "14.9" + announcement_date: "2022-03-22" + removal_milestone: "15.0" + removal_date: "2022-05-22" + breaking_change: true + reporter: trizzi + body: | # Do not modify this line, instead modify the lines below. + The Container Registry supports [authentication](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/configuration.md#auth) with `htpasswd`. It relies on an [Apache `htpasswd` file](https://httpd.apache.org/docs/2.4/programs/htpasswd.html), with passwords hashed using `bcrypt`. + + Since it isn't used in the context of GitLab (the product), `htpasswd` authentication will be deprecated in GitLab 14.9 and removed in GitLab 15.0. diff --git a/data/removals/14_0/deprecation_bump_terraform_template_version.yml b/data/removals/14_0/deprecation_bump_terraform_template_version.yml index 5bc8d7d66c9..201c2efa8aa 100644 --- a/data/removals/14_0/deprecation_bump_terraform_template_version.yml +++ b/data/removals/14_0/deprecation_bump_terraform_template_version.yml @@ -13,7 +13,7 @@ At every major release of GitLab, the "latest version" template becomes the "major version" template, inheriting the "latest template" setup. As we have added many new features to the Terraform integration, the new setup for the "major version" template can be considered a breaking change. - The latest template supports the [Terraform Merge Request widget](https://docs.gitlab.com/ee/user/infrastructure/mr_integration.html) and - doesn't need additional setup to work with the [GitLab managed Terraform state](https://docs.gitlab.com/ee/user/infrastructure/terraform_state.html). + The latest template supports the [Terraform Merge Request widget](https://docs.gitlab.com/ee/user/infrastructure/iac/mr_integration.html) and + doesn't need additional setup to work with the [GitLab managed Terraform state](https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html). To check the new changes, see the [new "major version" template](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml). diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md index 6151955e87c..1a6ae9c6beb 100644 --- a/doc/update/deprecations.md +++ b/doc/update/deprecations.md @@ -56,6 +56,20 @@ The [`custom_hooks_dir`](https://docs.gitlab.com/ee/administration/server_hooks. **Planned removal milestone: 15.0 ()** +### htpasswd Authentication for the Container Registry + +WARNING: +This feature will be changed or removed in 15.0 +as a [breaking change](https://docs.gitlab.com/ee/development/contributing/#breaking-changes). +Before updating GitLab, review the details carefully to determine if you need to make any +changes to your code, settings, or workflow. + +The Container Registry supports [authentication](https://gitlab.com/gitlab-org/container-registry/-/blob/master/docs/configuration.md#auth) with `htpasswd`. It relies on an [Apache `htpasswd` file](https://httpd.apache.org/docs/2.4/programs/htpasswd.html), with passwords hashed using `bcrypt`. + +Since it isn't used in the context of GitLab (the product), `htpasswd` authentication will be deprecated in GitLab 14.9 and removed in GitLab 15.0. + +**Planned removal milestone: 15.0 (2022-05-22)** + ## 14.8 ### Changes to the `CI_JOB_JWT` diff --git a/doc/update/removals.md b/doc/update/removals.md index 3522e11bda0..09c8d584e9b 100644 --- a/doc/update/removals.md +++ b/doc/update/removals.md @@ -569,8 +569,8 @@ As we continuously [develop GitLab's Terraform integrations](https://gitlab.com/ At every major release of GitLab, the "latest version" template becomes the "major version" template, inheriting the "latest template" setup. As we have added many new features to the Terraform integration, the new setup for the "major version" template can be considered a breaking change. -The latest template supports the [Terraform Merge Request widget](https://docs.gitlab.com/ee/user/infrastructure/mr_integration.html) and -doesn't need additional setup to work with the [GitLab managed Terraform state](https://docs.gitlab.com/ee/user/infrastructure/terraform_state.html). +The latest template supports the [Terraform Merge Request widget](https://docs.gitlab.com/ee/user/infrastructure/iac/mr_integration.html) and +doesn't need additional setup to work with the [GitLab managed Terraform state](https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html). To check the new changes, see the [new "major version" template](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml). diff --git a/doc/user/project/highlighting.md b/doc/user/project/highlighting.md index 728f51a8062..ef0c787b9d3 100644 --- a/doc/user/project/highlighting.md +++ b/doc/user/project/highlighting.md @@ -7,61 +7,67 @@ type: reference # Syntax Highlighting **(FREE)** -GitLab provides syntax highlighting on all files through the [Rouge](https://rubygems.org/gems/rouge) Ruby gem. It attempts to guess what language to use based on the file extension, which most of the time is sufficient. +GitLab provides syntax highlighting on all files through the +[Rouge](https://rubygems.org/gems/rouge) Ruby gem. It attempts to guess what language +to use based on the file extension, which most of the time is sufficient. + +The paths here are Git's built-in [`.gitattributes` interface](https://git-scm.com/docs/gitattributes). NOTE: The [Web IDE](web_ide/index.md) and [Snippets](../snippets.md) use [Monaco Editor](https://microsoft.github.io/monaco-editor/) for text editing, which internally uses the [Monarch](https://microsoft.github.io/monaco-editor/monarch.html) library for syntax highlighting. - +## Override syntax highlighting for a file type -If GitLab is guessing wrong, you can override its choice of language using the -`gitlab-language` attribute in `.gitattributes`. For example, if you are working in a Prolog -project and using the `.pl` file extension (which would normally be highlighted as Perl), -you can add the following to your `.gitattributes` file: +NOTE: +The Web IDE [does not support `.gitattribute` files](https://gitlab.com/gitlab-org/gitlab/-/issues/22014). - +To override syntax highlighting for a file type: + +1. If a `.gitattributes` file does not exist in the root directory of your project, + create a blank file with this name. +1. For each file type you want to modify, add a line to the `.gitattributes` file + declaring the file extension and your desired highlighting language: + + ```conf + # This extension would normally receive Perl syntax highlighting + # but if we also use Prolog, we may want to override highlighting for + # files with this extension: + *.pl gitlab-language=prolog + ``` + +1. Commit, push, and merge your changes into your default branch. + +After the changes merge into your [default branch](repository/branches/default.md), +all `*.pl` files in your project are highlighted in your preferred language. + +You can also extend the highlighting with common gateway interface (CGI) options, such as: ``` conf -*.pl gitlab-language=prolog -``` - - - -When you check in and push that change, all `*.pl` files in your project are highlighted as Prolog. - - - -The paths here are Git's built-in [`.gitattributes` interface](https://git-scm.com/docs/gitattributes). So, if you were to invent a file format called a `Nicefile` at the root of your project that used Ruby syntax, all you need is: - -``` conf -/Nicefile gitlab-language=ruby -``` - -To disable highlighting entirely, use `gitlab-language=text`. Lots more fun shenanigans are available through common gateway interface (CGI) options, such as: - -``` conf -# json with erb in it +# JSON file with .erb in it /my-cool-file gitlab-language=erb?parent=json -# an entire file of highlighting errors! +# An entire file of highlighting errors! /other-file gitlab-language=text?token=Error ``` -These configurations only take effect when the `.gitattributes` -file is in your [default branch](repository/branches/default.md). +## Disable syntax highlighting for a file type -NOTE: -The Web IDE does not support `.gitattribute` files, but it's [planned for a future release](https://gitlab.com/gitlab-org/gitlab/-/issues/22014). +To disable highlighting entirely for a file type, follow the instructions for overriding +the highlighting for a file type, and use `gitlab-language=text`: + +```conf +# Disable syntax highlighting for this file type +*.module gitlab-language=text +``` ## Configure maximum file size for highlighting -You can configure the maximum size of the file to be highlighted. +By default, GitLab renders any file larger than 512 KB in plain text. To change this value: -The file size is measured in kilobytes, and is set to a default of `512 KB`. Any file _over_ the file size is rendered in plain text. - -1. Open the [`gitlab.yml`](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/config/gitlab.yml.example) configuration file. +1. Open the [`gitlab.yml`](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/config/gitlab.yml.example) + configuration file for your project. 1. Add this section, replacing `maximum_text_highlight_size_kilobytes` with the value you want. @@ -72,3 +78,5 @@ The file size is measured in kilobytes, and is set to a default of `512 KB`. Any ## https://docs.gitlab.com/ee/user/project/highlighting.html maximum_text_highlight_size_kilobytes: 512 ``` + +1. Commit, push, and merge your changes into your default branch. diff --git a/lib/gitlab/database/load_balancing/setup.rb b/lib/gitlab/database/load_balancing/setup.rb index 126c8bb2aa6..6d667e8ecf0 100644 --- a/lib/gitlab/database/load_balancing/setup.rb +++ b/lib/gitlab/database/load_balancing/setup.rb @@ -90,7 +90,8 @@ module Gitlab def use_model_load_balancing? # Cache environment variable and return env variable first if defined - use_model_load_balancing_env = Gitlab::Utils.to_boolean(ENV["GITLAB_USE_MODEL_LOAD_BALANCING"]) + default_use_model_load_balancing_env = Gitlab.dev_or_test_env? || nil + use_model_load_balancing_env = Gitlab::Utils.to_boolean(ENV.fetch('GITLAB_USE_MODEL_LOAD_BALANCING', default_use_model_load_balancing_env)) unless use_model_load_balancing_env.nil? return use_model_load_balancing_env diff --git a/lib/gitlab/quick_actions/merge_request_actions.rb b/lib/gitlab/quick_actions/merge_request_actions.rb index 842d4ef482b..f7c0f63b60e 100644 --- a/lib/gitlab/quick_actions/merge_request_actions.rb +++ b/lib/gitlab/quick_actions/merge_request_actions.rb @@ -23,7 +23,9 @@ module Gitlab end end execution_message do - if preferred_strategy = preferred_auto_merge_strategy(quick_action_target) + if params[:merge_request_diff_head_sha].blank? + _("Merge request diff sha parameter is required for the merge quick action.") + elsif preferred_strategy = preferred_auto_merge_strategy(quick_action_target) _("Scheduled to merge this merge request (%{strategy}).") % { strategy: preferred_strategy.humanize } else _('Merged this merge request.') @@ -35,6 +37,8 @@ module Gitlab merge_orchestration_service.can_merge?(quick_action_target) end command :merge do + next unless params[:merge_request_diff_head_sha].present? + @updates[:merge] = params[:merge_request_diff_head_sha] end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 5f040ea0203..3d714035d5d 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -23066,6 +23066,9 @@ msgstr "" msgid "Merge request dependencies" msgstr "" +msgid "Merge request diff sha parameter is required for the merge quick action." +msgstr "" + msgid "Merge request events" msgstr "" diff --git a/spec/frontend/terraform/components/empty_state_spec.js b/spec/frontend/terraform/components/empty_state_spec.js index 1637ac2039c..b1303cf2b5e 100644 --- a/spec/frontend/terraform/components/empty_state_spec.js +++ b/spec/frontend/terraform/components/empty_state_spec.js @@ -8,7 +8,7 @@ describe('EmptyStateComponent', () => { const propsData = { image: '/image/path', }; - const docsUrl = '/help/user/infrastructure/terraform_state'; + const docsUrl = '/help/user/infrastructure/iac/terraform_state'; const findEmptyState = () => wrapper.findComponent(GlEmptyState); const findLink = () => wrapper.findComponent(GlLink); diff --git a/spec/lib/gitlab/database/load_balancing/setup_spec.rb b/spec/lib/gitlab/database/load_balancing/setup_spec.rb index 20519a759b2..4d565ce137a 100644 --- a/spec/lib/gitlab/database/load_balancing/setup_spec.rb +++ b/spec/lib/gitlab/database/load_balancing/setup_spec.rb @@ -274,6 +274,8 @@ RSpec.describe Gitlab::Database::LoadBalancing::Setup do end before do + allow(Gitlab).to receive(:dev_or_test_env?).and_return(false) + # Rewrite `class_attribute` to use rspec mocking and prevent modifying the objects allow_next_instance_of(described_class) do |setup| allow(setup).to receive(:configure_connection) diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index afeb95a3ca3..8000c7efb2b 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -799,10 +799,9 @@ RSpec.describe QuickActions::InterpretService do let(:project) { repository_project } let(:service) { described_class.new(project, developer, {}) } - it 'precheck passes and returns merge command' do - _, updates, _ = service.execute('/merge', merge_request) - - expect(updates).to eq(merge: nil) + it_behaves_like 'failed command', 'Merge request diff sha parameter is required for the merge quick action.' do + let(:content) { "/merge" } + let(:issuable) { merge_request } end end