diff options
111 files changed, 802 insertions, 305 deletions
diff --git a/.rubocop_manual_todo.yml b/.rubocop_manual_todo.yml index ed5943abcd5..8bd1a345ffe 100644 --- a/.rubocop_manual_todo.yml +++ b/.rubocop_manual_todo.yml @@ -695,14 +695,10 @@ RSpec/TimecopFreeze: - 'ee/spec/services/vulnerability_exports/export_service_spec.rb' - 'ee/spec/support/shared_contexts/lib/gitlab/insights/reducers/reducers_shared_contexts.rb' - 'qa/spec/support/repeater_spec.rb' - - 'spec/features/profiles/active_sessions_spec.rb' - - 'spec/features/projects/environments/environment_metrics_spec.rb' - 'spec/features/users/active_sessions_spec.rb' - - 'spec/lib/atlassian/jira_connect/client_spec.rb' - 'spec/lib/gitlab/analytics/cycle_analytics/base_query_builder_spec.rb' - 'spec/lib/gitlab/analytics/cycle_analytics/median_spec.rb' - 'spec/lib/gitlab/analytics/cycle_analytics/records_fetcher_spec.rb' - - 'spec/lib/gitlab/anonymous_session_spec.rb' - 'spec/lib/gitlab/auth/unique_ips_limiter_spec.rb' - 'spec/lib/gitlab/checks/timed_logger_spec.rb' - 'spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb' @@ -715,10 +711,6 @@ RSpec/TimecopFreeze: - 'spec/lib/rspec_flaky/flaky_example_spec.rb' - 'spec/lib/rspec_flaky/listener_spec.rb' - 'spec/models/active_session_spec.rb' - - 'spec/models/container_repository_spec.rb' - - 'spec/models/pages/lookup_path_spec.rb' - - 'spec/models/project_feature_usage_spec.rb' - - 'spec/requests/api/v3/github_spec.rb' - 'spec/serializers/entity_date_helper_spec.rb' - 'spec/support/cycle_analytics_helpers/test_generation.rb' - 'spec/support/helpers/cycle_analytics_helpers.rb' diff --git a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue index 6552665100a..790460c79f1 100644 --- a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue +++ b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue @@ -19,7 +19,9 @@ import { import { s__, __, n__ } from '~/locale'; import axios from '~/lib/utils/axios_utils'; import { redirectTo } from '~/lib/utils/url_utility'; -import { VARIABLE_TYPE, FILE_TYPE } from '../constants'; +import { VARIABLE_TYPE, FILE_TYPE, CONFIG_VARIABLES_TIMEOUT } from '../constants'; +import { backOff } from '~/lib/utils/common_utils'; +import httpStatusCodes from '~/lib/utils/http_status'; export default { typeOptions: [ @@ -211,32 +213,49 @@ export default { }, fetchConfigVariables(refValue) { - if (gon?.features?.newPipelineFormPrefilledVars) { - this.isLoading = true; + if (!gon?.features?.newPipelineFormPrefilledVars) { + return Promise.resolve({ params: {}, descriptions: {} }); + } + + this.isLoading = true; - return axios + return backOff((next, stop) => { + axios .get(this.configVariablesPath, { params: { sha: refValue, }, }) - .then(({ data }) => { - const params = {}; - const descriptions = {}; + .then(({ data, status }) => { + if (status === httpStatusCodes.NO_CONTENT) { + next(); + } else { + this.isLoading = false; + stop(data); + } + }) + .catch(error => { + stop(error); + }); + }, CONFIG_VARIABLES_TIMEOUT) + .then(data => { + const params = {}; + const descriptions = {}; - Object.entries(data).forEach(([key, { value, description }]) => { - if (description !== null) { - params[key] = value; - descriptions[key] = description; - } - }); + Object.entries(data).forEach(([key, { value, description }]) => { + if (description !== null) { + params[key] = value; + descriptions[key] = description; + } + }); - this.isLoading = false; + return { params, descriptions }; + }) + .catch(() => { + this.isLoading = false; - return { params, descriptions }; - }); - } - return Promise.resolve({ params: {}, descriptions: {} }); + return { params: {}, descriptions: {} }; + }); }, createPipeline() { const filteredVariables = this.variables diff --git a/app/assets/javascripts/pipeline_new/constants.js b/app/assets/javascripts/pipeline_new/constants.js index b4ab1143f60..3d4a0ee328d 100644 --- a/app/assets/javascripts/pipeline_new/constants.js +++ b/app/assets/javascripts/pipeline_new/constants.js @@ -1,2 +1,3 @@ export const VARIABLE_TYPE = 'env_var'; export const FILE_TYPE = 'file'; +export const CONFIG_VARIABLES_TIMEOUT = 5000; diff --git a/app/assets/stylesheets/fontawesome_custom.scss b/app/assets/stylesheets/fontawesome_custom.scss index a54cc91bb07..2f5ef142b6f 100644 --- a/app/assets/stylesheets/fontawesome_custom.scss +++ b/app/assets/stylesheets/fontawesome_custom.scss @@ -27,10 +27,6 @@ font-size: 2em; } -.fa-chevron-down::before { - content: '\f078'; -} - .fa-caret-down::before { content: '\f0d7'; } diff --git a/app/assets/stylesheets/framework/buttons.scss b/app/assets/stylesheets/framework/buttons.scss index 6347b157a3e..1e051b3bcf0 100644 --- a/app/assets/stylesheets/framework/buttons.scss +++ b/app/assets/stylesheets/framework/buttons.scss @@ -231,8 +231,7 @@ color: $gray-700; } - .fa-caret-down, - .fa-chevron-down { + .fa-caret-down { margin-left: 5px; } diff --git a/app/assets/stylesheets/framework/dropdowns.scss b/app/assets/stylesheets/framework/dropdowns.scss index c9c1e46233b..47e1ba21d6b 100644 --- a/app/assets/stylesheets/framework/dropdowns.scss +++ b/app/assets/stylesheets/framework/dropdowns.scss @@ -16,12 +16,6 @@ } } -@mixin chevron-active { - .fa-chevron-down { - color: $gray-darkest; - } -} - @mixin set-visible { transform: translateY(0); display: block; @@ -56,7 +50,6 @@ .dropdown-toggle, .dropdown-menu-toggle { - @include chevron-active; border-color: $gray-darkest; } @@ -114,20 +107,11 @@ color: $gray-darkest; } - .fa-chevron-down { - font-size: $dropdown-chevron-size; - position: relative; - top: -2px; - margin-left: 5px; - } - &:hover { - @include chevron-active; border-color: $gray-darkest; } &:focus:active { - @include chevron-active; border-color: $dropdown-toggle-active-border-color; outline: 0; } @@ -145,12 +129,6 @@ position: absolute; } - .fa-chevron-down { - position: absolute; - top: 11px; - right: 8px; - } - .spinner { position: absolute; top: 9px; diff --git a/app/assets/stylesheets/framework/forms.scss b/app/assets/stylesheets/framework/forms.scss index be97db42d1d..6e47fef02d5 100644 --- a/app/assets/stylesheets/framework/forms.scss +++ b/app/assets/stylesheets/framework/forms.scss @@ -208,15 +208,6 @@ label { position: relative; } -.select-wrapper > .fa-chevron-down { - position: absolute; - font-size: 10px; - right: 10px; - top: 12px; - color: $gray-darkest; - pointer-events: none; -} - .input-icon-wrapper > .input-icon-right { position: absolute; right: 0.8em; diff --git a/app/assets/stylesheets/pages/groups.scss b/app/assets/stylesheets/pages/groups.scss index e73b6b18afd..7d870cf5a8b 100644 --- a/app/assets/stylesheets/pages/groups.scss +++ b/app/assets/stylesheets/pages/groups.scss @@ -80,12 +80,6 @@ .btn-success { width: 100%; } - - .dropdown .dropdown-toggle .fa-chevron-down { - position: absolute; - top: 11px; - right: 8px; - } } } diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb index 3e077c1af37..453928e251f 100644 --- a/app/controllers/projects/merge_requests/creations_controller.rb +++ b/app/controllers/projects/merge_requests/creations_controller.rb @@ -11,6 +11,11 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap before_action :apply_diff_view_cookie!, only: [:diffs, :diff_for_path] before_action :build_merge_request, except: [:create] + before_action do + push_frontend_feature_flag(:merge_request_reviewers, @project) + push_frontend_feature_flag(:mr_collapsed_approval_rules, @project) + end + def new define_new_vars end diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 627d578643f..c2bb441d640 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -49,6 +49,8 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo before_action do push_frontend_feature_flag(:vue_issuable_sidebar, @project.group) + push_frontend_feature_flag(:merge_request_reviewers, @project) + push_frontend_feature_flag(:mr_collapsed_approval_rules, @project) end around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions] diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index f71a92ee874..9450f5226ce 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -214,7 +214,9 @@ class Projects::PipelinesController < Projects::ApplicationController def config_variables respond_to do |format| format.json do - render json: Ci::ListConfigVariablesService.new(@project, current_user).execute(params[:sha]) + result = Ci::ListConfigVariablesService.new(@project, current_user).execute(params[:sha]) + + result.nil? ? head(:no_content) : render(json: result) end end end diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 4b21edc98d5..ffc7c753b15 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -3,16 +3,8 @@ class SearchController < ApplicationController include ControllerWithCrossProjectAccessCheck include SearchHelper - include RendersCommits include RedisTracking - SCOPE_PRELOAD_METHOD = { - projects: :with_web_entity_associations, - issues: :with_web_entity_associations, - merge_requests: :with_web_entity_associations, - epics: :with_web_entity_associations - }.freeze - track_redis_hll_event :show, name: 'i_search_total', feature: :search_track_unique_users, feature_default_enabled: true around_action :allow_gitaly_ref_name_caching @@ -41,14 +33,12 @@ class SearchController < ApplicationController @search_term = params[:search] @sort = params[:sort] || default_sort - @scope = search_service.scope - @show_snippets = search_service.show_snippets? - @search_results = search_service.search_results - @search_objects = search_service.search_objects(preload_method) - @search_highlight = search_service.search_highlight - - render_commits if @scope == 'commits' - eager_load_user_status if @scope == 'users' + @search_service = Gitlab::View::Presenter::Factory.new(search_service, current_user: current_user).fabricate! + @scope = @search_service.scope + @show_snippets = @search_service.show_snippets? + @search_results = @search_service.search_results + @search_objects = @search_service.search_objects + @search_highlight = @search_service.search_highlight increment_search_counters end @@ -79,10 +69,6 @@ class SearchController < ApplicationController private - def preload_method - SCOPE_PRELOAD_METHOD[@scope.to_sym] - end - # overridden in EE def default_sort 'created_desc' @@ -102,14 +88,6 @@ class SearchController < ApplicationController true end - def render_commits - @search_objects = prepare_commits_for_rendering(@search_objects) - end - - def eager_load_user_status - @search_objects = @search_objects.eager_load(:status) # rubocop:disable CodeReuse/ActiveRecord - end - def check_single_commit_result? return false if params[:force_search_results] return false unless @project.present? diff --git a/app/graphql/types/ci/detailed_status_type.rb b/app/graphql/types/ci/detailed_status_type.rb index 5843bcfde89..80d73e9b174 100644 --- a/app/graphql/types/ci/detailed_status_type.rb +++ b/app/graphql/types/ci/detailed_status_type.rb @@ -25,7 +25,8 @@ module Types description: 'Tooltip associated with the status', method: :status_tooltip field :action, Types::Ci::StatusActionType, null: true, - description: 'Action information for the status. This includes method, button title, icon, path, and title' + calls_gitaly: true, + description: 'Action information for the status. This includes method, button title, icon, path, and title' def action if object.has_action? diff --git a/app/presenters/search_service_presenter.rb b/app/presenters/search_service_presenter.rb new file mode 100644 index 00000000000..19a90d002aa --- /dev/null +++ b/app/presenters/search_service_presenter.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +class SearchServicePresenter < Gitlab::View::Presenter::Delegated + include RendersCommits + + presents :search_service + + SCOPE_PRELOAD_METHOD = { + projects: :with_web_entity_associations, + issues: :with_web_entity_associations, + merge_requests: :with_web_entity_associations, + epics: :with_web_entity_associations + }.freeze + + SORT_ENABLED_SCOPES = %w(issues merge_requests).freeze + + def search_objects + @search_objects ||= begin + objects = search_service.search_objects(SCOPE_PRELOAD_METHOD[scope.to_sym]) + + case scope + when 'users' + objects.eager_load(:status) # rubocop:disable CodeReuse/ActiveRecord + when 'commits' + prepare_commits_for_rendering(objects) + else + objects + end + end + end + + def show_sort_dropdown? + SORT_ENABLED_SCOPES.include?(scope) + end + + def show_results_status? + !without_count? || show_snippets? || show_sort_dropdown? + end + + def without_count? + search_objects.is_a?(Kaminari::PaginatableWithoutCount) + end +end diff --git a/app/services/ci/list_config_variables_service.rb b/app/services/ci/list_config_variables_service.rb index 4a5b3a92a2c..88dac514bb9 100644 --- a/app/services/ci/list_config_variables_service.rb +++ b/app/services/ci/list_config_variables_service.rb @@ -2,7 +2,26 @@ module Ci class ListConfigVariablesService < ::BaseService + include ReactiveCaching + + self.reactive_cache_key = ->(service) { [service.class.name, service.id] } + self.reactive_cache_work_type = :external_dependency + self.reactive_cache_worker_finder = ->(id, *_args) { from_cache(id) } + + def self.from_cache(id) + project_id, user_id = id.split('-') + + project = Project.find(project_id) + user = User.find(user_id) + + new(project, user) + end + def execute(sha) + with_reactive_cache(sha) { |result| result } + end + + def calculate_reactive_cache(sha) config = project.ci_config_for(sha) return {} unless config @@ -12,5 +31,10 @@ module Ci result.valid? ? result.variables_with_data : {} end + + # Required for ReactiveCaching, it is also used in `reactive_cache_worker_finder` + def id + "#{project.id}-#{current_user.id}" + end end end diff --git a/app/views/projects/merge_requests/_mr_title.html.haml b/app/views/projects/merge_requests/_mr_title.html.haml index 6c896720ec1..5b30b6e3379 100644 --- a/app/views/projects/merge_requests/_mr_title.html.haml +++ b/app/views/projects/merge_requests/_mr_title.html.haml @@ -50,4 +50,4 @@ - if can_update_merge_request && !are_close_and_open_buttons_hidden = render 'shared/issuable/close_reopen_draft_report_toggle', issuable: @merge_request - elsif !@merge_request.merged? - = link_to _('Report abuse'), new_abuse_report_path(user_id: @merge_request.author.id, ref_url: merge_request_url(@merge_request)), class: 'gl-display-none gl-display-md-block gl-button btn btn-warning-secondary', title: _('Report abuse') + = link_to _('Report abuse'), new_abuse_report_path(user_id: @merge_request.author.id, ref_url: merge_request_url(@merge_request)), class: 'gl-display-none gl-display-md-block gl-button btn btn-warning-secondary float-right gl-ml-3', title: _('Report abuse') diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml index 855112bdba2..e0f59b84493 100644 --- a/app/views/search/_results.html.haml +++ b/app/views/search/_results.html.haml @@ -6,26 +6,7 @@ = render partial: "search/results/empty" = render_if_exists 'shared/promotions/promote_advanced_search' - else - .search-results-status - .row-content-block.gl-display-flex - .gl-display-md-flex.gl-text-left.gl-align-items-center.gl-flex-grow-1 - - unless @search_objects.is_a?(Kaminari::PaginatableWithoutCount) - = search_entries_info(@search_objects, @scope, @search_term) - - unless @show_snippets - - if @project - - link_to_project = link_to(@project.full_name, @project, class: 'ml-md-1') - - if @scope == 'blobs' - = s_("SearchCodeResults|in") - .mx-md-1 - = render partial: "shared/ref_switcher", locals: { ref: repository_ref(@project), form_path: request.fullpath, field_name: 'repository_ref' } - = s_('SearchCodeResults|of %{link_to_project}').html_safe % { link_to_project: link_to_project } - - else - = _("in project %{link_to_project}").html_safe % { link_to_project: link_to_project } - - elsif @group - - link_to_group = link_to(@group.name, @group, class: 'ml-md-1') - = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } - .gl-display-md-flex.gl-flex-direction-column - = render partial: 'search/sort_dropdown' + = render partial: 'search/results_status', locals: { search_service: @search_service } = render_if_exists 'shared/promotions/promote_advanced_search' .results.gl-display-md-flex.gl-mt-3 diff --git a/app/views/search/_results_status.html.haml b/app/views/search/_results_status.html.haml new file mode 100644 index 00000000000..e55f225b162 --- /dev/null +++ b/app/views/search/_results_status.html.haml @@ -0,0 +1,25 @@ +- search_service = local_assigns.fetch(:search_service) + +- return unless search_service.show_results_status? + +.search-results-status + .row-content-block.gl-display-flex + .gl-display-md-flex.gl-text-left.gl-align-items-center.gl-flex-grow-1 + - unless search_service.without_count? + = search_entries_info(search_service.search_objects, search_service.scope, params[:search]) + - unless search_service.show_snippets? + - if search_service.project + - link_to_project = link_to(search_service.project.full_name, search_service.project, class: 'ml-md-1') + - if search_service.scope == 'blobs' + = _("in") + .mx-md-1 + = render partial: "shared/ref_switcher", locals: { ref: repository_ref(search_service.project), form_path: request.fullpath, field_name: 'repository_ref' } + = s_('SearchCodeResults|of %{link_to_project}').html_safe % { link_to_project: link_to_project } + - else + = _("in project %{link_to_project}").html_safe % { link_to_project: link_to_project } + - elsif search_service.group + - link_to_group = link_to(search_service.group.name, search_service.group, class: 'ml-md-1') + = _("in group %{link_to_group}").html_safe % { link_to_group: link_to_group } + - if search_service.show_sort_dropdown? + .gl-display-md-flex.gl-flex-direction-column + = render partial: 'search/sort_dropdown' diff --git a/app/views/search/_sort_dropdown.html.haml b/app/views/search/_sort_dropdown.html.haml index c4c5a490ff5..4ae6513d395 100644 --- a/app/views/search/_sort_dropdown.html.haml +++ b/app/views/search/_sort_dropdown.html.haml @@ -1,5 +1,3 @@ -- return unless ['issues', 'merge_requests'].include?(@scope) - - sort_value = @sort - sort_title = search_sort_option_title(sort_value) diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index b412f61e2a8..552f83906e1 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -32,7 +32,7 @@ = form.label :confidential, class: 'form-check-label' do This issue is confidential and should only be visible to team members with at least Reporter access. -= render 'shared/issuable/form/metadata', issuable: issuable, form: form, project: project += render 'shared/issuable/form/metadata', issuable: issuable, form: form, project: project, presenter: presenter = render_if_exists 'shared/issuable/approvals', issuable: issuable, presenter: presenter, form: form diff --git a/app/views/shared/issuable/form/_metadata.html.haml b/app/views/shared/issuable/form/_metadata.html.haml index 459eb112e4f..366e819d252 100644 --- a/app/views/shared/issuable/form/_metadata.html.haml +++ b/app/views/shared/issuable/form/_metadata.html.haml @@ -1,5 +1,6 @@ - project = local_assigns.fetch(:project) - issuable = local_assigns.fetch(:issuable) +- presenter = local_assigns.fetch(:presenter) - return unless can?(current_user, :"admin_#{issuable.to_ability_name}", issuable.project) @@ -14,7 +15,7 @@ - if issuable.allows_reviewers? .form-group.row.merge-request-reviewer - = render "shared/issuable/form/metadata_issuable_reviewer", issuable: issuable, form: form, has_due_date: has_due_date + = render "shared/issuable/form/metadata_issuable_reviewer", issuable: issuable, form: form, has_due_date: has_due_date, presenter: presenter = render_if_exists "shared/issuable/form/epic", issuable: issuable, form: form, project: project diff --git a/app/views/shared/issuable/form/_metadata_issuable_reviewer.html.haml b/app/views/shared/issuable/form/_metadata_issuable_reviewer.html.haml index 5ff3a6781ad..a4e2ce035cc 100644 --- a/app/views/shared/issuable/form/_metadata_issuable_reviewer.html.haml +++ b/app/views/shared/issuable/form/_metadata_issuable_reviewer.html.haml @@ -1,5 +1,5 @@ = form.label :reviewer_id, issuable.allows_multiple_reviewers? ? _('Reviewers') : _('Reviewer'), class: "col-form-label #{has_due_date ? "col-md-2 col-lg-4" : "col-sm-2"}" -.col-sm-10{ class: ("col-md-8" if has_due_date) } +.col-sm-10.gl-mb-2{ class: ("col-md-8" if has_due_date) } .issuable-form-select-holder.selectbox - issuable.reviewers.each do |reviewer| = hidden_field_tag "#{issuable.to_ability_name}[reviewer_ids][]", reviewer.id, id: nil, data: { meta: reviewer.name, avatar_url: reviewer.avatar_url, name: reviewer.name, username: reviewer.username } @@ -8,3 +8,5 @@ = hidden_field_tag "#{issuable.to_ability_name}[reviewer_ids][]", 0, id: nil, data: { meta: '' } = dropdown_tag(users_dropdown_label(issuable.reviewers), options: reviewers_dropdown_options(issuable.to_ability_name)) + - if Feature.enabled?(:mr_collapsed_approval_rules, @project) + = render_if_exists 'shared/issuable/approver_suggestion', issuable: issuable, presenter: presenter diff --git a/changelogs/unreleased/249713-empty-results-status-fix.yml b/changelogs/unreleased/249713-empty-results-status-fix.yml new file mode 100644 index 00000000000..2b88093420d --- /dev/null +++ b/changelogs/unreleased/249713-empty-results-status-fix.yml @@ -0,0 +1,5 @@ +--- +title: 'Search page: fix empty results status' +merge_request: 48034 +author: +type: fixed diff --git a/changelogs/unreleased/276949-graphql-be-fix.yml b/changelogs/unreleased/276949-graphql-be-fix.yml new file mode 100644 index 00000000000..dd4013c2918 --- /dev/null +++ b/changelogs/unreleased/276949-graphql-be-fix.yml @@ -0,0 +1,5 @@ +--- +title: 'GraphQL: Add gitlay field to CiStatusAction' +merge_request: 48892 +author: +type: fixed diff --git a/changelogs/unreleased/ab-reindex-functional-analyze.yml b/changelogs/unreleased/ab-reindex-functional-analyze.yml new file mode 100644 index 00000000000..05fd817f122 --- /dev/null +++ b/changelogs/unreleased/ab-reindex-functional-analyze.yml @@ -0,0 +1,5 @@ +--- +title: Add relation name to indexes view +merge_request: 47422 +author: +type: other diff --git a/changelogs/unreleased/fix-mr-buttons-for-deleted-fork.yml b/changelogs/unreleased/fix-mr-buttons-for-deleted-fork.yml new file mode 100644 index 00000000000..b34b7658fb8 --- /dev/null +++ b/changelogs/unreleased/fix-mr-buttons-for-deleted-fork.yml @@ -0,0 +1,5 @@ +--- +title: Fix MR buttons when fork is deleted +merge_request: 48813 +author: +type: fixed diff --git a/config/feature_flags/development/mr_collapsed_approval_rules.yml b/config/feature_flags/development/mr_collapsed_approval_rules.yml new file mode 100644 index 00000000000..5fca48ddc3a --- /dev/null +++ b/config/feature_flags/development/mr_collapsed_approval_rules.yml @@ -0,0 +1,8 @@ +--- +name: mr_collapsed_approval_rules +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47475 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/284052 +milestone: '13.6' +type: development +group: group::source code +default_enabled: false diff --git a/db/migrate/20201111145317_add_relation_to_indexes_view.rb b/db/migrate/20201111145317_add_relation_to_indexes_view.rb new file mode 100644 index 00000000000..318b77c1dc6 --- /dev/null +++ b/db/migrate/20201111145317_add_relation_to_indexes_view.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +class AddRelationToIndexesView < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def up + execute(<<~SQL) + DROP VIEW postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + pg_indexes.tablename, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + pg_class.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL as expression, + pg_index.indpred IS NOT NULL as partial, + pg_indexes.indexdef AS definition, + pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class ON pg_class.oid = pg_index.indexrelid + JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid + JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname + WHERE pg_namespace.nspname <> 'pg_catalog'::name + AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end + + def down + execute(<<~SQL) + DROP VIEW postgres_indexes; + + CREATE VIEW postgres_indexes AS + SELECT (pg_namespace.nspname::text || '.'::text) || pg_class.relname::text AS identifier, + pg_index.indexrelid, + pg_namespace.nspname AS schema, + pg_class.relname AS name, + pg_index.indisunique AS "unique", + pg_index.indisvalid AS valid_index, + pg_class.relispartition AS partitioned, + pg_index.indisexclusion AS exclusion, + pg_index.indexprs IS NOT NULL as expression, + pg_index.indpred IS NOT NULL as partial, + pg_indexes.indexdef AS definition, + pg_relation_size(pg_class.oid::regclass) AS ondisk_size_bytes + FROM pg_index + JOIN pg_class ON pg_class.oid = pg_index.indexrelid + JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid + JOIN pg_indexes ON pg_class.relname = pg_indexes.indexname + WHERE pg_namespace.nspname <> 'pg_catalog'::name + AND (pg_namespace.nspname = ANY (ARRAY["current_schema"(), 'gitlab_partitions_dynamic'::name, 'gitlab_partitions_static'::name])); + SQL + end +end diff --git a/db/schema_migrations/20201111145317 b/db/schema_migrations/20201111145317 new file mode 100644 index 00000000000..b6b33df7645 --- /dev/null +++ b/db/schema_migrations/20201111145317 @@ -0,0 +1 @@ +51d26848722466503e43b0f41e2fa43ee6073a16b358311a0aff6d77fbb12b1d
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index d50148599b3..79958cb93fd 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -14897,6 +14897,7 @@ CREATE VIEW postgres_indexes AS pg_index.indexrelid, pg_namespace.nspname AS schema, pg_class.relname AS name, + pg_indexes.tablename, pg_index.indisunique AS "unique", pg_index.indisvalid AS valid_index, pg_class.relispartition AS partitioned, diff --git a/doc/administration/geo/replication/version_specific_updates.md b/doc/administration/geo/replication/version_specific_updates.md index dda4e23ba11..0c715318e6a 100644 --- a/doc/administration/geo/replication/version_specific_updates.md +++ b/doc/administration/geo/replication/version_specific_updates.md @@ -11,6 +11,10 @@ Check this document if it includes instructions for the version you are updating These steps go together with the [general steps](updating_the_geo_nodes.md#general-update-steps) for updating Geo nodes. +## Updating to GitLab 13.5 + +In GitLab 13.5, there is a [regression that prevents viewing a list of container repositories and registries](https://gitlab.com/gitlab-org/gitlab/-/issues/285475) on Geo secondaries. This issue is fixed in GitLab 13.6.1 and later. + ## Updating to GitLab 13.3 In GitLab 13.3, Geo removed the PostgreSQL [Foreign Data Wrapper](https://www.postgresql.org/docs/11/postgres-fdw.html) dependency for the tracking database. diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md index ff7bc7ee37b..cf2c555ef41 100644 --- a/doc/administration/pages/index.md +++ b/doc/administration/pages/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments description: 'Learn how to administer GitLab Pages.' --- diff --git a/doc/administration/pages/source.md b/doc/administration/pages/source.md index ff8578e8fd7..2cc4b643f6f 100644 --- a/doc/administration/pages/source.md +++ b/doc/administration/pages/source.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/administration/troubleshooting/postgresql.md b/doc/administration/troubleshooting/postgresql.md index c44104c5ef8..2a263d11813 100644 --- a/doc/administration/troubleshooting/postgresql.md +++ b/doc/administration/troubleshooting/postgresql.md @@ -1,22 +1,23 @@ --- -stage: none -group: unassigned +stage: Enablement +group: Database info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference --- # PostgreSQL -This page is useful information about PostgreSQL that the GitLab Support -Team sometimes uses while troubleshooting. GitLab is making this public, so that anyone -can make use of the Support team's collected knowledge. +This page contains information about PostgreSQL the GitLab Support team uses +when troubleshooting. GitLab makes this information public, so that anyone can +make use of the Support team's collected knowledge. CAUTION: **Caution:** -Some procedures documented here may break your GitLab instance. Use at your own risk. +Some procedures documented here may break your GitLab instance. Use at your +own risk. -If you are on a [paid tier](https://about.gitlab.com/pricing/) and are not sure how -to use these commands, it is best to [contact Support](https://about.gitlab.com/support/) -and they will assist you with any issues you are having. +If you're on a [paid tier](https://about.gitlab.com/pricing/) and aren't sure +how to use these commands, [contact Support](https://about.gitlab.com/support/) +for assistance with any issues you're having. ## Other GitLab PostgreSQL documentation @@ -24,51 +25,57 @@ This section is for links to information elsewhere in the GitLab documentation. ### Procedures -- [Connect to the PostgreSQL console.](https://docs.gitlab.com/omnibus/settings/database.html#connecting-to-the-bundled-postgresql-database) +- [Connect to the PostgreSQL console](https://docs.gitlab.com/omnibus/settings/database.html#connecting-to-the-bundled-postgresql-database). -- [Omnibus database procedures](https://docs.gitlab.com/omnibus/settings/database.html) including +- [Omnibus database procedures](https://docs.gitlab.com/omnibus/settings/database.html) including: - SSL: enabling, disabling, and verifying. - Enabling Write Ahead Log (WAL) archiving. - Using an external (non-Omnibus) PostgreSQL installation; and backing it up. - Listening on TCP/IP as well as or instead of sockets. - Storing data in another location. - Destructively reseeding the GitLab database. - - Guidance around updating packaged PostgreSQL, including how to stop it happening automatically. + - Guidance around updating packaged PostgreSQL, including how to stop it + happening automatically. -- [More about external PostgreSQL](../postgresql/external.md) +- [Information about external PostgreSQL](../postgresql/external.md). -- [Running Geo with external PostgreSQL](../geo/setup/external_database.md) +- [Running Geo with external PostgreSQL](../geo/setup/external_database.md). -- [Upgrades when running PostgreSQL configured for HA.](https://docs.gitlab.com/omnibus/settings/database.html#upgrading-a-gitlab-ha-cluster) +- [Upgrades when running PostgreSQL configured for HA](https://docs.gitlab.com/omnibus/settings/database.html#upgrading-a-gitlab-ha-cluster). -- Consuming PostgreSQL from [within CI runners](../../ci/services/postgres.md) +- Consuming PostgreSQL from [within CI runners](../../ci/services/postgres.md). -- [Using Slony to update PostgreSQL](../../update/upgrading_postgresql_using_slony.md) - - Uses replication to handle PostgreSQL upgrades - providing the schemas are the same. - - Reduces downtime to a short window for swinging over to the newer version. +- [Using Slony to update PostgreSQL](../../update/upgrading_postgresql_using_slony.md). + - Uses replication to handle PostgreSQL upgrades if the schemas are the same. + - Reduces downtime to a short window for switching to the newer version. -- Managing Omnibus PostgreSQL versions [from the development docs](https://docs.gitlab.com/omnibus/development/managing-postgresql-versions.html) +- Managing Omnibus PostgreSQL versions [from the development docs](https://docs.gitlab.com/omnibus/development/managing-postgresql-versions.html). - [PostgreSQL scaling](../postgresql/replication_and_failover.md) - - including [troubleshooting](../postgresql/replication_and_failover.md#troubleshooting) `gitlab-ctl repmgr-check-master` (or `gitlab-ctl patroni check-leader` if you are using Patroni) and PgBouncer errors + - Including [troubleshooting](../postgresql/replication_and_failover.md#troubleshooting) + `gitlab-ctl repmgr-check-master` (or `gitlab-ctl patroni check-leader` if + you're using Patroni) and PgBouncer errors. -- [Developer database documentation](../../development/README.md#database-guides) - some of which is absolutely not for production use. Including: - - understanding EXPLAIN plans +- [Developer database documentation](../../development/README.md#database-guides), + some of which is absolutely not for production use. Including: + - Understanding EXPLAIN plans. ### Troubleshooting/Fixes -- [GitLab database requirements](../../install/requirements.md#database) including - - Support for MySQL was removed in GitLab 12.1; [migrate to PostgreSQL](../../update/mysql_to_postgresql.md) - - required extension `pg_trgm` - - required extension `btree_gist` +- [GitLab database requirements](../../install/requirements.md#database), + including + - Support for MySQL was removed in GitLab 12.1; [migrate to PostgreSQL](../../update/mysql_to_postgresql.md). + - Required extension: `pg_trgm` + - Required extension: `btree_gist` -- Errors like this in the `production/sidekiq` log; see: [Set default_transaction_isolation into read committed](https://docs.gitlab.com/omnibus/settings/database.html#set-default_transaction_isolation-into-read-committed): +- Errors like this in the `production/sidekiq` log; see: + [Set default_transaction_isolation into read committed](https://docs.gitlab.com/omnibus/settings/database.html#set-default_transaction_isolation-into-read-committed): ```plaintext ActiveRecord::StatementInvalid PG::TRSerializationFailure: ERROR: could not serialize access due to concurrent update ``` -- PostgreSQL HA - [replication slot errors](https://docs.gitlab.com/omnibus/settings/database.html#troubleshooting-upgrades-in-an-ha-cluster): +- PostgreSQL HA [replication slot errors](https://docs.gitlab.com/omnibus/settings/database.html#troubleshooting-upgrades-in-an-ha-cluster): ```plaintext pg_basebackup: could not create temporary replication slot "pg_basebackup_12345": ERROR: all replication slots are in use @@ -87,11 +94,11 @@ This section is for links to information elsewhere in the GitLab documentation. PANIC: could not write to file ‘pg_xlog/xlogtemp.123’: No space left on device ``` -- [Checking Geo configuration](../geo/replication/troubleshooting.md) including - - reconfiguring hosts/ports - - checking and fixing user/password mappings +- [Checking Geo configuration](../geo/replication/troubleshooting.md), including: + - Reconfiguring hosts/ports. + - Checking and fixing user/password mappings. -- [Common Geo errors](../geo/replication/troubleshooting.md#fixing-common-errors) +- [Common Geo errors](../geo/replication/troubleshooting.md#fixing-common-errors). ## Support topics @@ -99,9 +106,12 @@ This section is for links to information elsewhere in the GitLab documentation. References: -- [Issue #1 Deadlocks with GitLab 12.1, PostgreSQL 10.7](https://gitlab.com/gitlab-org/gitlab/-/issues/30528) -- [Customer ticket (internal) GitLab 12.1.6](https://gitlab.zendesk.com/agent/tickets/134307) and [Google doc (internal)](https://docs.google.com/document/d/19xw2d_D1ChLiU-MO1QzWab-4-QXgsIUcN5e_04WTKy4) -- [Issue #2 deadlocks can occur if an instance is flooded with pushes](https://gitlab.com/gitlab-org/gitlab/-/issues/33650). Provided for context about how GitLab code can have this sort of unanticipated effect in unusual situations. +- [Issue #1 Deadlocks with GitLab 12.1, PostgreSQL 10.7](https://gitlab.com/gitlab-org/gitlab/-/issues/30528). +- [Customer ticket (internal) GitLab 12.1.6](https://gitlab.zendesk.com/agent/tickets/134307) + and [Google doc (internal)](https://docs.google.com/document/d/19xw2d_D1ChLiU-MO1QzWab-4-QXgsIUcN5e_04WTKy4). +- [Issue #2 deadlocks can occur if an instance is flooded with pushes](https://gitlab.com/gitlab-org/gitlab/-/issues/33650). + Provided for context about how GitLab code can have this sort of + unanticipated effect in unusual situations. ```plaintext ERROR: deadlock detected @@ -120,16 +130,28 @@ Quoting from issue [#1](https://gitlab.com/gitlab-org/gitlab/-/issues/30528): > "If a deadlock is hit, and we resolve it through aborting the transaction after a short period, then the retry mechanisms we already have will make the deadlocked piece of work try again, and it's unlikely we'll deadlock multiple times in a row." TIP: **Tip:** -In support, our general approach to reconfiguring timeouts (applies also to the HTTP stack as well) is that it's acceptable to do it temporarily as a workaround. If it makes GitLab usable for the customer, then it buys time to understand the problem more completely, implement a hot fix, or make some other change that addresses the root cause. Generally, the timeouts should be put back to reasonable defaults once the root cause is resolved. - -In this case, the guidance we had from development was to drop deadlock_timeout and/or statement_timeout but to leave the third setting at 60s. Setting idle_in_transaction protects the database from sessions potentially hanging for days. There's more discussion in [the issue relating to introducing this timeout on GitLab.com](https://gitlab.com/gitlab-com/gl-infra/production/-/issues/1053). +In Support, our general approach to reconfiguring timeouts (applies also to the +HTTP stack) is that it's acceptable to do it temporarily as a workaround. If it +makes GitLab usable for the customer, then it buys time to understand the +problem more completely, implement a hot fix, or make some other change that +addresses the root cause. Generally, the timeouts should be put back to +reasonable defaults after the root cause is resolved. + +In this case, the guidance we had from development was to drop deadlock_timeout +or statement_timeout, but to leave the third setting at 60s. Setting +idle_in_transaction protects the database from sessions potentially hanging for +days. There's more discussion in [the issue relating to introducing this timeout on GitLab.com](https://gitlab.com/gitlab-com/gl-infra/production/-/issues/1053). PostgresSQL defaults: - `statement_timeout = 0` (never) - `idle_in_transaction_session_timeout = 0` (never) -Comments in issue [#1](https://gitlab.com/gitlab-org/gitlab/-/issues/30528) indicate that these should both be set to at least a number of minutes for all Omnibus installations (so they don't hang indefinitely). However, 15s for statement_timeout is very short, and will only be effective if the underlying infrastructure is very performant. +Comments in issue [#1](https://gitlab.com/gitlab-org/gitlab/-/issues/30528) +indicate that these should both be set to at least a number of minutes for all +Omnibus GitLab installations (so they don't hang indefinitely). However, 15s +for statement_timeout is very short, and will only be effective if the +underlying infrastructure is very performant. See current settings with: @@ -148,4 +170,6 @@ It may take a little while to respond. ``` NOTE: **Note:** -These are Omnibus GitLab settings. If an external database, such as a customer's PostgreSQL installation or Amazon RDS is being used, these values don't get set, and would have to be set externally. +These are Omnibus GitLab settings. If an external database, such as a +customer's PostgreSQL installation or Amazon RDS is being used, these values +don't get set, and would have to be set externally. diff --git a/doc/administration/troubleshooting/ssl.md b/doc/administration/troubleshooting/ssl.md index cfbb83f9580..e9da3a4f803 100644 --- a/doc/administration/troubleshooting/ssl.md +++ b/doc/administration/troubleshooting/ssl.md @@ -1,22 +1,25 @@ --- -stage: none -group: unassigned +stage: Enablement +group: Distribution info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference --- # Troubleshooting SSL -This page contains a list of common SSL-related errors and scenarios that you may face while working with GitLab. -It should serve as an addition to the main SSL docs available here: +This page contains a list of common SSL-related errors and scenarios that you +may encounter while working with GitLab. It should serve as an addition to the +main SSL docs available here: -- [Omnibus SSL Configuration](https://docs.gitlab.com/omnibus/settings/ssl.html) -- [Self-signed certificates or custom Certification Authorities for GitLab Runner](https://docs.gitlab.com/runner/configuration/tls-self-signed.html) -- [Manually configuring HTTPS](https://docs.gitlab.com/omnibus/settings/nginx.html#manually-configuring-https) +- [Omnibus SSL Configuration](https://docs.gitlab.com/omnibus/settings/ssl.html). +- [Self-signed certificates or custom Certification Authorities for GitLab Runner](https://docs.gitlab.com/runner/configuration/tls-self-signed.html). +- [Manually configuring HTTPS](https://docs.gitlab.com/omnibus/settings/nginx.html#manually-configuring-https). ## Using an internal CA certificate with GitLab -After configuring a GitLab instance with an internal CA certificate, you might not be able to access it via various CLI tools. You may see the following symptoms: +After configuring a GitLab instance with an internal CA certificate, you might +not be able to access it by using various CLI tools. You may see experience the +following issues: - `curl` fails: @@ -26,7 +29,8 @@ After configuring a GitLab instance with an internal CA certificate, you might n More details here: https://curl.haxx.se/docs/sslcerts.html ``` -- Testing via the [rails console](../operations/rails_console.md#starting-a-rails-console-session) also fails: +- Testing by using the [rails console](../operations/rails_console.md#starting-a-rails-console-session) + also fails: ```ruby uri = URI.parse("https://gitlab.domain.tld") @@ -40,33 +44,36 @@ After configuring a GitLab instance with an internal CA certificate, you might n OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)) ``` -- The error `SSL certificate problem: unable to get local issuer certificate` is shown when setting up a [mirror](../../user/project/repository/repository_mirroring.md#repository-mirroring) from this GitLab instance. +- The error `SSL certificate problem: unable to get local issuer certificate` + is displayed when setting up a [mirror](../../user/project/repository/repository_mirroring.md#repository-mirroring) + from this GitLab instance. - `openssl` works when specifying the path to the certificate: ```shell /opt/gitlab/embedded/bin/openssl s_client -CAfile /root/my-cert.crt -connect gitlab.domain.tld:443 ``` -If you have the problems listed above, add your certificate to `/etc/gitlab/trusted-certs` and run `sudo gitlab-ctl reconfigure`. +If you have the previously described issues, add your certificate to +`/etc/gitlab/trusted-certs`, and then run `sudo gitlab-ctl reconfigure`. ## X.509 key values mismatch error -After configuring your instance with a certificate bundle, NGINX may throw the -following error: +After configuring your instance with a certificate bundle, NGINX may display +the following error message: `SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch` -This error means that the server certificate and key you have provided do not -match. You can confirm this by running the following command and comparing the -output: +This error message means that the server certificate and key you have provided +don't match. You can confirm this by running the following command and then +comparing the output: ```shell openssl rsa -noout -modulus -in path/to/your/.key | openssl md5 openssl x509 -noout -modulus -in path/to/your/.crt | openssl md5 ``` -The following is an example of an md5 output between a matching key and certificate. Note the -matching md5 hashes: +The following is an example of an md5 output between a matching key and +certificate. Note the matching md5 hashes: ```shell $ openssl rsa -noout -modulus -in private.key | openssl md5 @@ -75,7 +82,8 @@ $ openssl x509 -noout -modulus -in public.crt | openssl md5 4f49b61b25225abeb7542b29ae20e98c ``` -This is an opposing output with a non-matching key and certificate which shows different md5 hashes: +This is an opposing output with a non-matching key and certificate which shows +different md5 hashes: ```shell $ openssl rsa -noout -modulus -in private.key | openssl md5 @@ -84,14 +92,16 @@ $ openssl x509 -noout -modulus -in public.crt | openssl md5 4f49b61b25225abeb7542b29ae20e98c ``` -If the two outputs differ like the above example, there is a mismatch between the certificate -and key. You should contact the provider of the SSL certificate for further support. +If the two outputs differ like the previous example, there's a mismatch between +the certificate and key. Contact the provider of the SSL certificate for +further support. ## Using GitLab Runner with a GitLab instance configured with internal CA certificate or self-signed certificate Besides getting the errors mentioned in [Using an internal CA certificate with GitLab](ssl.md#using-an-internal-ca-certificate-with-gitlab), -your CI pipelines may get stuck in `Pending` status. In the runner logs you may see the below error: +your CI pipelines may get stuck in `Pending` status. In the runner logs you may +see the following error message: ```shell Dec 6 02:43:17 runner-host01 gitlab-runner[15131]: #033[0;33mWARNING: Checking for jobs... failed @@ -100,11 +110,15 @@ https://gitlab.domain.tld/api/v4/jobs/request: Post https://gitlab.domain.tld/ap x509: certificate signed by unknown authority ``` -If you face similar problem, add your certificate to `/etc/gitlab-runner/certs` and restart the runner via `gitlab-runner restart`. +If you encounter a similar problem, add your certificate to `/etc/gitlab-runner/certs`, +and the restart the runner by running `gitlab-runner restart`. ## Mirroring a remote GitLab repository that uses a self-signed SSL certificate -**Scenario:** When configuring a local GitLab instance to [mirror a repository](../../user/project/repository/repository_mirroring.md) from a remote GitLab instance that uses a self-signed certificate, you may see the `SSL certificate problem: self signed certificate` error in the UI. +When configuring a local GitLab instance to [mirror a repository](../../user/project/repository/repository_mirroring.md) +from a remote GitLab instance that uses a self-signed certificate, you may see +the `SSL certificate problem: self signed certificate` error message in the +user interface. The cause of the issue can be confirmed by checking if: @@ -116,7 +130,7 @@ The cause of the issue can be confirmed by checking if: More details here: https://curl.haxx.se/docs/sslcerts.html ``` -- Testing via the Rails console also fails: +- Testing by using the Rails console also fails: ```ruby uri = URI.parse("https://gitlab.domain.tld") @@ -132,10 +146,15 @@ The cause of the issue can be confirmed by checking if: To fix this problem: -- Add the self-signed certificate from the remote GitLab instance to the `/etc/gitlab/trusted-certs` directory on the local GitLab instance and run `sudo gitlab-ctl reconfigure` as per the instructions for [installing custom public certificates](https://docs.gitlab.com/omnibus/settings/ssl.html#install-custom-public-certificates). -- If your local GitLab instance was installed using the Helm Charts, you can [add your self-signed certificate to your GitLab instance](https://docs.gitlab.com/runner/install/kubernetes.html#providing-a-custom-certificate-for-accessing-gitlab). +- Add the self-signed certificate from the remote GitLab instance to the + `/etc/gitlab/trusted-certs` directory on the local GitLab instance, and then + run `sudo gitlab-ctl reconfigure` as per the instructions for + [installing custom public certificates](https://docs.gitlab.com/omnibus/settings/ssl.html#install-custom-public-certificates). +- If your local GitLab instance was installed using the Helm Charts, you can + [add your self-signed certificate to your GitLab instance](https://docs.gitlab.com/runner/install/kubernetes.html#providing-a-custom-certificate-for-accessing-gitlab). -You may also get another error when trying to mirror a repository from a remote GitLab instance that uses a self-signed certificate: +You may also get another error message when trying to mirror a repository from +a remote GitLab instance that uses a self-signed certificate: ```shell 2:Fetching remote upstream failed: fatal: unable to access &#39;https://gitlab.domain.tld/root/test-repo/&#39;: @@ -144,12 +163,16 @@ SSL: unable to obtain common name from peer certificate In this case, the problem can be related to the certificate itself: -- Double check that your self-signed certificate is not missing a common name. If it is then regenerate a valid certificate -- add it to `/etc/gitlab/trusted-certs` and run `sudo gitlab-ctl reconfigure` +1. Validate that your self-signed certificate isn't missing a common name. If it + is, regenerate a valid certificate +1. Add the certificate to `/etc/gitlab/trusted-certs`. +1. Run `sudo gitlab-ctl reconfigure`. ## Unable to perform Git operations due to an internal or self-signed certificate -If your GitLab instance is using a self-signed certificate, or the certificate is signed by an internal certificate authority (CA), you might run into the following errors when attempting to perform Git operations: +If your GitLab instance is using a self-signed certificate, or if the +certificate is signed by an internal certificate authority (CA), you might +experience the following errors when attempting to perform Git operations: ```shell $ git clone https://gitlab.domain.tld/group/project.git @@ -165,15 +188,19 @@ fatal: unable to access 'https://gitlab.domain.tld/group/project.git/': server c To fix this problem: -- If possible, use SSH remotes for all Git operations. This is considered more secure and convenient to use. +- If possible, use SSH remotes for all Git operations. This is considered more + secure and convenient to use. - If you must use HTTPS remotes, you can try the following: - - Copy the self signed certificate or the internal root CA certificate to a local directory (for example, `~/.ssl`) and configure Git to trust your certificate: + - Copy the self-signed certificate or the internal root CA certificate to a + local directory (for example, `~/.ssl`) and configure Git to trust your + certificate: ```shell git config --global http.sslCAInfo ~/.ssl/gitlab.domain.tld.crt ``` - - Disable SSL verification in your Git client. Note that this intended as a temporary measure as it could be considered a **security risk**. + - Disable SSL verification in your Git client. Note that this intended as a + temporary measure, as it could be considered a security risk. ```shell git config --global http.sslVerify false @@ -204,10 +231,10 @@ A misconfiguration may result in: message: SSL_connect returned=1 errno=0 state=error: wrong version number (OpenSSL::SSL::SSLError) ``` -Some of these errors come from the Excon Ruby gem, and could be generated in circumstances -where GitLab is configured to initiate an HTTPS session to a remote server -that is serving just HTTP. +Some of these errors come from the Excon Ruby gem, and could be generated in +circumstances where GitLab is configured to initiate an HTTPS session to a +remote server that is serving only HTTP. -One scenario is that you're using [object storage](../object_storage.md) -which is not served under HTTPS. GitLab is misconfigured and attempts a TLS handshake, +One scenario is that you're using [object storage](../object_storage.md), which +isn't served under HTTPS. GitLab is misconfigured and attempts a TLS handshake, but the object storage will respond with plain HTTP. diff --git a/doc/api/deploy_keys.md b/doc/api/deploy_keys.md index 816cba55357..293f7218527 100644 --- a/doc/api/deploy_keys.md +++ b/doc/api/deploy_keys.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/deploy_tokens.md b/doc/api/deploy_tokens.md index 21041a55c2c..2bdec4a0688 100644 --- a/doc/api/deploy_tokens.md +++ b/doc/api/deploy_tokens.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/deployments.md b/doc/api/deployments.md index 7267d898eb4..4a937cd1818 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/api/environments.md b/doc/api/environments.md index 3555e55a250..7340fe9f9e9 100644 --- a/doc/api/environments.md +++ b/doc/api/environments.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/api/feature_flag_specs.md b/doc/api/feature_flag_specs.md index fa44d548a9b..1a0f09d40f4 100644 --- a/doc/api/feature_flag_specs.md +++ b/doc/api/feature_flag_specs.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/feature_flag_user_lists.md b/doc/api/feature_flag_user_lists.md index 5a35c531c3d..3c49c989de6 100644 --- a/doc/api/feature_flag_user_lists.md +++ b/doc/api/feature_flag_user_lists.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/feature_flags.md b/doc/api/feature_flags.md index deeef92e8fa..4f65f649be1 100644 --- a/doc/api/feature_flags.md +++ b/doc/api/feature_flags.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/feature_flags_legacy.md b/doc/api/feature_flags_legacy.md index 7ffe10f01f1..8bc6c67fc82 100644 --- a/doc/api/feature_flags_legacy.md +++ b/doc/api/feature_flags_legacy.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/features.md b/doc/api/features.md index ebeaa3467e4..0582a4b9432 100644 --- a/doc/api/features.md +++ b/doc/api/features.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/freeze_periods.md b/doc/api/freeze_periods.md index d6177c71e00..d26c9248084 100644 --- a/doc/api/freeze_periods.md +++ b/doc/api/freeze_periods.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/api/pages.md b/doc/api/pages.md index 49cd5472dd7..0a79d23b51e 100644 --- a/doc/api/pages.md +++ b/doc/api/pages.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/pages_domains.md b/doc/api/pages_domains.md index 33acc29447d..f9bb8521a1f 100644 --- a/doc/api/pages_domains.md +++ b/doc/api/pages_domains.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/protected_environments.md b/doc/api/protected_environments.md index 1b74558f6a9..487537cd3f5 100644 --- a/doc/api/protected_environments.md +++ b/doc/api/protected_environments.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/api/releases/index.md b/doc/api/releases/index.md index 321b6fa963f..62e08eab7db 100644 --- a/doc/api/releases/index.md +++ b/doc/api/releases/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/api/releases/links.md b/doc/api/releases/links.md index a2f5c33e44b..3208386ee13 100644 --- a/doc/api/releases/links.md +++ b/doc/api/releases/links.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/ci/cloud_deployment/index.md b/doc/ci/cloud_deployment/index.md index 51e5238d1da..b3952560435 100644 --- a/doc/ci/cloud_deployment/index.md +++ b/doc/ci/cloud_deployment/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: howto --- diff --git a/doc/ci/environments/deployment_safety.md b/doc/ci/environments/deployment_safety.md index e04de94ae7e..95419e58d36 100644 --- a/doc/ci/environments/deployment_safety.md +++ b/doc/ci/environments/deployment_safety.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/ci/environments/environments_dashboard.md b/doc/ci/environments/environments_dashboard.md index f6f9bb2bdfb..84f8b1b1dbf 100644 --- a/doc/ci/environments/environments_dashboard.md +++ b/doc/ci/environments/environments_dashboard.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference --- diff --git a/doc/ci/environments/incremental_rollouts.md b/doc/ci/environments/incremental_rollouts.md index 56adb8de293..81acc3a36e9 100644 --- a/doc/ci/environments/incremental_rollouts.md +++ b/doc/ci/environments/incremental_rollouts.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/ci/environments/index.md b/doc/ci/environments/index.md index 1255a588b9e..c1cd5dd29c8 100644 --- a/doc/ci/environments/index.md +++ b/doc/ci/environments/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference disqus_identifier: 'https://docs.gitlab.com/ee/ci/environments.html' diff --git a/doc/ci/environments/protected_environments.md b/doc/ci/environments/protected_environments.md index ab461c7dc1b..461b60f20db 100644 --- a/doc/ci/environments/protected_environments.md +++ b/doc/ci/environments/protected_environments.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/ci/examples/authenticating-with-hashicorp-vault/index.md b/doc/ci/examples/authenticating-with-hashicorp-vault/index.md index 03938ecb34a..42c511fa741 100644 --- a/doc/ci/examples/authenticating-with-hashicorp-vault/index.md +++ b/doc/ci/examples/authenticating-with-hashicorp-vault/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: tutorial --- diff --git a/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md b/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md index 8ee4d70194f..47ec8430ff3 100644 --- a/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md +++ b/doc/ci/examples/deploy_spring_boot_to_cloud_foundry/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: tutorial --- diff --git a/doc/ci/examples/deployment/README.md b/doc/ci/examples/deployment/README.md index 03138bee583..0b7bd784637 100644 --- a/doc/ci/examples/deployment/README.md +++ b/doc/ci/examples/deployment/README.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: tutorial --- diff --git a/doc/ci/examples/deployment/composer-npm-deploy.md b/doc/ci/examples/deployment/composer-npm-deploy.md index 1d1b52026c0..24990264f19 100644 --- a/doc/ci/examples/deployment/composer-npm-deploy.md +++ b/doc/ci/examples/deployment/composer-npm-deploy.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: tutorial --- diff --git a/doc/ci/review_apps/index.md b/doc/ci/review_apps/index.md index 93c56585077..a48a55e49de 100644 --- a/doc/ci/review_apps/index.md +++ b/doc/ci/review_apps/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference --- diff --git a/doc/ci/secrets/index.md b/doc/ci/secrets/index.md index 8a554f27a3d..f6b02d9b8b8 100644 --- a/doc/ci/secrets/index.md +++ b/doc/ci/secrets/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: concepts, howto --- diff --git a/doc/development/cicd/templates.md b/doc/development/cicd/templates.md index 2afd1f59d60..1ab569ba0df 100644 --- a/doc/development/cicd/templates.md +++ b/doc/development/cicd/templates.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: index, concepts, howto --- diff --git a/doc/integration/vault.md b/doc/integration/vault.md index d2186efa0da..7f81fd3a7da 100644 --- a/doc/integration/vault.md +++ b/doc/integration/vault.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference, howto --- diff --git a/doc/operations/feature_flags.md b/doc/operations/feature_flags.md index 22ee330e40e..da1dbf2bba8 100644 --- a/doc/operations/feature_flags.md +++ b/doc/operations/feature_flags.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/security/cicd_environment_variables.md b/doc/security/cicd_environment_variables.md index 219d95908e1..4d60df8e531 100644 --- a/doc/security/cicd_environment_variables.md +++ b/doc/security/cicd_environment_variables.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md b/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md index 745e99b514a..acc4f15f86f 100644 --- a/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md +++ b/doc/topics/autodevops/upgrading_auto_deploy_dependencies.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: reference --- diff --git a/doc/user/project/deploy_boards.md b/doc/user/project/deploy_boards.md index 0d78f06a2dc..251b2bb2fb6 100644 --- a/doc/user/project/deploy_boards.md +++ b/doc/user/project/deploy_boards.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: howto, reference --- diff --git a/doc/user/project/deploy_keys/index.md b/doc/user/project/deploy_keys/index.md index f4d54cc0576..10b4719843f 100644 --- a/doc/user/project/deploy_keys/index.md +++ b/doc/user/project/deploy_keys/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: howto, reference --- diff --git a/doc/user/project/deploy_tokens/index.md b/doc/user/project/deploy_tokens/index.md index 4045241afed..f4309bf5de0 100644 --- a/doc/user/project/deploy_tokens/index.md +++ b/doc/user/project/deploy_tokens/index.md @@ -1,6 +1,6 @@ --- stage: Release -group: Progressive Delivery +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments type: howto --- diff --git a/doc/user/project/pages/custom_domains_ssl_tls_certification/dns_concepts.md b/doc/user/project/pages/custom_domains_ssl_tls_certification/dns_concepts.md index f51184216df..be692d6733d 100644 --- a/doc/user/project/pages/custom_domains_ssl_tls_certification/dns_concepts.md +++ b/doc/user/project/pages/custom_domains_ssl_tls_certification/dns_concepts.md @@ -1,7 +1,7 @@ --- type: concepts stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/custom_domains_ssl_tls_certification/index.md b/doc/user/project/pages/custom_domains_ssl_tls_certification/index.md index dfb3a7f7d83..5d25e01cc57 100644 --- a/doc/user/project/pages/custom_domains_ssl_tls_certification/index.md +++ b/doc/user/project/pages/custom_domains_ssl_tls_certification/index.md @@ -1,7 +1,7 @@ --- disqus_identifier: 'https://docs.gitlab.com/ee/user/project/pages/getting_started_part_three.html' stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md b/doc/user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md index 6a06fe3fb2d..f398a851d94 100644 --- a/doc/user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md +++ b/doc/user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md @@ -2,7 +2,7 @@ type: reference description: "Automatic Let's Encrypt SSL certificates for GitLab Pages." stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/custom_domains_ssl_tls_certification/ssl_tls_concepts.md b/doc/user/project/pages/custom_domains_ssl_tls_certification/ssl_tls_concepts.md index 059f9049384..9d8088d2f43 100644 --- a/doc/user/project/pages/custom_domains_ssl_tls_certification/ssl_tls_concepts.md +++ b/doc/user/project/pages/custom_domains_ssl_tls_certification/ssl_tls_concepts.md @@ -1,7 +1,7 @@ --- type: concepts stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/getting_started/pages_ci_cd_template.md b/doc/user/project/pages/getting_started/pages_ci_cd_template.md index 312466605dd..6dd431e02b0 100644 --- a/doc/user/project/pages/getting_started/pages_ci_cd_template.md +++ b/doc/user/project/pages/getting_started/pages_ci_cd_template.md @@ -1,7 +1,7 @@ --- type: reference, howto stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/getting_started/pages_forked_sample_project.md b/doc/user/project/pages/getting_started/pages_forked_sample_project.md index 89d13393923..031d941d8bd 100644 --- a/doc/user/project/pages/getting_started/pages_forked_sample_project.md +++ b/doc/user/project/pages/getting_started/pages_forked_sample_project.md @@ -1,7 +1,7 @@ --- type: reference, howto stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/getting_started/pages_from_scratch.md b/doc/user/project/pages/getting_started/pages_from_scratch.md index 761328529bb..230e88f35f5 100644 --- a/doc/user/project/pages/getting_started/pages_from_scratch.md +++ b/doc/user/project/pages/getting_started/pages_from_scratch.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/getting_started/pages_new_project_template.md b/doc/user/project/pages/getting_started/pages_new_project_template.md index 1b94a9a1c28..eec8349abe6 100644 --- a/doc/user/project/pages/getting_started/pages_new_project_template.md +++ b/doc/user/project/pages/getting_started/pages_new_project_template.md @@ -1,7 +1,7 @@ --- type: reference, howto stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/getting_started_part_one.md b/doc/user/project/pages/getting_started_part_one.md index 313c51701d2..1be818bd021 100644 --- a/doc/user/project/pages/getting_started_part_one.md +++ b/doc/user/project/pages/getting_started_part_one.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/index.md b/doc/user/project/pages/index.md index 99c3a9ddd66..b54bb71eaca 100644 --- a/doc/user/project/pages/index.md +++ b/doc/user/project/pages/index.md @@ -1,7 +1,7 @@ --- description: 'Learn how to use GitLab Pages to deploy a static website at no additional cost.' stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/introduction.md b/doc/user/project/pages/introduction.md index 17ca0bd7736..9025cfe2fdc 100644 --- a/doc/user/project/pages/introduction.md +++ b/doc/user/project/pages/introduction.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md b/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md index 334961ccbc9..c4d9bbce24b 100644 --- a/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md +++ b/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments description: "How to secure GitLab Pages websites with Let's Encrypt (manual process, deprecated)." --- diff --git a/doc/user/project/pages/pages_access_control.md b/doc/user/project/pages/pages_access_control.md index f74fcb4c2de..9d17277fe9e 100644 --- a/doc/user/project/pages/pages_access_control.md +++ b/doc/user/project/pages/pages_access_control.md @@ -1,7 +1,7 @@ --- type: reference, howto stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/pages/redirects.md b/doc/user/project/pages/redirects.md index 90a63406055..9a562a742fe 100644 --- a/doc/user/project/pages/redirects.md +++ b/doc/user/project/pages/redirects.md @@ -1,6 +1,6 @@ --- stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md index 5e43a02403a..56902b4a82c 100644 --- a/doc/user/project/releases/index.md +++ b/doc/user/project/releases/index.md @@ -1,7 +1,7 @@ --- type: reference, howto stage: Release -group: Release Management +group: Release info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- diff --git a/lib/gitlab/checks/snippet_check.rb b/lib/gitlab/checks/snippet_check.rb index 8c61b782baa..54aee7f6ef7 100644 --- a/lib/gitlab/checks/snippet_check.rb +++ b/lib/gitlab/checks/snippet_check.rb @@ -26,6 +26,10 @@ module Gitlab end true + rescue GitAccess::ForbiddenError => e + Gitlab::ErrorTracking.log_exception(e, default_branch: @default_branch, branch_name: @branch_name, creation: creation?, deletion: deletion?) + + raise e end private diff --git a/lib/gitlab/ci/templates/npm.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/npm.latest.gitlab-ci.yml new file mode 100644 index 00000000000..536cf9bd8d8 --- /dev/null +++ b/lib/gitlab/ci/templates/npm.latest.gitlab-ci.yml @@ -0,0 +1,41 @@ +publish: + image: node:latest + stage: deploy + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_REF_NAME =~ /^v\d+\.\d+\.\d+.*$/ + changes: + - package.json + script: + # If no .npmrc if included in the repo, generate a temporary one that is configured to publish to GitLab's NPM registry + - | + if [[ ! -f .npmrc ]]; then + echo 'No .npmrc found! Creating one now. Please review the following link for more information: https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#project-level-npm-endpoint-1' + { + echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/" + echo "${CI_API_V4_URL#http*:}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=\${CI_JOB_TOKEN}" + } >> .npmrc + fi + - echo "Created the following .npmrc:"; cat .npmrc + + # Extract a few values from package.json + - NPM_PACKAGE_NAME=$(node -p "require('./package.json').name") + - NPM_PACKAGE_VERSION=$(node -p "require('./package.json').version") + + # Validate that the package name is properly scoped to the project's root namespace. + # For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#package-naming-convention + - | + if [[ ! $NPM_PACKAGE_NAME =~ ^@$CI_PROJECT_ROOT_NAMESPACE/ ]]; then + echo "Invalid package scope! Packages must be scoped in the root namespace of the project, e.g. \"@${CI_PROJECT_ROOT_NAMESPACE}/${CI_PROJECT_NAME}\"" + echo 'For more information, see https://docs.gitlab.com/ee/user/packages/npm_registry/#package-naming-convention' + exit 1 + fi + + # Compare the version in package.json to all published versions. + # If the package.json version has not yet been published, run `npm publish`. + - | + if [[ $(npm view "${NPM_PACKAGE_NAME}" versions) != *"'${NPM_PACKAGE_VERSION}'"* ]]; then + npm publish + echo "Successfully published version ${NPM_PACKAGE_VERSION} of ${NPM_PACKAGE_NAME} to GitLab's NPM registry: ${CI_PROJECT_URL}/-/packages" + else + echo "Version ${NPM_PACKAGE_VERSION} of ${NPM_PACKAGE_NAME} has already been published, so no new version has been published." + fi diff --git a/lib/gitlab/danger/commit_linter.rb b/lib/gitlab/danger/commit_linter.rb index 2e469359bdc..5f4c3688437 100644 --- a/lib/gitlab/danger/commit_linter.rb +++ b/lib/gitlab/danger/commit_linter.rb @@ -114,15 +114,11 @@ module Gitlab end details&.each_line do |line| - line = line.strip - - next unless line_too_long?(line) - - url_size = line.scan(%r((https?://\S+))).sum { |(url)| url.length } + line_without_urls = line.strip.gsub(%r{https?://\S+}, '') # If the line includes a URL, we'll allow it to exceed MAX_LINE_LENGTH characters, but # only if the line _without_ the URL does not exceed this limit. - next unless line_too_long?(line.length - url_size) + next unless line_too_long?(line_without_urls) add_problem(:details_line_too_long) break @@ -172,14 +168,7 @@ module Gitlab end def line_too_long?(line) - case line - when String - line.length > MAX_LINE_LENGTH - when Integer - line > MAX_LINE_LENGTH - else - raise ArgumentError, "The line argument (#{line}) should be a String or an Integer! #{line.class} given." - end + line.length > MAX_LINE_LENGTH end def subject_too_short? diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb index 7f68ea74798..d22f28ff7f2 100644 --- a/lib/gitlab/danger/helper.rb +++ b/lib/gitlab/danger/helper.rb @@ -64,7 +64,7 @@ module Gitlab # - respond_to?(:gitlab) # - respond_to?(:gitlab, true) gitlab - rescue NoMethodError + rescue NameError nil end diff --git a/lib/gitlab/database/reindexing/concurrent_reindex.rb b/lib/gitlab/database/reindexing/concurrent_reindex.rb index fd3dca88567..a6fe7d61a4f 100644 --- a/lib/gitlab/database/reindexing/concurrent_reindex.rb +++ b/lib/gitlab/database/reindexing/concurrent_reindex.rb @@ -59,6 +59,13 @@ module Gitlab raise ReindexError, "failed to reindex #{index}: #{message}" end + # Some expression indexes (aka functional indexes) + # require additional statistics. The existing statistics + # are tightly bound to the original index. We have to + # rebuild statistics for the new index before dropping + # the original one. + rebuild_statistics if index.expression? + yield replacement_index ensure begin @@ -96,6 +103,14 @@ module Gitlab end end + def rebuild_statistics + logger.info("rebuilding table statistics for #{index.schema}.#{index.tablename}") + + connection.execute(<<~SQL) + ANALYZE #{quote_table_name(index.schema)}.#{quote_table_name(index.tablename)} + SQL + end + def replacement_index_name @replacement_index_name ||= "#{TEMPORARY_INDEX_PREFIX}#{index.indexrelid}" end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d27d6f6604d..86324950e94 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -3511,6 +3511,9 @@ msgid_plural "ApprovalRuleSummary|%{count} approvals required from %{membersCoun msgstr[0] "" msgstr[1] "" +msgid "ApprovalRule|Approval rules" +msgstr "" + msgid "ApprovalRule|Approvers" msgstr "" @@ -23877,9 +23880,6 @@ msgstr "" msgid "SearchAutocomplete|in project %{projectName}" msgstr "" -msgid "SearchCodeResults|in" -msgstr "" - msgid "SearchCodeResults|of %{link_to_project}" msgstr "" @@ -32250,6 +32250,9 @@ msgstr "" msgid "import flow" msgstr "" +msgid "in" +msgstr "" + msgid "in group %{link_to_group}" msgstr "" diff --git a/package.json b/package.json index ded5488b2b2..db0300f8bd5 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@babel/preset-env": "^7.10.1", "@gitlab/at.js": "1.5.5", "@gitlab/svgs": "1.175.0", - "@gitlab/ui": "24.3.1", + "@gitlab/ui": "24.3.2", "@gitlab/visual-review-tools": "1.6.1", "@rails/actioncable": "^6.0.3-3", "@rails/ujs": "^6.0.3-2", diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 0720124ea57..e1405660ccb 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -1149,11 +1149,17 @@ RSpec.describe Projects::PipelinesController do end end - describe 'GET config_variables.json' do + describe 'GET config_variables.json', :use_clean_rails_memory_store_caching do + include ReactiveCachingHelpers + let(:result) { YAML.dump(ci_config) } + let(:service) { Ci::ListConfigVariablesService.new(project, user) } before do stub_gitlab_ci_yml_for_sha(sha, result) + allow(Ci::ListConfigVariablesService) + .to receive(:new) + .and_return(service) end context 'when sending a valid sha' do @@ -1170,6 +1176,10 @@ RSpec.describe Projects::PipelinesController do } end + before do + synchronous_reactive_cache(service) + end + it 'returns variable list' do get_config_variables @@ -1182,6 +1192,10 @@ RSpec.describe Projects::PipelinesController do let(:sha) { 'invalid-sha' } let(:ci_config) { nil } + before do + synchronous_reactive_cache(service) + end + it 'returns empty json' do get_config_variables @@ -1204,6 +1218,10 @@ RSpec.describe Projects::PipelinesController do } end + before do + synchronous_reactive_cache(service) + end + it 'returns empty result' do get_config_variables @@ -1212,6 +1230,27 @@ RSpec.describe Projects::PipelinesController do end end + context 'when the cache is empty' do + let(:sha) { 'master' } + let(:ci_config) do + { + variables: { + KEY1: { value: 'val 1', description: 'description 1' } + }, + test: { + stage: 'test', + script: 'echo' + } + } + end + + it 'returns no content' do + get_config_variables + + expect(response).to have_gitlab_http_status(:no_content) + end + end + private def stub_gitlab_ci_yml_for_sha(sha, result) diff --git a/spec/features/profiles/active_sessions_spec.rb b/spec/features/profiles/active_sessions_spec.rb index ff969a7786d..45e71320ff2 100644 --- a/spec/features/profiles/active_sessions_spec.rb +++ b/spec/features/profiles/active_sessions_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state do let(:admin) { create(:admin) } it 'User sees their active sessions' do - Timecop.freeze(Time.zone.parse('2018-03-12 09:06')) do + travel_to(Time.zone.parse('2018-03-12 09:06')) do Capybara::Session.new(:session1) Capybara::Session.new(:session2) Capybara::Session.new(:session3) diff --git a/spec/features/projects/environments/environment_metrics_spec.rb b/spec/features/projects/environments/environment_metrics_spec.rb index 8315c821b6d..e8f197b67c2 100644 --- a/spec/features/projects/environments/environment_metrics_spec.rb +++ b/spec/features/projects/environments/environment_metrics_spec.rb @@ -22,7 +22,7 @@ RSpec.describe 'Environment > Metrics' do end around do |example| - Timecop.freeze(current_time) { example.run } + travel_to(current_time) { example.run } end shared_examples 'has environment selector' do diff --git a/spec/frontend/fixtures/search.rb b/spec/frontend/fixtures/search.rb index 7819d0774a7..f43ed2cfbd3 100644 --- a/spec/frontend/fixtures/search.rb +++ b/spec/frontend/fixtures/search.rb @@ -67,8 +67,8 @@ RSpec.describe SearchController, '(JavaScript fixtures)', type: :controller do end it 'search/blob_search_result.html' do - expect_next_instance_of(SearchService) do |search_service| - expect(search_service).to receive(:search_objects).and_return(blobs) + allow_next_instance_of(SearchServicePresenter) do |search_service| + allow(search_service).to receive(:search_objects).and_return(blobs) end get :show, params: { diff --git a/spec/lib/atlassian/jira_connect/client_spec.rb b/spec/lib/atlassian/jira_connect/client_spec.rb index cefd1fa3274..c260c6404f5 100644 --- a/spec/lib/atlassian/jira_connect/client_spec.rb +++ b/spec/lib/atlassian/jira_connect/client_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Atlassian::JiraConnect::Client do subject { described_class.new('https://gitlab-test.atlassian.net', 'sample_secret') } around do |example| - Timecop.freeze { example.run } + freeze_time { example.run } end describe '.generate_update_sequence_id' do diff --git a/spec/lib/gitlab/anonymous_session_spec.rb b/spec/lib/gitlab/anonymous_session_spec.rb index 671d452ad13..245ca02e91a 100644 --- a/spec/lib/gitlab/anonymous_session_spec.rb +++ b/spec/lib/gitlab/anonymous_session_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Gitlab::AnonymousSession, :clean_gitlab_redis_shared_state do end it 'adds expiration time to key' do - Timecop.freeze do + freeze_time do subject.count_session_ip Gitlab::Redis::SharedState.with do |redis| diff --git a/spec/lib/gitlab/checks/snippet_check_spec.rb b/spec/lib/gitlab/checks/snippet_check_spec.rb index 037de8e9369..5e1aedcaff8 100644 --- a/spec/lib/gitlab/checks/snippet_check_spec.rb +++ b/spec/lib/gitlab/checks/snippet_check_spec.rb @@ -9,6 +9,9 @@ RSpec.describe Gitlab::Checks::SnippetCheck do let(:user_access) { Gitlab::UserAccessSnippet.new(user, snippet: snippet) } let(:default_branch) { snippet.default_branch } + let(:branch_name) { default_branch } + let(:creation) { false } + let(:deletion) { false } subject { Gitlab::Checks::SnippetCheck.new(changes, default_branch: default_branch, logger: logger) } @@ -17,11 +20,19 @@ RSpec.describe Gitlab::Checks::SnippetCheck do expect { subject.validate! }.not_to raise_error end + shared_examples 'raises and logs error' do + specify do + expect(Gitlab::ErrorTracking).to receive(:log_exception).with(instance_of(Gitlab::GitAccess::ForbiddenError), default_branch: default_branch, branch_name: branch_name, creation: creation, deletion: deletion) + + expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, 'You can not create or delete branches.') + end + end + context 'trying to delete the branch' do let(:newrev) { '0000000000000000000000000000000000000000' } - it 'raises an error' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, 'You can not create or delete branches.') + it_behaves_like 'raises and logs error' do + let(:deletion) { true } end end @@ -29,8 +40,9 @@ RSpec.describe Gitlab::Checks::SnippetCheck do let(:oldrev) { '0000000000000000000000000000000000000000' } let(:ref) { 'refs/heads/feature' } - it 'raises an error' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, 'You can not create or delete branches.') + it_behaves_like 'raises and logs error' do + let(:creation) { true } + let(:branch_name) { 'feature' } end context "when branch is 'master'" do @@ -45,8 +57,8 @@ RSpec.describe Gitlab::Checks::SnippetCheck do context 'when default_branch is nil' do let(:default_branch) { nil } - it 'raises an error' do - expect { subject.validate! }.to raise_error(Gitlab::GitAccess::ForbiddenError, 'You can not create or delete branches.') + it_behaves_like 'raises and logs error' do + let(:branch_name) { 'master' } end end end diff --git a/spec/lib/gitlab/ci/templates/npm_spec.rb b/spec/lib/gitlab/ci/templates/npm_spec.rb new file mode 100644 index 00000000000..1f8e32ce019 --- /dev/null +++ b/spec/lib/gitlab/ci/templates/npm_spec.rb @@ -0,0 +1,92 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'npm.latest.gitlab-ci.yml' do + subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('npm.latest') } + + describe 'the created pipeline' do + let_it_be(:user) { create(:admin) } + + let(:repo_files) { { 'package.json' => '{}', 'README.md' => '' } } + let(:modified_files) { %w[package.json] } + let(:project) { create(:project, :custom_repo, files: repo_files) } + let(:pipeline_branch) { project.default_branch } + let(:pipeline_tag) { 'v1.2.1' } + let(:pipeline_ref) { pipeline_branch } + let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_ref ) } + let(:pipeline) { service.execute!(:push) } + let(:build_names) { pipeline.builds.pluck(:name) } + + def create_branch(name:) + ::Branches::CreateService.new(project, user).execute(name, project.default_branch) + end + + def create_tag(name:) + ::Tags::CreateService.new(project, user).execute(name, project.default_branch, nil) + end + + before do + stub_ci_pipeline_yaml_file(template.content) + + create_branch(name: pipeline_branch) + create_tag(name: pipeline_tag) + + allow_any_instance_of(Ci::Pipeline).to receive(:modified_paths).and_return(modified_files) + end + + shared_examples 'publish job created' do + it 'creates a pipeline with a single job: publish' do + expect(build_names).to eq(%w[publish]) + end + end + + shared_examples 'no pipeline created' do + it 'does not create a pipeline because the only job (publish) is not created' do + expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError, 'No stages / jobs for this pipeline.') + end + end + + context 'on default branch' do + context 'when package.json has been changed' do + it_behaves_like 'publish job created' + end + + context 'when package.json does not exist or has not been changed' do + let(:modified_files) { %w[README.md] } + + it_behaves_like 'no pipeline created' + end + end + + %w[v1.0.0 v2.1.0-alpha].each do |valid_version| + context "when the branch name is #{valid_version}" do + let(:pipeline_branch) { valid_version } + + it_behaves_like 'publish job created' + end + + context "when the tag name is #{valid_version}" do + let(:pipeline_tag) { valid_version } + let(:pipeline_ref) { pipeline_tag } + + it_behaves_like 'publish job created' + end + end + + %w[patch-1 my-feature-branch v1 v1.0 2.1.0].each do |invalid_version| + context "when the branch name is #{invalid_version}" do + let(:pipeline_branch) { invalid_version } + + it_behaves_like 'no pipeline created' + end + + context "when the tag name is #{invalid_version}" do + let(:pipeline_tag) { invalid_version } + let(:pipeline_ref) { pipeline_tag } + + it_behaves_like 'no pipeline created' + end + end + end +end diff --git a/spec/lib/gitlab/danger/commit_linter_spec.rb b/spec/lib/gitlab/danger/commit_linter_spec.rb index ebfeedba700..35d9f5021cc 100644 --- a/spec/lib/gitlab/danger/commit_linter_spec.rb +++ b/spec/lib/gitlab/danger/commit_linter_spec.rb @@ -300,8 +300,10 @@ RSpec.describe Gitlab::Danger::CommitLinter do end end - context 'when details exceeds the max line length including a URL' do - let(:commit_message) { "A B C\n\nhttps://gitlab.com" + 'D' * described_class::MAX_LINE_LENGTH } + context 'when details exceeds the max line length including URLs' do + let(:commit_message) do + "A B C\n\nsome message with https://example.com and https://gitlab.com" + 'D' * described_class::MAX_LINE_LENGTH + end it_behaves_like 'a valid commit' end diff --git a/spec/lib/gitlab/danger/helper_spec.rb b/spec/lib/gitlab/danger/helper_spec.rb index faf49632e49..a8f113a8cd1 100644 --- a/spec/lib/gitlab/danger/helper_spec.rb +++ b/spec/lib/gitlab/danger/helper_spec.rb @@ -33,6 +33,16 @@ RSpec.describe Gitlab::Danger::Helper do expect(helper.gitlab_helper).to eq(fake_gitlab) end end + + context 'when danger gitlab plugin is not available' do + it 'returns nil' do + invalid_danger = Class.new do + include Gitlab::Danger::Helper + end.new + + expect(invalid_danger.gitlab_helper).to be_nil + end + end end describe '#release_automation?' do diff --git a/spec/lib/gitlab/database/reindexing/concurrent_reindex_spec.rb b/spec/lib/gitlab/database/reindexing/concurrent_reindex_spec.rb index 2d6765aac2e..51fc7c6620b 100644 --- a/spec/lib/gitlab/database/reindexing/concurrent_reindex_spec.rb +++ b/spec/lib/gitlab/database/reindexing/concurrent_reindex_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do let(:table_name) { '_test_reindex_table' } let(:column_name) { '_test_column' } let(:index_name) { '_test_reindex_index' } - let(:index) { instance_double(Gitlab::Database::PostgresIndex, indexrelid: 42, name: index_name, schema: 'public', partitioned?: false, unique?: false, exclusion?: false, definition: 'CREATE INDEX _test_reindex_index ON public._test_reindex_table USING btree (_test_column)') } + let(:index) { instance_double(Gitlab::Database::PostgresIndex, indexrelid: 42, name: index_name, schema: 'public', tablename: table_name, partitioned?: false, unique?: false, exclusion?: false, expression?: false, definition: 'CREATE INDEX _test_reindex_index ON public._test_reindex_table USING btree (_test_column)') } let(:logger) { double('logger', debug: nil, info: nil, error: nil ) } let(:connection) { ActiveRecord::Base.connection } @@ -130,6 +130,36 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do check_index_exists end + context 'for expression indexes' do + before do + allow(index).to receive(:expression?).and_return(true) + end + + it 'rebuilds table statistics before dropping the original index' do + expect(connection).to receive(:execute).with('SET statement_timeout TO \'21600s\'').twice + + expect_to_execute_concurrently_in_order(create_index) + + expect_to_execute_concurrently_in_order(<<~SQL) + ANALYZE "#{index.schema}"."#{index.tablename}" + SQL + + expect_next_instance_of(::Gitlab::Database::WithLockRetries) do |instance| + expect(instance).to receive(:run).with(raise_on_exhaustion: true).and_yield + end + + expect_index_rename(index.name, replaced_name) + expect_index_rename(replacement_name, index.name) + expect_index_rename(replaced_name, replacement_name) + + expect_to_execute_concurrently_in_order(drop_index) + + subject.perform + + check_index_exists + end + end + context 'when a dangling index is left from a previous run' do before do connection.execute("CREATE INDEX #{replacement_name} ON #{table_name} (#{column_name})") diff --git a/spec/models/container_repository_spec.rb b/spec/models/container_repository_spec.rb index 2adceb1c960..0ecefff3a97 100644 --- a/spec/models/container_repository_spec.rb +++ b/spec/models/container_repository_spec.rb @@ -188,7 +188,7 @@ RSpec.describe ContainerRepository do subject { repository.start_expiration_policy! } it 'sets the expiration policy started at to now' do - Timecop.freeze do + freeze_time do expect { subject } .to change { repository.expiration_policy_started_at }.from(nil).to(Time.zone.now) end diff --git a/spec/models/pages/lookup_path_spec.rb b/spec/models/pages/lookup_path_spec.rb index 632313f26d3..30712af6b32 100644 --- a/spec/models/pages/lookup_path_spec.rb +++ b/spec/models/pages/lookup_path_spec.rb @@ -65,7 +65,7 @@ RSpec.describe Pages::LookupPath do end it 'uses deployment from object storage' do - Timecop.freeze do + freeze_time do expect(source).to( eq({ type: 'zip', @@ -85,7 +85,7 @@ RSpec.describe Pages::LookupPath do end it 'uses file protocol' do - Timecop.freeze do + freeze_time do expect(source).to( eq({ type: 'zip', diff --git a/spec/models/project_feature_usage_spec.rb b/spec/models/project_feature_usage_spec.rb index d55d41fab85..cd70602fc4d 100644 --- a/spec/models/project_feature_usage_spec.rb +++ b/spec/models/project_feature_usage_spec.rb @@ -25,7 +25,7 @@ RSpec.describe ProjectFeatureUsage, type: :model do subject { project.feature_usage } it 'logs Jira DVCS Cloud last sync' do - Timecop.freeze do + freeze_time do subject.log_jira_dvcs_integration_usage expect(subject.jira_dvcs_server_last_sync_at).to be_nil @@ -34,7 +34,7 @@ RSpec.describe ProjectFeatureUsage, type: :model do end it 'logs Jira DVCS Server last sync' do - Timecop.freeze do + freeze_time do subject.log_jira_dvcs_integration_usage(cloud: false) expect(subject.jira_dvcs_server_last_sync_at).to be_like_time(Time.current) diff --git a/spec/presenters/search_service_presenter_spec.rb b/spec/presenters/search_service_presenter_spec.rb new file mode 100644 index 00000000000..06ece838d8d --- /dev/null +++ b/spec/presenters/search_service_presenter_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe SearchServicePresenter do + let(:user) { create(:user) } + let(:search_service) { SearchService.new(user, search: search, scope: scope) } + let(:presenter) { described_class.new(search_service, current_user: user) } + + describe '#show_results_status?' do + using RSpec::Parameterized::TableSyntax + + let(:search) { '' } + let(:scope) { nil } + + before do + allow(presenter).to receive(:search_objects).and_return([]) + allow(presenter).to receive(:without_count?).and_return(!with_count) + allow(presenter).to receive(:show_snippets?).and_return(show_snippets) + allow(presenter).to receive(:show_sort_dropdown?).and_return(show_sort_dropdown) + end + + where(:with_count, :show_snippets, :show_sort_dropdown, :result) do + true | true | true | true + false | true | false | true + false | false | true | true + false | false | false | false + end + + with_them do + it { expect(presenter.show_results_status?).to eq(result) } + end + end +end diff --git a/spec/requests/api/v3/github_spec.rb b/spec/requests/api/v3/github_spec.rb index 86ddf4a78d8..e7d9ba99743 100644 --- a/spec/requests/api/v3/github_spec.rb +++ b/spec/requests/api/v3/github_spec.rb @@ -383,7 +383,7 @@ RSpec.describe API::V3::Github do it 'counts Jira Cloud integration as enabled' do user_agent = 'Jira DVCS Connector Vertigo/4.42.0' - Timecop.freeze do + freeze_time do jira_get v3_api("/repos/#{project.namespace.path}/#{project.path}/branches", user), user_agent expect(project.reload.jira_dvcs_cloud_last_sync_at).to be_like_time(Time.now) @@ -393,7 +393,7 @@ RSpec.describe API::V3::Github do it 'counts Jira Server integration as enabled' do user_agent = 'Jira DVCS Connector/3.2.4' - Timecop.freeze do + freeze_time do jira_get v3_api("/repos/#{project.namespace.path}/#{project.path}/branches", user), user_agent expect(project.reload.jira_dvcs_server_last_sync_at).to be_like_time(Time.now) diff --git a/spec/services/ci/list_config_variables_service_spec.rb b/spec/services/ci/list_config_variables_service_spec.rb index 95c98c2b5ef..1735f4cfc97 100644 --- a/spec/services/ci/list_config_variables_service_spec.rb +++ b/spec/services/ci/list_config_variables_service_spec.rb @@ -2,7 +2,9 @@ require 'spec_helper' -RSpec.describe Ci::ListConfigVariablesService do +RSpec.describe Ci::ListConfigVariablesService, :use_clean_rails_memory_store_caching do + include ReactiveCachingHelpers + let(:project) { create(:project, :repository) } let(:user) { project.creator } let(:service) { described_class.new(project, user) } @@ -31,6 +33,10 @@ RSpec.describe Ci::ListConfigVariablesService do } end + before do + synchronous_reactive_cache(service) + end + it 'returns variable list' do expect(subject['KEY1']).to eq({ value: 'val 1', description: 'description 1' }) expect(subject['KEY2']).to eq({ value: 'val 2', description: '' }) @@ -65,6 +71,8 @@ RSpec.describe Ci::ListConfigVariablesService do HEREDOC end end + + synchronous_reactive_cache(service) end it 'returns variable list' do @@ -77,6 +85,10 @@ RSpec.describe Ci::ListConfigVariablesService do let(:sha) { 'invalid-sha' } let(:ci_config) { nil } + before do + synchronous_reactive_cache(service) + end + it 'returns empty json' do expect(subject).to eq({}) end @@ -96,11 +108,44 @@ RSpec.describe Ci::ListConfigVariablesService do } end + before do + synchronous_reactive_cache(service) + end + it 'returns empty result' do expect(subject).to eq({}) end end + context 'when reading from cache' do + let(:sha) { 'master' } + let(:ci_config) { {} } + let(:reactive_cache_params) { [sha] } + let(:return_value) { { 'KEY1' => { value: 'val 1', description: 'description 1' } } } + + before do + stub_reactive_cache(service, return_value, reactive_cache_params) + end + + it 'returns variable list' do + expect(subject).to eq(return_value) + end + end + + context 'when the cache is empty' do + let(:sha) { 'master' } + let(:ci_config) { {} } + let(:reactive_cache_params) { [sha] } + + it 'returns nil and enquques the worker to fill cache' do + expect(ExternalServiceReactiveCachingWorker) + .to receive(:perform_async) + .with(service.class, service.id, *reactive_cache_params) + + expect(subject).to be_nil + end + end + private def stub_gitlab_ci_yml_for_sha(sha, result) diff --git a/spec/views/search/_results.html.haml_spec.rb b/spec/views/search/_results.html.haml_spec.rb index 6299fd0cf36..c1c31084677 100644 --- a/spec/views/search/_results.html.haml_spec.rb +++ b/spec/views/search/_results.html.haml_spec.rb @@ -3,17 +3,23 @@ require 'spec_helper' RSpec.describe 'search/_results' do + let(:user) { create(:user) } let(:search_objects) { Issue.page(1).per(2) } let(:scope) { 'issues' } + let(:term) { 'foo' } before do controller.params[:action] = 'show' + controller.params[:search] = term create_list(:issue, 3) @search_objects = search_objects @scope = scope - @search_term = 'foo' + @search_term = term + @search_service = SearchServicePresenter.new(SearchService.new(user, search: term, scope: scope)) + + allow(@search_service).to receive(:search_objects).and_return(search_objects) end it 'displays the page size' do diff --git a/yarn.lock b/yarn.lock index 1d4289a7c81..231e0043eb1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -866,10 +866,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.175.0.tgz#734f341784af1cd1d62d160a17bcdfb61ff7b04d" integrity sha512-gXpc87TGSXIzfAr4QER1Qw1v3P47pBO6BXkma52blgwXVmcFNe3nhQzqsqt66wKNzrIrk3lAcB4GUyPHbPVXpg== -"@gitlab/ui@24.3.1": - version "24.3.1" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-24.3.1.tgz#3bc40a1e33326fa89cf25d29afa1628c0ab59684" - integrity sha512-m2/Q/vuWrDt5ZGcdbf7VB6h152VtDA+BeVZu1T8RxzQGzgCJ9XnRqb8wTvW4KOXzdbsY/iqCHPRYhZKVrnakqg== +"@gitlab/ui@24.3.2": + version "24.3.2" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-24.3.2.tgz#cba9a1efd7a05a0110de3b23e7cd97917023d500" + integrity sha512-p7lXZlMfK7Eovrle7FZ14wgfb2SKt2uYJj71XXFMUA+GUFpjkteU8UD/K+moTmSk16FB7nd6W6w8TJYAX8TzmA== dependencies: "@babel/standalone" "^7.0.0" "@gitlab/vue-toasted" "^1.3.0" |