Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-04-20 09:09:31 +00:00
parent a3ed0d253d
commit 79347b42ae
15 changed files with 81 additions and 35 deletions

View File

@ -5,6 +5,7 @@ query getSecurityTrainingUrls($projectFullPath: ID!, $identifierExternalIds: [St
name
status
url
identifier
}
}
}

View File

@ -10,6 +10,8 @@ module Routing
sortDesc
state
tab
glm_source
glm_content
].freeze
def initialize(request_object, group, project)

View File

@ -198,7 +198,7 @@ module Ci
# Create a separate worker for each new operation
before_transition [:created, :waiting_for_resource, :preparing, :pending] => :running do |pipeline|
pipeline.started_at = Time.current
pipeline.started_at ||= Time.current
end
before_transition any => [:success, :failed, :canceled] do |pipeline|

View File

@ -1,16 +1,16 @@
= form_for @application_setting, url: repository_admin_application_settings_path(anchor: 'js-repository-storage-settings'), html: { class: 'fieldset-form' } do |f|
= gitlab_ui_form_for @application_setting, url: repository_admin_application_settings_path(anchor: 'js-repository-storage-settings'), html: { class: 'fieldset-form' } do |f|
= form_errors(@application_setting)
%fieldset
.sub-section
%h4= _('Hashed repository storage paths')
.form-group
.form-check
= f.check_box :hashed_storage_enabled, class: 'form-check-input qa-hashed-storage-checkbox', disabled: @application_setting.hashed_storage_enabled?
= f.label :hashed_storage_enabled, _('Use hashed storage'), class: 'label-bold form-check-label'
.form-text.text-muted
= _('Use hashed storage paths for newly created and renamed repositories. Always enabled since 13.0.')
= link_to s_('Learn more.'), help_page_path('administration/repository_storage_types.md', anchor: 'hashed-storage'), target: '_blank', rel: 'noopener noreferrer'
- repository_storage_help_link_url = help_page_path('administration/repository_storage_types.md')
- repository_storage_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: repository_storage_help_link_url }
= f.gitlab_ui_checkbox_component :hashed_storage_enabled,
_('Use hashed storage'),
checkbox_options: { disabled: @application_setting.hashed_storage_enabled? },
help_text: _('Use hashed storage paths for newly created and renamed repositories. Always enabled since 13.0. %{link_start}Learn more.%{link_end}').html_safe % { link_start: repository_storage_help_link_start, link_end: '</a>'.html_safe }
.sub-section
%h4= _("Storage nodes for new repositories")

View File

@ -3,7 +3,7 @@ table_name: ci_sources_pipelines
classes:
- Ci::Sources::Pipeline
feature_categories:
- continuous_integration
description: TODO
- pipeline_authoring
description: It stores parent-child and cross-project pipeline relationships.
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/163983e0d7d1dab622846441bd0dd9086c78a69f
milestone: '9.3'

View File

@ -0,0 +1,8 @@
# frozen_string_literal: true
class AddLastRepositoryUpdatedAtToProjectRepositoryState < Gitlab::Database::Migration[1.0]
def change
add_column :project_repository_states, :last_repository_updated_at, :datetime_with_timezone
add_column :project_repository_states, :last_wiki_updated_at, :datetime_with_timezone
end
end

View File

@ -0,0 +1 @@
eeb0e38915de7053811e36b0829a21472c041131d1399ebaf14811d407a43f1b

View File

@ -19338,7 +19338,9 @@ CREATE TABLE project_repository_states (
repository_retry_count integer,
wiki_retry_count integer,
last_repository_verification_ran_at timestamp with time zone,
last_wiki_verification_ran_at timestamp with time zone
last_wiki_verification_ran_at timestamp with time zone,
last_repository_updated_at timestamp with time zone,
last_wiki_updated_at timestamp with time zone
);
CREATE SEQUENCE project_repository_states_id_seq

View File

@ -70,7 +70,7 @@ The following API resources are available in the project context:
| [Project milestones](milestones.md) | `/projects/:id/milestones` |
| [Project snippets](project_snippets.md) | `/projects/:id/snippets` |
| [Project templates](project_templates.md) | `/projects/:id/templates` |
| [Project vulnerabilities](project_vulnerabilities.md) **(ULTIMATE)** | `/projects/:id/templates` |
| [Project vulnerabilities](project_vulnerabilities.md) **(ULTIMATE)** | `/projects/:id/vulnerabilities` |
| [Project wikis](wikis.md) | `/projects/:id/wikis` |
| [Project-level variables](project_level_variables.md) | `/projects/:id/variables` |
| [Projects](projects.md) including setting Webhooks | `/projects`, `/projects/:id/hooks` (also available for users) |

View File

@ -36,23 +36,25 @@ module API
requires :status, type: String, values: POSSIBLE_VALUES, desc: 'The migration step status'
end
put 'internal/registry/repositories/*repository_path/migration/status' do
repository = find_repository!(declared_params[:repository_path])
::Gitlab::Database::LoadBalancing::Session.current.use_primary do
repository = find_repository!(declared_params[:repository_path])
unless repository.migration_in_active_state?
bad_request!("Wrong migration state (#{repository.migration_state})")
end
unless repository.migration_in_active_state?
bad_request!("Wrong migration state (#{repository.migration_state})")
end
case declared_params[:status]
when STATUS_PRE_IMPORT_COMPLETE
unless repository.finish_pre_import_and_start_import
bad_request!("Couldn't transition from pre_importing to importing")
case declared_params[:status]
when STATUS_PRE_IMPORT_COMPLETE
unless repository.finish_pre_import_and_start_import
bad_request!("Couldn't transition from pre_importing to importing")
end
when STATUS_IMPORT_COMPLETE
unless repository.finish_import
bad_request!("Couldn't transition from importing to import_done")
end
when STATUS_IMPORT_FAILED, STATUS_PRE_IMPORT_FAILED
repository.abort_import
end
when STATUS_IMPORT_COMPLETE
unless repository.finish_import
bad_request!("Couldn't transition from importing to import_done")
end
when STATUS_IMPORT_FAILED, STATUS_PRE_IMPORT_FAILED
repository.abort_import
end
status 200

View File

@ -40870,7 +40870,7 @@ msgstr ""
msgid "Use hashed storage"
msgstr ""
msgid "Use hashed storage paths for newly created and renamed repositories. Always enabled since 13.0."
msgid "Use hashed storage paths for newly created and renamed repositories. Always enabled since 13.0. %{link_start}Learn more.%{link_end}"
msgstr ""
msgid "Use issue count"

View File

@ -11,7 +11,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
let_it_be(:namespace) { create_default(:namespace).freeze }
let_it_be(:project) { create_default(:project, :repository).freeze }
it 'paginates 15 pipeleines per page' do
it 'paginates 15 pipelines per page' do
expect(described_class.default_per_page).to eq(15)
end
@ -552,7 +552,7 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
it { is_expected.to be_truthy }
end
context 'when both sha and source_sha do not matche' do
context 'when both sha and source_sha do not match' do
let(:pipeline) { build(:ci_pipeline, sha: 'test', source_sha: 'test') }
it { is_expected.to be_falsy }
@ -1534,6 +1534,21 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do
expect(pipeline.started_at).to be_nil
end
end
context 'from success' do
let(:started_at) { 2.days.ago }
let(:from_status) { :success }
before do
pipeline.update!(started_at: started_at)
end
it 'does not update on transitioning to running' do
pipeline.run
expect(pipeline.started_at).to eq started_at
end
end
end
describe '#finished_at' do

View File

@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe API::Internal::ContainerRegistry::Migration do
RSpec.describe API::Internal::ContainerRegistry::Migration, :aggregate_failures do
let_it_be_with_reload(:repository) { create(:container_repository) }
let(:secret_token) { 'secret_token' }
@ -147,6 +147,17 @@ RSpec.describe API::Internal::ContainerRegistry::Migration do
it_behaves_like 'returning an error', returning_status: :not_found
end
context 'query read location' do
it 'reads from the primary' do
expect(ContainerRepository).to receive(:find_by_path!).and_wrap_original do |m, *args|
expect(::Gitlab::Database::LoadBalancing::Session.current.use_primary?).to eq(true)
m.call(*args)
end
subject
end
end
end
context 'with an invalid sent token' do

View File

@ -93,7 +93,7 @@ module NavbarStructureHelper
)
end
def analytics_sub_nav_item
def project_analytics_sub_nav_item
[
_('Value stream'),
_('CI/CD'),
@ -102,6 +102,12 @@ module NavbarStructureHelper
_('Repository')
]
end
def group_analytics_sub_nav_item
[
_('Contribution')
]
end
end
NavbarStructureHelper.prepend_mod

View File

@ -95,7 +95,7 @@ RSpec.shared_context 'project navbar structure' do
},
{
nav_item: _('Analytics'),
nav_sub_items: analytics_sub_nav_item
nav_sub_items: project_analytics_sub_nav_item
},
{
nav_item: _('Wiki'),
@ -126,9 +126,7 @@ RSpec.shared_context 'group navbar structure' do
let(:analytics_nav_item) do
{
nav_item: _('Analytics'),
nav_sub_items: [
_('Contribution')
]
nav_sub_items: group_analytics_sub_nav_item
}
end