Commit eaaa4c7d authored by David Fernandez's avatar David Fernandez

Merge branch 'feat/helm_max_file_size' into 'master'

feat(plan_limits): add Helm limits to API and UI

See merge request gitlab-org/gitlab!75117
parents f88acb6c 31162f3a
...@@ -31,6 +31,7 @@ class Admin::PlanLimitsController < Admin::ApplicationController ...@@ -31,6 +31,7 @@ class Admin::PlanLimitsController < Admin::ApplicationController
params.require(:plan_limits).permit(%i[ params.require(:plan_limits).permit(%i[
plan_id plan_id
conan_max_file_size conan_max_file_size
helm_max_file_size
maven_max_file_size maven_max_file_size
npm_max_file_size npm_max_file_size
nuget_max_file_size nuget_max_file_size
......
...@@ -62,6 +62,7 @@ class InstanceConfiguration ...@@ -62,6 +62,7 @@ class InstanceConfiguration
def plan_file_size_limits(plan) def plan_file_size_limits(plan)
{ {
conan: plan.actual_limits[:conan_max_file_size], conan: plan.actual_limits[:conan_max_file_size],
helm: plan.actual_limits[:helm_max_file_size],
maven: plan.actual_limits[:maven_max_file_size], maven: plan.actual_limits[:maven_max_file_size],
npm: plan.actual_limits[:npm_max_file_size], npm: plan.actual_limits[:npm_max_file_size],
nuget: plan.actual_limits[:nuget_max_file_size], nuget: plan.actual_limits[:nuget_max_file_size],
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
.form-group .form-group
= f.label :conan_max_file_size, _('Maximum Conan package file size in bytes'), class: 'label-bold' = f.label :conan_max_file_size, _('Maximum Conan package file size in bytes'), class: 'label-bold'
= f.number_field :conan_max_file_size, class: 'form-control gl-form-input' = f.number_field :conan_max_file_size, class: 'form-control gl-form-input'
.form-group
= f.label :helm_max_file_size, _('Maximum Helm chart file size in bytes'), class: 'label-bold'
= f.number_field :helm_max_file_size, class: 'form-control gl-form-input'
.form-group .form-group
= f.label :maven_max_file_size, _('Maximum Maven package file size in bytes'), class: 'label-bold' = f.label :maven_max_file_size, _('Maximum Maven package file size in bytes'), class: 'label-bold'
= f.number_field :maven_max_file_size, class: 'form-control gl-form-input' = f.number_field :maven_max_file_size, class: 'form-control gl-form-input'
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
%td= 'Conan' %td= 'Conan'
- package_file_size_limits.each_value do |limits| - package_file_size_limits.each_value do |limits|
%td= instance_configuration_human_size_cell(limits[:conan]) %td= instance_configuration_human_size_cell(limits[:conan])
%tr
%td= 'Helm'
- package_file_size_limits.each_value do |limits|
%td= instance_configuration_human_size_cell(limits[:helm])
%tr %tr
%td= 'Maven' %td= 'Maven'
- package_file_size_limits.each_value do |limits| - package_file_size_limits.each_value do |limits|
......
...@@ -848,16 +848,20 @@ More information can be found in the [Push event activities limit and bulk push ...@@ -848,16 +848,20 @@ More information can be found in the [Push event activities limit and bulk push
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218017) in GitLab 13.4. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/218017) in GitLab 13.4.
On GitLab.com, the maximum file size for a package that's uploaded to the [GitLab Package Registry](../user/packages/package_registry/index.md) varies by format: The default maximum file size for a package that's uploaded to the [GitLab Package Registry](../user/packages/package_registry/index.md) varies by format:
- Conan: 5 GB - Conan: 3 GB
- Generic: 5 GB - Generic: 5 GB
- Maven: 5 GB - Helm: 5 MB
- npm: 5 GB - Maven: 3 GB
- NuGet: 5 GB - npm: 500 MB
- PyPI: 5 GB - NuGet: 500 MB
- PyPI: 3 GB
- Terraform: 1 GB
To set this limit for a self-managed installation, run the following in the The [maximum file sizes on GitLab.com](../user/gitlab_com/index.md) might be different.
To set these limits for a self-managed installation, run the following in the
[GitLab Rails console](operations/rails_console.md#starting-a-rails-console-session): [GitLab Rails console](operations/rails_console.md#starting-a-rails-console-session):
```ruby ```ruby
...@@ -881,6 +885,9 @@ Plan.default.actual_limits.update!(pypi_max_file_size: 100.megabytes) ...@@ -881,6 +885,9 @@ Plan.default.actual_limits.update!(pypi_max_file_size: 100.megabytes)
# For Debian Packages # For Debian Packages
Plan.default.actual_limits.update!(debian_max_file_size: 100.megabytes) Plan.default.actual_limits.update!(debian_max_file_size: 100.megabytes)
# For Helm Charts
Plan.default.actual_limits.update!(helm_max_file_size: 100.megabytes)
# For Generic Packages # For Generic Packages
Plan.default.actual_limits.update!(generic_packages_max_file_size: 100.megabytes) Plan.default.actual_limits.update!(generic_packages_max_file_size: 100.megabytes)
``` ```
......
...@@ -37,6 +37,7 @@ module API ...@@ -37,6 +37,7 @@ module API
optional :conan_max_file_size, type: Integer, desc: 'Maximum Conan package file size in bytes' optional :conan_max_file_size, type: Integer, desc: 'Maximum Conan package file size in bytes'
optional :generic_packages_max_file_size, type: Integer, desc: 'Maximum generic package file size in bytes' optional :generic_packages_max_file_size, type: Integer, desc: 'Maximum generic package file size in bytes'
optional :helm_max_file_size, type: Integer, desc: 'Maximum Helm chart file size in bytes'
optional :maven_max_file_size, type: Integer, desc: 'Maximum Maven package file size in bytes' optional :maven_max_file_size, type: Integer, desc: 'Maximum Maven package file size in bytes'
optional :npm_max_file_size, type: Integer, desc: 'Maximum NPM package file size in bytes' optional :npm_max_file_size, type: Integer, desc: 'Maximum NPM package file size in bytes'
optional :nuget_max_file_size, type: Integer, desc: 'Maximum NuGet package file size in bytes' optional :nuget_max_file_size, type: Integer, desc: 'Maximum NuGet package file size in bytes'
......
...@@ -5,6 +5,7 @@ module API ...@@ -5,6 +5,7 @@ module API
class PlanLimit < Grape::Entity class PlanLimit < Grape::Entity
expose :conan_max_file_size expose :conan_max_file_size
expose :generic_packages_max_file_size expose :generic_packages_max_file_size
expose :helm_max_file_size
expose :maven_max_file_size expose :maven_max_file_size
expose :npm_max_file_size expose :npm_max_file_size
expose :nuget_max_file_size expose :nuget_max_file_size
......
...@@ -21415,6 +21415,9 @@ msgstr "" ...@@ -21415,6 +21415,9 @@ msgstr ""
msgid "Maximum Conan package file size in bytes" msgid "Maximum Conan package file size in bytes"
msgstr "" msgstr ""
msgid "Maximum Helm chart file size in bytes"
msgstr ""
msgid "Maximum Maven package file size in bytes" msgid "Maximum Maven package file size in bytes"
msgstr "" msgstr ""
......
...@@ -12,6 +12,7 @@ FactoryBot.define do ...@@ -12,6 +12,7 @@ FactoryBot.define do
trait :with_package_file_sizes do trait :with_package_file_sizes do
conan_max_file_size { 100 } conan_max_file_size { 100 }
helm_max_file_size { 100 }
maven_max_file_size { 100 } maven_max_file_size { 100 }
npm_max_file_size { 100 } npm_max_file_size { 100 }
nuget_max_file_size { 100 } nuget_max_file_size { 100 }
......
...@@ -11,6 +11,7 @@ RSpec.describe API::Entities::PlanLimit do ...@@ -11,6 +11,7 @@ RSpec.describe API::Entities::PlanLimit do
expect(subject).to include( expect(subject).to include(
:conan_max_file_size, :conan_max_file_size,
:generic_packages_max_file_size, :generic_packages_max_file_size,
:helm_max_file_size,
:maven_max_file_size, :maven_max_file_size,
:npm_max_file_size, :npm_max_file_size,
:nuget_max_file_size, :nuget_max_file_size,
......
...@@ -144,6 +144,7 @@ RSpec.describe InstanceConfiguration do ...@@ -144,6 +144,7 @@ RSpec.describe InstanceConfiguration do
create(:plan_limits, create(:plan_limits,
plan: plan1, plan: plan1,
conan_max_file_size: 1001, conan_max_file_size: 1001,
helm_max_file_size: 1008,
maven_max_file_size: 1002, maven_max_file_size: 1002,
npm_max_file_size: 1003, npm_max_file_size: 1003,
nuget_max_file_size: 1004, nuget_max_file_size: 1004,
...@@ -154,6 +155,7 @@ RSpec.describe InstanceConfiguration do ...@@ -154,6 +155,7 @@ RSpec.describe InstanceConfiguration do
create(:plan_limits, create(:plan_limits,
plan: plan2, plan: plan2,
conan_max_file_size: 1101, conan_max_file_size: 1101,
helm_max_file_size: 1108,
maven_max_file_size: 1102, maven_max_file_size: 1102,
npm_max_file_size: 1103, npm_max_file_size: 1103,
nuget_max_file_size: 1104, nuget_max_file_size: 1104,
...@@ -166,8 +168,8 @@ RSpec.describe InstanceConfiguration do ...@@ -166,8 +168,8 @@ RSpec.describe InstanceConfiguration do
it 'returns package file size limits' do it 'returns package file size limits' do
file_size_limits = subject.settings[:package_file_size_limits] file_size_limits = subject.settings[:package_file_size_limits]
expect(file_size_limits[:Plan1]).to eq({ conan: 1001, maven: 1002, npm: 1003, nuget: 1004, pypi: 1005, terraform_module: 1006, generic: 1007 }) expect(file_size_limits[:Plan1]).to eq({ conan: 1001, helm: 1008, maven: 1002, npm: 1003, nuget: 1004, pypi: 1005, terraform_module: 1006, generic: 1007 })
expect(file_size_limits[:Plan2]).to eq({ conan: 1101, maven: 1102, npm: 1103, nuget: 1104, pypi: 1105, terraform_module: 1106, generic: 1107 }) expect(file_size_limits[:Plan2]).to eq({ conan: 1101, helm: 1108, maven: 1102, npm: 1103, nuget: 1104, pypi: 1105, terraform_module: 1106, generic: 1107 })
end end
end end
......
...@@ -25,6 +25,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do ...@@ -25,6 +25,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do
expect(json_response).to be_an Hash expect(json_response).to be_an Hash
expect(json_response['conan_max_file_size']).to eq(Plan.default.actual_limits.conan_max_file_size) expect(json_response['conan_max_file_size']).to eq(Plan.default.actual_limits.conan_max_file_size)
expect(json_response['generic_packages_max_file_size']).to eq(Plan.default.actual_limits.generic_packages_max_file_size) expect(json_response['generic_packages_max_file_size']).to eq(Plan.default.actual_limits.generic_packages_max_file_size)
expect(json_response['helm_max_file_size']).to eq(Plan.default.actual_limits.helm_max_file_size)
expect(json_response['maven_max_file_size']).to eq(Plan.default.actual_limits.maven_max_file_size) expect(json_response['maven_max_file_size']).to eq(Plan.default.actual_limits.maven_max_file_size)
expect(json_response['npm_max_file_size']).to eq(Plan.default.actual_limits.npm_max_file_size) expect(json_response['npm_max_file_size']).to eq(Plan.default.actual_limits.npm_max_file_size)
expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size) expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size)
...@@ -45,6 +46,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do ...@@ -45,6 +46,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do
expect(json_response).to be_an Hash expect(json_response).to be_an Hash
expect(json_response['conan_max_file_size']).to eq(Plan.default.actual_limits.conan_max_file_size) expect(json_response['conan_max_file_size']).to eq(Plan.default.actual_limits.conan_max_file_size)
expect(json_response['generic_packages_max_file_size']).to eq(Plan.default.actual_limits.generic_packages_max_file_size) expect(json_response['generic_packages_max_file_size']).to eq(Plan.default.actual_limits.generic_packages_max_file_size)
expect(json_response['helm_max_file_size']).to eq(Plan.default.actual_limits.helm_max_file_size)
expect(json_response['maven_max_file_size']).to eq(Plan.default.actual_limits.maven_max_file_size) expect(json_response['maven_max_file_size']).to eq(Plan.default.actual_limits.maven_max_file_size)
expect(json_response['npm_max_file_size']).to eq(Plan.default.actual_limits.npm_max_file_size) expect(json_response['npm_max_file_size']).to eq(Plan.default.actual_limits.npm_max_file_size)
expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size) expect(json_response['nuget_max_file_size']).to eq(Plan.default.actual_limits.nuget_max_file_size)
...@@ -84,6 +86,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do ...@@ -84,6 +86,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do
'plan_name': 'default', 'plan_name': 'default',
'conan_max_file_size': 10, 'conan_max_file_size': 10,
'generic_packages_max_file_size': 20, 'generic_packages_max_file_size': 20,
'helm_max_file_size': 25,
'maven_max_file_size': 30, 'maven_max_file_size': 30,
'npm_max_file_size': 40, 'npm_max_file_size': 40,
'nuget_max_file_size': 50, 'nuget_max_file_size': 50,
...@@ -95,6 +98,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do ...@@ -95,6 +98,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do
expect(json_response).to be_an Hash expect(json_response).to be_an Hash
expect(json_response['conan_max_file_size']).to eq(10) expect(json_response['conan_max_file_size']).to eq(10)
expect(json_response['generic_packages_max_file_size']).to eq(20) expect(json_response['generic_packages_max_file_size']).to eq(20)
expect(json_response['helm_max_file_size']).to eq(25)
expect(json_response['maven_max_file_size']).to eq(30) expect(json_response['maven_max_file_size']).to eq(30)
expect(json_response['npm_max_file_size']).to eq(40) expect(json_response['npm_max_file_size']).to eq(40)
expect(json_response['nuget_max_file_size']).to eq(50) expect(json_response['nuget_max_file_size']).to eq(50)
...@@ -129,6 +133,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do ...@@ -129,6 +133,7 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do
'plan_name': 'default', 'plan_name': 'default',
'conan_max_file_size': 'a', 'conan_max_file_size': 'a',
'generic_packages_max_file_size': 'b', 'generic_packages_max_file_size': 'b',
'helm_max_file_size': 'h',
'maven_max_file_size': 'c', 'maven_max_file_size': 'c',
'npm_max_file_size': 'd', 'npm_max_file_size': 'd',
'nuget_max_file_size': 'e', 'nuget_max_file_size': 'e',
...@@ -140,8 +145,8 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do ...@@ -140,8 +145,8 @@ RSpec.describe API::Admin::PlanLimits, 'PlanLimits' do
expect(json_response['error']).to include( expect(json_response['error']).to include(
'conan_max_file_size is invalid', 'conan_max_file_size is invalid',
'generic_packages_max_file_size is invalid', 'generic_packages_max_file_size is invalid',
'helm_max_file_size is invalid',
'maven_max_file_size is invalid', 'maven_max_file_size is invalid',
'generic_packages_max_file_size is invalid',
'npm_max_file_size is invalid', 'npm_max_file_size is invalid',
'nuget_max_file_size is invalid', 'nuget_max_file_size is invalid',
'pypi_max_file_size is invalid', 'pypi_max_file_size is invalid',
......
...@@ -28,6 +28,9 @@ RSpec.describe 'admin/application_settings/_package_registry' do ...@@ -28,6 +28,9 @@ RSpec.describe 'admin/application_settings/_package_registry' do
expect(rendered).to have_field('Maximum Conan package file size in bytes', type: 'number') expect(rendered).to have_field('Maximum Conan package file size in bytes', type: 'number')
expect(page.find_field('Maximum Conan package file size in bytes').value).to eq(default_plan_limits.conan_max_file_size.to_s) expect(page.find_field('Maximum Conan package file size in bytes').value).to eq(default_plan_limits.conan_max_file_size.to_s)
expect(rendered).to have_field('Maximum Helm chart file size in bytes', type: 'number')
expect(page.find_field('Maximum Helm chart file size in bytes').value).to eq(default_plan_limits.helm_max_file_size.to_s)
expect(rendered).to have_field('Maximum Maven package file size in bytes', type: 'number') expect(rendered).to have_field('Maximum Maven package file size in bytes', type: 'number')
expect(page.find_field('Maximum Maven package file size in bytes').value).to eq(default_plan_limits.maven_max_file_size.to_s) expect(page.find_field('Maximum Maven package file size in bytes').value).to eq(default_plan_limits.maven_max_file_size.to_s)
......
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