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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
b5043d5d
Commit
b5043d5d
authored
May 09, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix review comments
parent
60869580
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
doc/permissions/permissions.md
doc/permissions/permissions.md
+1
-0
lib/container_registry/blob.rb
lib/container_registry/blob.rb
+0
-1
lib/container_registry/client.rb
lib/container_registry/client.rb
+19
-14
No files found.
doc/permissions/permissions.md
View file @
b5043d5d
...
...
@@ -39,6 +39,7 @@ documentation](../workflow/add-user/add-user.md).
| Cancel and retry builds | | | ✓ | ✓ | ✓ |
| Create or update commit status | | | ✓ | ✓ | ✓ |
| Update a container registry | | | ✓ | ✓ | ✓ |
| Remove a container registry images | | | ✓ | ✓ | ✓ |
| Create new milestones | | | | ✓ | ✓ |
| Add new team members | | | | ✓ | ✓ |
| Push to protected branches | | | | ✓ | ✓ |
...
...
lib/container_registry/blob.rb
View file @
b5043d5d
...
...
@@ -44,7 +44,6 @@ module ContainerRegistry
end
def
data
return
@data
if
defined?
(
@data
)
@data
||=
client
.
blob
(
repository
.
name
,
digest
,
type
)
end
...
...
lib/container_registry/client.rb
View file @
b5043d5d
...
...
@@ -9,20 +9,8 @@ module ContainerRegistry
def
initialize
(
base_uri
,
options
=
{})
@base_uri
=
base_uri
@faraday
=
Faraday
.
new
(
@base_uri
)
do
|
builder
|
builder
.
request
:json
builder
.
headers
[
'Accept'
]
=
MANIFEST_VERSION
builder
.
response
:json
,
:content_type
=>
/\bjson$/
builder
.
response
:json
,
:content_type
=>
'application/vnd.docker.distribution.manifest.v1+prettyjws'
if
options
[
:user
]
&&
options
[
:password
]
builder
.
request
(
:basic_auth
,
options
[
:user
].
to_s
,
options
[
:password
].
to_s
)
elsif
options
[
:token
]
builder
.
request
(
:authorization
,
:bearer
,
options
[
:token
].
to_s
)
end
builder
.
adapter
:net_http
@faraday
=
Faraday
.
new
(
@base_uri
)
do
|
conn
|
initialize_connection
(
conn
)
end
end
...
...
@@ -60,5 +48,22 @@ module ContainerRegistry
def
delete_blob
(
name
,
digest
)
@faraday
.
delete
(
"/v2/
#{
name
}
/blobs/
#{
digest
}
"
).
success?
end
private
def
initialize_connection
(
conn
)
conn
.
request
:json
conn
.
headers
[
'Accept'
]
=
MANIFEST_VERSION
conn
.
response
:json
,
:content_type
=>
/\bjson$/
if
options
[
:user
]
&&
options
[
:password
]
conn
.
request
(
:basic_auth
,
options
[
:user
].
to_s
,
options
[
:password
].
to_s
)
elsif
options
[
:token
]
conn
.
request
(
:authorization
,
:bearer
,
options
[
:token
].
to_s
)
end
conn
.
adapter
:net_http
end
end
end
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