Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c4e9c384
Commit
c4e9c384
authored
Mar 16, 2021
by
Mathieu Parent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helm package type
Item 1.2 of
https://gitlab.com/gitlab-org/gitlab/-/issues/18997#note_530270349
parent
23603d56
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
4 deletions
+43
-4
app/models/packages/package.rb
app/models/packages/package.rb
+3
-1
db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb
...e/20210319071214_add_helm_max_file_size_to_plan_limits.rb
+9
-0
db/schema_migrations/20210319071214
db/schema_migrations/20210319071214
+1
-0
db/structure.sql
db/structure.sql
+2
-1
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
spec/factories/packages.rb
spec/factories/packages.rb
+6
-0
spec/graphql/types/packages/package_type_enum_spec.rb
spec/graphql/types/packages/package_type_enum_spec.rb
+1
-1
spec/models/packages/package_spec.rb
spec/models/packages/package_spec.rb
+18
-0
spec/support/shared_examples/services/packages_shared_examples.rb
...port/shared_examples/services/packages_shared_examples.rb
+2
-1
No files found.
app/models/packages/package.rb
View file @
c4e9c384
...
...
@@ -47,6 +47,7 @@ class Packages::Package < ApplicationRecord
validate
:package_already_taken
,
if: :npm?
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
conan_recipe_component_regex
},
if: :conan?
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
generic_package_name_regex
},
if: :generic?
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
helm_package_regex
},
if: :helm?
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
npm_package_name_regex
},
if: :npm?
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
nuget_package_name_regex
},
if: :nuget?
validates
:name
,
format:
{
with:
Gitlab
::
Regex
.
debian_package_name_regex
},
if: :debian_package?
...
...
@@ -56,6 +57,7 @@ class Packages::Package < ApplicationRecord
validates
:version
,
format:
{
with:
Gitlab
::
Regex
.
maven_version_regex
},
if:
->
{
version?
&&
maven?
}
validates
:version
,
format:
{
with:
Gitlab
::
Regex
.
pypi_version_regex
},
if: :pypi?
validates
:version
,
format:
{
with:
Gitlab
::
Regex
.
prefixed_semver_regex
},
if: :golang?
validates
:version
,
format:
{
with:
Gitlab
::
Regex
.
prefixed_semver_regex
},
if: :helm?
validates
:version
,
format:
{
with:
Gitlab
::
Regex
.
semver_regex
},
if:
->
{
composer_tag_version?
||
npm?
}
validates
:version
,
...
...
@@ -70,7 +72,7 @@ class Packages::Package < ApplicationRecord
enum
package_type:
{
maven:
1
,
npm:
2
,
conan:
3
,
nuget:
4
,
pypi:
5
,
composer:
6
,
generic:
7
,
golang:
8
,
debian:
9
,
rubygems:
10
}
rubygems:
10
,
helm:
11
}
enum
status:
{
default:
0
,
hidden:
1
,
processing:
2
,
error:
3
}
...
...
db/migrate/20210319071214_add_helm_max_file_size_to_plan_limits.rb
0 → 100644
View file @
c4e9c384
# frozen_string_literal: true
class
AddHelmMaxFileSizeToPlanLimits
<
ActiveRecord
::
Migration
[
6.0
]
DOWNTIME
=
false
def
change
add_column
:plan_limits
,
:helm_max_file_size
,
:bigint
,
default:
5
.
megabyte
,
null:
false
end
end
db/schema_migrations/20210319071214
0 → 100644
View file @
c4e9c384
3f9e229fc13075c2a2d42931b163c8069089458d66bc565609b393e07460f25d
\ No newline at end of file
db/structure.sql
View file @
c4e9c384
...
...
@@ -16015,7 +16015,8 @@ CREATE TABLE plan_limits (
pull_mirror_interval_seconds integer DEFAULT 300 NOT NULL,
daily_invites integer DEFAULT 0 NOT NULL,
rubygems_max_file_size bigint DEFAULT '3221225472'::bigint NOT NULL,
terraform_module_max_file_size bigint DEFAULT 1073741824 NOT NULL
terraform_module_max_file_size bigint DEFAULT 1073741824 NOT NULL,
helm_max_file_size bigint DEFAULT 5242880 NOT NULL
);
CREATE SEQUENCE plan_limits_id_seq
doc/api/graphql/reference/index.md
View file @
c4e9c384
...
...
@@ -13930,6 +13930,7 @@ Values for sorting package.
|
<a
id=
"packagetypeenumdebian"
></a>
`DEBIAN`
| Packages from the Debian package manager. |
|
<a
id=
"packagetypeenumgeneric"
></a>
`GENERIC`
| Packages from the Generic package manager. |
|
<a
id=
"packagetypeenumgolang"
></a>
`GOLANG`
| Packages from the Golang package manager. |
|
<a
id=
"packagetypeenumhelm"
></a>
`HELM`
| Packages from the Helm package manager. |
|
<a
id=
"packagetypeenummaven"
></a>
`MAVEN`
| Packages from the Maven package manager. |
|
<a
id=
"packagetypeenumnpm"
></a>
`NPM`
| Packages from the npm package manager. |
|
<a
id=
"packagetypeenumnuget"
></a>
`NUGET`
| Packages from the Nuget package manager. |
...
...
spec/factories/packages.rb
View file @
c4e9c384
...
...
@@ -94,6 +94,12 @@ FactoryBot.define do
end
end
factory
:helm_package
do
sequence
(
:name
)
{
|
n
|
"package-
#{
n
}
"
}
sequence
(
:version
)
{
|
n
|
"v1.0.
#{
n
}
"
}
package_type
{
:helm
}
end
factory
:npm_package
do
sequence
(
:name
)
{
|
n
|
"@
#{
project
.
root_namespace
.
path
}
/package-
#{
n
}
"
}
version
{
'1.0.0'
}
...
...
spec/graphql/types/packages/package_type_enum_spec.rb
View file @
c4e9c384
...
...
@@ -4,6 +4,6 @@ require 'spec_helper'
RSpec
.
describe
GitlabSchema
.
types
[
'PackageTypeEnum'
]
do
it
'exposes all package types'
do
expect
(
described_class
.
values
.
keys
).
to
contain_exactly
(
*
%w[MAVEN NPM CONAN NUGET PYPI COMPOSER GENERIC GOLANG DEBIAN RUBYGEMS]
)
expect
(
described_class
.
values
.
keys
).
to
contain_exactly
(
*
%w[MAVEN NPM CONAN NUGET PYPI COMPOSER GENERIC GOLANG DEBIAN RUBYGEMS
HELM
]
)
end
end
spec/models/packages/package_spec.rb
View file @
c4e9c384
...
...
@@ -173,6 +173,15 @@ RSpec.describe Packages::Package, type: :model do
it
{
is_expected
.
not_to
allow_value
(
'!!().for(:name)().for(:name)'
).
for
(
:name
)
}
end
context
'helm package'
do
subject
{
build
(
:helm_package
)
}
it
{
is_expected
.
to
allow_value
(
'prometheus'
).
for
(
:name
)
}
it
{
is_expected
.
to
allow_value
(
'rook-ceph'
).
for
(
:name
)
}
it
{
is_expected
.
not_to
allow_value
(
'a+b'
).
for
(
:name
)
}
it
{
is_expected
.
not_to
allow_value
(
'Hé'
).
for
(
:name
)
}
end
context
'nuget package'
do
subject
{
build_stubbed
(
:nuget_package
)
}
...
...
@@ -376,6 +385,15 @@ RSpec.describe Packages::Package, type: :model do
it
{
is_expected
.
not_to
allow_value
(
nil
).
for
(
:version
)
}
end
context
'helm package'
do
subject
{
build_stubbed
(
:helm_package
)
}
it
{
is_expected
.
not_to
allow_value
(
nil
).
for
(
:version
)
}
it
{
is_expected
.
not_to
allow_value
(
''
).
for
(
:version
)
}
it
{
is_expected
.
to
allow_value
(
'v1.2.3'
).
for
(
:version
)
}
it
{
is_expected
.
not_to
allow_value
(
'1.2.3'
).
for
(
:version
)
}
end
it_behaves_like
'validating version to be SemVer compliant for'
,
:npm_package
context
'nuget package'
do
...
...
spec/support/shared_examples/services/packages_shared_examples.rb
View file @
c4e9c384
...
...
@@ -203,7 +203,8 @@ RSpec.shared_examples 'filters on each package_type' do |is_project: false|
let_it_be
(
:package7
)
{
create
(
:generic_package
,
project:
project
)
}
let_it_be
(
:package8
)
{
create
(
:golang_package
,
project:
project
)
}
let_it_be
(
:package9
)
{
create
(
:debian_package
,
project:
project
)
}
let_it_be
(
:package9
)
{
create
(
:rubygems_package
,
project:
project
)
}
let_it_be
(
:package10
)
{
create
(
:rubygems_package
,
project:
project
)
}
let_it_be
(
:package11
)
{
create
(
:helm_package
,
project:
project
)
}
Packages
::
Package
.
package_types
.
keys
.
each
do
|
package_type
|
context
"for package type
#{
package_type
}
"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment