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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
487b0a02
Commit
487b0a02
authored
Jan 12, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements, readability for artifacts browser
parent
2be76355
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
17 deletions
+19
-17
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+7
-7
app/models/ability.rb
app/models/ability.rb
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+1
-1
app/views/admin/builds/_build.html.haml
app/views/admin/builds/_build.html.haml
+1
-1
app/views/projects/builds/show.html.haml
app/views/projects/builds/show.html.haml
+1
-1
app/views/projects/commit_statuses/_commit_status.html.haml
app/views/projects/commit_statuses/_commit_status.html.haml
+1
-1
lib/gitlab/ci/build/artifacts/metadata.rb
lib/gitlab/ci/build/artifacts/metadata.rb
+7
-5
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
487b0a02
class
Projects::ArtifactsController
<
Projects
::
ApplicationController
class
Projects::ArtifactsController
<
Projects
::
ApplicationController
layout
'project'
layout
'project'
before_action
:authorize_
downlo
ad_build_artifacts!
before_action
:authorize_
re
ad_build_artifacts!
def
download
def
download
unless
artifacts_file
.
file_storage?
unless
artifacts_file
.
file_storage?
...
@@ -24,11 +24,11 @@ class Projects::ArtifactsController < Projects::ApplicationController
...
@@ -24,11 +24,11 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
end
def
file
def
file
file
=
build
.
artifacts_metadata_path
(
params
[
:path
])
file
_path
=
build
.
artifacts_metadata_path
(
params
[
:path
])
if
file
.
exists?
if
file
_path
.
exists?
render
json:
{
repository
:
build
.
artifacts_file
.
path
,
render
json:
{
archive
:
build
.
artifacts_file
.
path
,
path:
Base64
.
encode64
(
file
.
path
)
}
path:
Base64
.
encode64
(
file
_path
.
path
)
}
else
else
render
json:
{},
status:
404
render
json:
{},
status:
404
end
end
...
@@ -44,8 +44,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
...
@@ -44,8 +44,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
@artifacts_file
||=
build
.
artifacts_file
@artifacts_file
||=
build
.
artifacts_file
end
end
def
authorize_
downlo
ad_build_artifacts!
def
authorize_
re
ad_build_artifacts!
unless
can?
(
current_user
,
:
downlo
ad_build_artifacts
,
@project
)
unless
can?
(
current_user
,
:
re
ad_build_artifacts
,
@project
)
if
current_user
.
nil?
if
current_user
.
nil?
return
authenticate_user!
return
authenticate_user!
else
else
...
...
app/models/ability.rb
View file @
487b0a02
...
@@ -175,7 +175,7 @@ class Ability
...
@@ -175,7 +175,7 @@ class Ability
:create_merge_request
,
:create_merge_request
,
:create_wiki
,
:create_wiki
,
:manage_builds
,
:manage_builds
,
:
downlo
ad_build_artifacts
,
:
re
ad_build_artifacts
,
:push_code
:push_code
]
]
end
end
...
...
app/models/ci/build.rb
View file @
487b0a02
...
@@ -344,7 +344,7 @@ module Ci
...
@@ -344,7 +344,7 @@ module Ci
end
end
def
artifacts_browser_supported?
def
artifacts_browser_supported?
artifacts?
&&
artifacts_
file
.
path
.
end_with?
(
'zip'
)
&&
artifacts_
metadata
.
exists?
artifacts?
&&
artifacts_metadata
.
exists?
end
end
def
artifacts_metadata_path
(
path
)
def
artifacts_metadata_path
(
path
)
...
...
app/views/admin/builds/_build.html.haml
View file @
487b0a02
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
%td
%td
.pull-right
.pull-right
-
if
current_user
&&
can?
(
current_user
,
:
downlo
ad_build_artifacts
,
project
)
&&
build
.
artifacts?
-
if
current_user
&&
can?
(
current_user
,
:
re
ad_build_artifacts
,
project
)
&&
build
.
artifacts?
=
link_to
build
.
artifacts_download_url
,
title:
'Download artifacts'
do
=
link_to
build
.
artifacts_download_url
,
title:
'Download artifacts'
do
%i
.fa.fa-download
%i
.fa.fa-download
-
if
current_user
&&
can?
(
current_user
,
:manage_builds
,
build
.
project
)
-
if
current_user
&&
can?
(
current_user
,
:manage_builds
,
build
.
project
)
...
...
app/views/projects/builds/show.html.haml
View file @
487b0a02
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
Test coverage
Test coverage
%h1
#{
@build
.
coverage
}
%
%h1
#{
@build
.
coverage
}
%
-
if
current_user
&&
can?
(
current_user
,
:
downlo
ad_build_artifacts
,
@project
)
&&
@build
.
artifacts?
-
if
current_user
&&
can?
(
current_user
,
:
re
ad_build_artifacts
,
@project
)
&&
@build
.
artifacts?
.build-widget.artifacts
.build-widget.artifacts
%h4
.title
Build artifacts
%h4
.title
Build artifacts
...
...
app/views/projects/commit_statuses/_commit_status.html.haml
View file @
487b0a02
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
%td
%td
.pull-right
.pull-right
-
if
current_user
&&
can?
(
current_user
,
:
downlo
ad_build_artifacts
,
commit_status
.
project
)
&&
commit_status
.
artifacts?
-
if
current_user
&&
can?
(
current_user
,
:
re
ad_build_artifacts
,
commit_status
.
project
)
&&
commit_status
.
artifacts?
=
link_to
commit_status
.
artifacts_download_url
,
title:
'Download artifacts'
do
=
link_to
commit_status
.
artifacts_download_url
,
title:
'Download artifacts'
do
%i
.fa.fa-download
%i
.fa.fa-download
-
if
current_user
&&
can?
(
current_user
,
:manage_builds
,
commit_status
.
project
)
-
if
current_user
&&
can?
(
current_user
,
:manage_builds
,
commit_status
.
project
)
...
...
lib/gitlab/ci/build/artifacts/metadata.rb
View file @
487b0a02
...
@@ -56,7 +56,7 @@ module Gitlab
...
@@ -56,7 +56,7 @@ module Gitlab
next
if
path
=~
invalid_pattern
next
if
path
=~
invalid_pattern
paths
.
push
(
path
)
paths
.
push
(
path
)
metadata
.
push
(
JSON
.
parse
(
meta
.
chomp
,
symbolize_names:
true
))
metadata
.
push
(
JSON
.
parse
(
meta
,
symbolize_names:
true
))
rescue
JSON
::
ParserError
,
Encoding
::
CompatibilityError
rescue
JSON
::
ParserError
,
Encoding
::
CompatibilityError
next
next
end
end
...
@@ -66,7 +66,7 @@ module Gitlab
...
@@ -66,7 +66,7 @@ module Gitlab
end
end
def
read_version
def
read_version
gzip
do
|
gz
|
gzip
do
|
gz
|
version_string
=
read_string
(
gz
)
version_string
=
read_string
(
gz
)
unless
version_string
unless
version_string
...
@@ -95,9 +95,11 @@ module Gitlab
...
@@ -95,9 +95,11 @@ module Gitlab
def
gzip
def
gzip
open
do
|
file
|
open
do
|
file
|
gzip
=
Zlib
::
GzipReader
.
new
(
file
)
gzip
=
Zlib
::
GzipReader
.
new
(
file
)
result
=
yield
gzip
begin
yield
gzip
ensure
gzip
.
close
gzip
.
close
result
end
end
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