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
6f55d68c
Commit
6f55d68c
authored
Feb 12, 2021
by
Mathieu Parent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose container_registry_image_prefix to project API
parent
fbaac5e7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
2 deletions
+30
-2
changelogs/unreleased/expose_project_container_registry_url.yml
...logs/unreleased/expose_project_container_registry_url.yml
+5
-0
doc/api/projects.md
doc/api/projects.md
+13
-0
lib/api/entities/project.rb
lib/api/entities/project.rb
+2
-0
spec/requests/api/project_attributes.yml
spec/requests/api/project_attributes.yml
+1
-0
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+9
-2
No files found.
changelogs/unreleased/expose_project_container_registry_url.yml
0 → 100644
View file @
6f55d68c
---
title
:
Expose container_registry_image_prefix to project API
merge_request
:
54090
author
:
Mathieu Parent
type
:
added
doc/api/projects.md
View file @
6f55d68c
...
...
@@ -179,6 +179,7 @@ When the user is authenticated and `simple` is not set this returns something li
"packages_size"
:
0
,
"snippets_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-client"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -284,6 +285,7 @@ When the user is authenticated and `simple` is not set this returns something li
"packages_size"
:
0
,
"snippets_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/brightbox/puppet"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -439,6 +441,7 @@ GET /users/:user_id/projects
"packages_size"
:
0
,
"snippets_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-client"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -544,6 +547,7 @@ GET /users/:user_id/projects
"packages_size"
:
0
,
"snippets_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/brightbox/puppet"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -658,6 +662,7 @@ Example response:
"lfs_objects_size"
:
0
,
"job_artifacts_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-client"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -758,6 +763,7 @@ Example response:
"lfs_objects_size"
:
0
,
"job_artifacts_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/brightbox/puppet"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -921,6 +927,7 @@ GET /projects/:id
"packages_size"
:
0
,
"snippets_size"
:
0
},
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-client"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -1373,6 +1380,7 @@ Example responses:
"merge_method"
:
"merge"
,
"autoclose_referenced_issues"
:
true
,
"suggestion_commit_message"
:
null
,
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-project-site"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -1467,6 +1475,7 @@ Example response:
"merge_method"
:
"merge"
,
"autoclose_referenced_issues"
:
true
,
"suggestion_commit_message"
:
null
,
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-project-site"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -1559,6 +1568,7 @@ Example response:
"merge_method"
:
"merge"
,
"autoclose_referenced_issues"
:
true
,
"suggestion_commit_message"
:
null
,
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-project-site"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -1745,6 +1755,7 @@ Example response:
"merge_method"
:
"merge"
,
"autoclose_referenced_issues"
:
true
,
"suggestion_commit_message"
:
null
,
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-project-site"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -1858,6 +1869,7 @@ Example response:
"merge_method"
:
"merge"
,
"autoclose_referenced_issues"
:
true
,
"suggestion_commit_message"
:
null
,
"container_registry_image_prefix"
:
"registry.example.com/diaspora/diaspora-project-site"
,
"_links"
:
{
"self"
:
"http://example.com/api/v4/projects"
,
"issues"
:
"http://example.com/api/v4/projects/1/issues"
,
...
...
@@ -2354,6 +2366,7 @@ Example response:
"avatar_url"
:
null
,
"web_url"
:
"https://gitlab.example.com/groups/cute-cats"
},
"container_registry_image_prefix"
:
"registry.example.com/cute-cats/hello-world"
,
"_links"
:
{
"self"
:
"https://gitlab.example.com/api/v4/projects/7"
,
"issues"
:
"https://gitlab.example.com/api/v4/projects/7/issues"
,
...
...
lib/api/entities/project.rb
View file @
6f55d68c
...
...
@@ -5,6 +5,8 @@ module API
class
Project
<
BasicProjectDetails
include
::
API
::
Helpers
::
RelatedResourcesHelpers
expose
:container_registry_url
,
as: :container_registry_image_prefix
,
if:
->
(
_
,
_
)
{
Gitlab
.
config
.
registry
.
enabled
}
expose
:_links
do
expose
:self
do
|
project
|
expose_url
(
api_v4_projects_path
(
id:
project
.
id
))
...
...
spec/requests/api/project_attributes.yml
View file @
6f55d68c
...
...
@@ -56,6 +56,7 @@ itself: # project
-
can_create_merge_request_in
-
compliance_frameworks
-
container_expiration_policy
-
container_registry_image_prefix
-
default_branch
-
empty_repo
-
forks_count
...
...
spec/requests/api/projects_spec.rb
View file @
6f55d68c
...
...
@@ -1540,6 +1540,10 @@ RSpec.describe API::Projects do
end
context
'when authenticated as an admin'
do
before
do
stub_container_registry_config
(
enabled:
true
,
host_port:
'registry.example.org:5000'
)
end
let
(
:project_attributes_file
)
{
'spec/requests/api/project_attributes.yml'
}
let
(
:project_attributes
)
{
YAML
.
load_file
(
project_attributes_file
)
}
...
...
@@ -1569,7 +1573,7 @@ RSpec.describe API::Projects do
keys
end
it
'returns a project by id'
do
it
'returns a project by id'
,
:aggregate_failures
do
project
project_member
group
=
create
(
:group
)
...
...
@@ -1587,6 +1591,7 @@ RSpec.describe API::Projects do
expect
(
json_response
[
'ssh_url_to_repo'
]).
to
be_present
expect
(
json_response
[
'http_url_to_repo'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
expect
(
json_response
[
'container_registry_image_prefix'
]).
to
eq
(
"registry.example.org:5000/
#{
project
.
full_path
}
"
)
expect
(
json_response
[
'owner'
]).
to
be_a
Hash
expect
(
json_response
[
'name'
]).
to
eq
(
project
.
name
)
expect
(
json_response
[
'path'
]).
to
be_present
...
...
@@ -1644,9 +1649,10 @@ RSpec.describe API::Projects do
before
do
project
project_member
stub_container_registry_config
(
enabled:
true
,
host_port:
'registry.example.org:5000'
)
end
it
'returns a project by id'
do
it
'returns a project by id'
,
:aggregate_failures
do
group
=
create
(
:group
)
link
=
create
(
:project_group_link
,
project:
project
,
group:
group
)
...
...
@@ -1662,6 +1668,7 @@ RSpec.describe API::Projects do
expect
(
json_response
[
'ssh_url_to_repo'
]).
to
be_present
expect
(
json_response
[
'http_url_to_repo'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
expect
(
json_response
[
'container_registry_image_prefix'
]).
to
eq
(
"registry.example.org:5000/
#{
project
.
full_path
}
"
)
expect
(
json_response
[
'owner'
]).
to
be_a
Hash
expect
(
json_response
[
'name'
]).
to
eq
(
project
.
name
)
expect
(
json_response
[
'path'
]).
to
be_present
...
...
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