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
eae1fd12
Commit
eae1fd12
authored
Jan 23, 2021
by
Mathieu Parent
Committed by
Steve Abrams
Jun 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Debian API endpoint for {In,}Release files
parent
628a2020
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
lib/api/concerns/packages/debian_package_endpoints.rb
lib/api/concerns/packages/debian_package_endpoints.rb
+11
-3
lib/api/debian_group_packages.rb
lib/api/debian_group_packages.rb
+6
-0
spec/requests/api/debian_group_packages_spec.rb
spec/requests/api/debian_group_packages_spec.rb
+2
-2
spec/requests/api/debian_project_packages_spec.rb
spec/requests/api/debian_project_packages_spec.rb
+2
-2
spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb
..._examples/requests/api/debian_packages_shared_examples.rb
+2
-2
No files found.
lib/api/concerns/packages/debian_package_endpoints.rb
View file @
eae1fd12
...
...
@@ -40,6 +40,14 @@ module API
.
sent_through
(
:http_basic_auth
)
end
helpers
do
def
present_release_file
distribution
=
::
Packages
::
Debian
::
DistributionsFinder
.
new
(
project_or_group
,
codename_or_suite:
params
[
:distribution
]).
execute
.
last!
present_carrierwave_file!
(
distribution
.
file
)
end
end
format
:txt
content_type
:txt
,
'text/plain'
...
...
@@ -65,8 +73,7 @@ module API
route_setting
:authentication
,
authenticate_non_public:
true
get
'Release'
do
# https://gitlab.com/gitlab-org/gitlab/-/issues/5835#note_414103286
'TODO Release'
present_release_file
end
# GET {projects|groups}/:id/packages/debian/dists/*distribution/InRelease
...
...
@@ -76,7 +83,8 @@ module API
route_setting
:authentication
,
authenticate_non_public:
true
get
'InRelease'
do
not_found!
# Signature to be added in 7.3 of https://gitlab.com/groups/gitlab-org/-/epics/6057#note_582697034
present_release_file
end
params
do
...
...
lib/api/debian_group_packages.rb
View file @
eae1fd12
...
...
@@ -24,6 +24,12 @@ module API
end
namespace
':id/-'
do
helpers
do
def
project_or_group
user_group
end
end
include
::
API
::
Concerns
::
Packages
::
DebianPackageEndpoints
end
end
...
...
spec/requests/api/debian_group_packages_spec.rb
View file @
eae1fd12
...
...
@@ -15,13 +15,13 @@ RSpec.describe API::DebianGroupPackages do
describe
'GET groups/:id/-/packages/debian/dists/*distribution/Release'
do
let
(
:url
)
{
"/groups/
#{
container
.
id
}
/-/packages/debian/dists/
#{
distribution
.
codename
}
/Release"
}
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:success
,
/^
TODO Release
$/
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:success
,
/^
Codename: fixture-distribution\n
$/
end
describe
'GET groups/:id/-/packages/debian/dists/*distribution/InRelease'
do
let
(
:url
)
{
"/groups/
#{
container
.
id
}
/-/packages/debian/dists/
#{
distribution
.
codename
}
/InRelease"
}
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:
not_found
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:
success
,
/^Codename: fixture-distribution\n$/
end
describe
'GET groups/:id/-/packages/debian/dists/*distribution/:component/binary-:architecture/Packages'
do
...
...
spec/requests/api/debian_project_packages_spec.rb
View file @
eae1fd12
...
...
@@ -15,13 +15,13 @@ RSpec.describe API::DebianProjectPackages do
describe
'GET projects/:id/packages/debian/dists/*distribution/Release'
do
let
(
:url
)
{
"/projects/
#{
container
.
id
}
/packages/debian/dists/
#{
distribution
.
codename
}
/Release"
}
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:success
,
/^
TODO Release
$/
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:success
,
/^
Codename: fixture-distribution\n
$/
end
describe
'GET projects/:id/packages/debian/dists/*distribution/InRelease'
do
let
(
:url
)
{
"/projects/
#{
container
.
id
}
/packages/debian/dists/
#{
distribution
.
codename
}
/InRelease"
}
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:
not_found
it_behaves_like
'Debian repository read endpoint'
,
'GET request'
,
:
success
,
/^Codename: fixture-distribution\n$/
end
describe
'GET projects/:id/packages/debian/dists/*distribution/:component/binary-:architecture/Packages'
do
...
...
spec/support/shared_examples/requests/api/debian_packages_shared_examples.rb
View file @
eae1fd12
...
...
@@ -12,12 +12,12 @@ RSpec.shared_context 'Debian repository shared context' do |container_type, can_
let_it_be
(
:user
,
freeze:
true
)
{
create
(
:user
)
}
let_it_be
(
:personal_access_token
,
freeze:
true
)
{
create
(
:personal_access_token
,
user:
user
)
}
let_it_be
(
:private_distribution
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_distribution"
,
container:
private_container
,
codename:
'existing-codename'
)
}
let_it_be
(
:private_distribution
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_distribution"
,
:with_file
,
container:
private_container
,
codename:
'existing-codename'
)
}
let_it_be
(
:private_component
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_component"
,
distribution:
private_distribution
,
name:
'existing-component'
)
}
let_it_be
(
:private_architecture_all
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_architecture"
,
distribution:
private_distribution
,
name:
'all'
)
}
let_it_be
(
:private_architecture
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_architecture"
,
distribution:
private_distribution
,
name:
'existing-arch'
)
}
let_it_be
(
:public_distribution
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_distribution"
,
container:
public_container
,
codename:
'existing-codename'
)
}
let_it_be
(
:public_distribution
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_distribution"
,
:with_file
,
container:
public_container
,
codename:
'existing-codename'
)
}
let_it_be
(
:public_component
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_component"
,
distribution:
public_distribution
,
name:
'existing-component'
)
}
let_it_be
(
:public_architecture_all
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_architecture"
,
distribution:
public_distribution
,
name:
'all'
)
}
let_it_be
(
:public_architecture
,
freeze:
true
)
{
create
(
"debian_
#{
container_type
}
_architecture"
,
distribution:
public_distribution
,
name:
'existing-arch'
)
}
...
...
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