Commit df8aa2a5 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents c4d5e9c2 aaee395b
...@@ -402,14 +402,15 @@ const fileNameIcons = { ...@@ -402,14 +402,15 @@ const fileNameIcons = {
'gradle.properties': 'gradle', 'gradle.properties': 'gradle',
gradlew: 'gradle', gradlew: 'gradle',
'gradle-wrapper.properties': 'gradle', 'gradle-wrapper.properties': 'gradle',
license: 'certificate', COPYING: 'certificate',
'license.md': 'certificate', 'COPYING.LESSER': 'certificate',
'license.md.rendered': 'certificate', LICENSE: 'certificate',
'license.txt': 'certificate', LICENCE: 'certificate',
licence: 'certificate', 'LICENSE.md': 'certificate',
'licence.md': 'certificate', 'LICENCE.md': 'certificate',
'licence.md.rendered': 'certificate', 'LICENSE.txt': 'certificate',
'licence.txt': 'certificate', 'LICENCE.txt': 'certificate',
'.gitlab-license': 'certificate',
dockerfile: 'docker', dockerfile: 'docker',
'docker-compose.yml': 'docker', 'docker-compose.yml': 'docker',
'.mailmap': 'email', '.mailmap': 'email',
......
...@@ -13,16 +13,20 @@ module Packages ...@@ -13,16 +13,20 @@ module Packages
def execute def execute
return error('Blank package name') unless package_name return error('Blank package name') unless package_name
return error('Not allowed') unless Ability.allowed?(current_user, :destroy_package, project) return error('Not allowed') unless Ability.allowed?(current_user, :destroy_package, project)
return error('Non existing versionless package') unless versionless_package_for_versions
return error('Non existing metadata file for versions') unless metadata_package_file_for_versions
result = success('Non existing versionless package(s). Nothing to do.')
# update versionless package for plugins if it exists
if metadata_package_file_for_plugins if metadata_package_file_for_plugins
result = update_plugins_xml result = update_plugins_xml
return result if result.error? return result if result.error?
end end
update_versions_xml # update versionless_package for versions if it exists
return update_versions_xml if metadata_package_file_for_versions
result
end end
private private
...@@ -79,6 +83,9 @@ module Packages ...@@ -79,6 +83,9 @@ module Packages
def metadata_package_file_for_plugins def metadata_package_file_for_plugins
strong_memoize(:metadata_package_file_for_plugins) do strong_memoize(:metadata_package_file_for_plugins) do
pkg_name = package_name_for_plugins
next unless pkg_name
metadata_package_file_for(versionless_package_named(package_name_for_plugins)) metadata_package_file_for(versionless_package_named(package_name_for_plugins))
end end
end end
...@@ -106,6 +113,8 @@ module Packages ...@@ -106,6 +113,8 @@ module Packages
end end
def package_name_for_plugins def package_name_for_plugins
return unless versionless_package_for_versions
group = versionless_package_for_versions.maven_metadatum.app_group group = versionless_package_for_versions.maven_metadatum.app_group
group.tr('.', '/') group.tr('.', '/')
end end
......
---
title: Partially fix incorrect icons for non-standard license files
merge_request: 53207
author:
type: fixed
---
title: Fix the Maven sync worker to not fail if the versionless package is not found
merge_request: 56514
author:
type: fixed
...@@ -220,8 +220,11 @@ Example for source installs: ...@@ -220,8 +220,11 @@ Example for source installs:
incoming_email: incoming_email:
enabled: true enabled: true
# The email address including the `%{key}` placeholder that will be replaced to reference the item being replied to. # The email address including the %{key} placeholder that will be replaced to reference the
# The placeholder can be omitted but if present, it must appear in the "user" part of the address (before the `@`). # item being replied to. This %{key} should be included in its entirety within the email
# address and not replaced by another value.
# For example: emailadress+%{key}@gmail.com.
# The placeholder must appear in the "user" part of the address (before the `@`).
address: "incoming+%{key}@gitlab.example.com" address: "incoming+%{key}@gitlab.example.com"
# Email account username # Email account username
......
...@@ -131,7 +131,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do ...@@ -131,7 +131,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do
expect(::Packages::Maven::Metadata::CreateVersionsXmlService).not_to receive(:new) expect(::Packages::Maven::Metadata::CreateVersionsXmlService).not_to receive(:new)
end end
it_behaves_like 'returning an error service response', message: 'Non existing versionless package' it_behaves_like 'returning a success service response', message: 'Non existing versionless package(s). Nothing to do.'
end end
context 'without a metadata package file for versions' do context 'without a metadata package file for versions' do
...@@ -141,7 +141,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do ...@@ -141,7 +141,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do
expect(::Packages::Maven::Metadata::CreateVersionsXmlService).not_to receive(:new) expect(::Packages::Maven::Metadata::CreateVersionsXmlService).not_to receive(:new)
end end
it_behaves_like 'returning an error service response', message: 'Non existing metadata file for versions' it_behaves_like 'returning a success service response', message: 'Non existing versionless package(s). Nothing to do.'
end end
context 'without a project' do context 'without a project' do
...@@ -205,7 +205,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do ...@@ -205,7 +205,7 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do
it_behaves_like 'returning a success service response', message: 'Versionless package for versions destroyed' it_behaves_like 'returning a success service response', message: 'Versionless package for versions destroyed'
end end
context 'with a too big maven metadata file for versions' do context 'with a too big maven metadata file for plugins' do
before do before do
metadata_file_for_plugins.update!(size: 100.megabytes) metadata_file_for_plugins.update!(size: 100.megabytes)
end end
...@@ -244,6 +244,15 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do ...@@ -244,6 +244,15 @@ RSpec.describe ::Packages::Maven::Metadata::SyncService do
it_behaves_like 'returning a success service response', message: 'New metadata package files created' it_behaves_like 'returning a success service response', message: 'New metadata package files created'
end end
context 'without a versionless package for versions' do
before do
versionless_package_for_versions.package_files.update_all(file_name: 'test.txt')
expect(::Packages::Maven::Metadata::CreateVersionsXmlService).not_to receive(:new)
end
it_behaves_like 'returning a success service response', message: 'No changes for plugins xml'
end
context 'without a metadata package file for plugins' do context 'without a metadata package file for plugins' do
before do before do
versionless_package_for_plugins.package_files.update_all(file_name: 'test.txt') versionless_package_for_plugins.package_files.update_all(file_name: 'test.txt')
......
...@@ -61,9 +61,10 @@ RSpec.describe Packages::Maven::Metadata::SyncWorker, type: :worker do ...@@ -61,9 +61,10 @@ RSpec.describe Packages::Maven::Metadata::SyncWorker, type: :worker do
let(:project) { create(:project) } let(:project) { create(:project) }
it 'does not create the updated metadata files' do it 'does not create the updated metadata files' do
expect(worker).to receive(:log_extra_metadata_on_done).with(:message, 'Non existing versionless package(s). Nothing to do.')
expect { subject } expect { subject }
.to change { ::Packages::PackageFile.count }.by(0) .to change { ::Packages::PackageFile.count }.by(0)
.and raise_error(described_class::SyncError, 'Non existing versionless package')
end end
end end
...@@ -146,9 +147,10 @@ RSpec.describe Packages::Maven::Metadata::SyncWorker, type: :worker do ...@@ -146,9 +147,10 @@ RSpec.describe Packages::Maven::Metadata::SyncWorker, type: :worker do
let(:project) { create(:project) } let(:project) { create(:project) }
it 'does not create the updated metadata files' do it 'does not create the updated metadata files' do
expect(worker).to receive(:log_extra_metadata_on_done).with(:message, 'Non existing versionless package(s). Nothing to do.')
expect { subject } expect { subject }
.to change { ::Packages::PackageFile.count }.by(0) .to change { ::Packages::PackageFile.count }.by(0)
.and raise_error(described_class::SyncError, 'Non existing versionless package')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment