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
Tatuya Kamada
gitlab-ce
Commits
447f5603
Commit
447f5603
authored
Dec 31, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use metadata stored in artifacats metadata file
parent
e3ef0ac8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
app/controllers/projects/artifacts_controller.rb
app/controllers/projects/artifacts_controller.rb
+2
-2
app/models/ci/build.rb
app/models/ci/build.rb
+17
-2
lib/gitlab/string_path.rb
lib/gitlab/string_path.rb
+1
-1
No files found.
app/controllers/projects/artifacts_controller.rb
View file @
447f5603
...
...
@@ -18,8 +18,8 @@ class Projects::ArtifactsController < Projects::ApplicationController
return
render_404
unless
build
.
artifacts?
current_path
=
params
[
:path
]
?
"./
#{
params
[
:path
]
}
/"
:
'./'
artifacts_metadata
=
build
.
artifacts_metadata_for
(
current_path
)
@path
=
Gitlab
::
StringPath
.
new
(
current_path
,
artifacts_
metadata
)
metadata
=
build
.
artifacts_metadata_for_path
(
current_path
)
@path
=
Gitlab
::
StringPath
.
new
(
current_path
,
metadata
)
end
private
...
...
app/models/ci/build.rb
View file @
447f5603
...
...
@@ -349,8 +349,23 @@ module Ci
artifacts?
&&
artifacts_file
.
path
.
end_with?
(
'zip'
)
&&
artifacts_metadata
.
exists?
end
def
artifacts_metadata_for
(
path
)
{}
def
artifacts_metadata_for_path
(
path
)
return
{}
unless
artifacts_metadata
.
exists?
metadata
=
[]
meta_path
=
path
.
sub
(
/^\.\//
,
''
)
File
.
open
(
artifacts_metadata
.
path
)
do
|
file
|
gzip
=
Zlib
::
GzipReader
.
new
(
file
)
gzip
.
each_line
do
|
line
|
if
line
=~
%r{^
#{
meta_path
}
[^/]+/?
\s
}
path
,
meta
=
line
.
split
(
' '
)
metadata
<<
path
end
end
gzip
.
close
end
metadata
end
private
...
...
lib/gitlab/string_path.rb
View file @
447f5603
...
...
@@ -5,7 +5,7 @@ module Gitlab
# This is IO-operations safe class, that does similar job to
# Ruby's Pathname but without the risk of accessing filesystem.
#
# TODO
:
better support for '../' and './'
# TODO
,
better support for '../' and './'
#
class
StringPath
attr_reader
:path
,
:universe
...
...
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