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
Boxiang Sun
gitlab-ce
Commits
c5597547
Commit
c5597547
authored
Oct 03, 2018
by
Toon Claes
Committed by
Douglas Barbosa Alexandre
Oct 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of "Use Geo log to remove files when migrated to object storage"
parent
f4db21eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
0 deletions
+24
-0
app/uploaders/gitlab_uploader.rb
app/uploaders/gitlab_uploader.rb
+10
-0
app/uploaders/job_artifact_uploader.rb
app/uploaders/job_artifact_uploader.rb
+2
-0
app/uploaders/legacy_artifact_uploader.rb
app/uploaders/legacy_artifact_uploader.rb
+2
-0
app/uploaders/lfs_object_uploader.rb
app/uploaders/lfs_object_uploader.rb
+2
-0
spec/support/shared_examples/uploaders/gitlab_uploader_shared_examples.rb
...red_examples/uploaders/gitlab_uploader_shared_examples.rb
+8
-0
No files found.
app/uploaders/gitlab_uploader.rb
View file @
c5597547
...
@@ -63,6 +63,12 @@ class GitlabUploader < CarrierWave::Uploader::Base
...
@@ -63,6 +63,12 @@ class GitlabUploader < CarrierWave::Uploader::Base
super
||
file
&
.
filename
super
||
file
&
.
filename
end
end
def
relative_path
return
path
if
pathname
.
relative?
pathname
.
relative_path_from
(
Pathname
.
new
(
root
))
end
def
model_valid?
def
model_valid?
!!
model
!!
model
end
end
...
@@ -115,4 +121,8 @@ class GitlabUploader < CarrierWave::Uploader::Base
...
@@ -115,4 +121,8 @@ class GitlabUploader < CarrierWave::Uploader::Base
# the cache directory.
# the cache directory.
File
.
join
(
work_dir
,
cache_id
,
version_name
.
to_s
,
for_file
)
File
.
join
(
work_dir
,
cache_id
,
version_name
.
to_s
,
for_file
)
end
end
def
pathname
@pathname
||=
Pathname
.
new
(
path
)
end
end
end
app/uploaders/job_artifact_uploader.rb
View file @
c5597547
...
@@ -9,6 +9,8 @@ class JobArtifactUploader < GitlabUploader
...
@@ -9,6 +9,8 @@ class JobArtifactUploader < GitlabUploader
storage_options
Gitlab
.
config
.
artifacts
storage_options
Gitlab
.
config
.
artifacts
alias_method
:upload
,
:model
def
cached_size
def
cached_size
return
model
.
size
if
model
.
size
.
present?
&&
!
model
.
file_changed?
return
model
.
size
if
model
.
size
.
present?
&&
!
model
.
file_changed?
...
...
app/uploaders/legacy_artifact_uploader.rb
View file @
c5597547
...
@@ -8,6 +8,8 @@ class LegacyArtifactUploader < GitlabUploader
...
@@ -8,6 +8,8 @@ class LegacyArtifactUploader < GitlabUploader
storage_options
Gitlab
.
config
.
artifacts
storage_options
Gitlab
.
config
.
artifacts
alias_method
:upload
,
:model
def
store_dir
def
store_dir
dynamic_segment
dynamic_segment
end
end
...
...
app/uploaders/lfs_object_uploader.rb
View file @
c5597547
...
@@ -6,6 +6,8 @@ class LfsObjectUploader < GitlabUploader
...
@@ -6,6 +6,8 @@ class LfsObjectUploader < GitlabUploader
storage_options
Gitlab
.
config
.
lfs
storage_options
Gitlab
.
config
.
lfs
alias_method
:upload
,
:model
def
filename
def
filename
model
.
oid
[
4
..-
1
]
model
.
oid
[
4
..-
1
]
end
end
...
...
spec/support/shared_examples/uploaders/gitlab_uploader_shared_examples.rb
View file @
c5597547
...
@@ -33,6 +33,14 @@ shared_examples "builds correct paths" do |**patterns|
...
@@ -33,6 +33,14 @@ shared_examples "builds correct paths" do |**patterns|
it_behaves_like
"matches the method pattern"
,
:upload_path
it_behaves_like
"matches the method pattern"
,
:upload_path
end
end
describe
"#relative_path"
do
it
'is relative'
do
skip
'Path not set, skipping.'
unless
subject
.
path
expect
(
Pathname
.
new
(
subject
.
relative_path
)).
to
be_relative
end
end
describe
".absolute_path"
do
describe
".absolute_path"
do
it_behaves_like
"matches the method pattern"
,
:absolute_path
do
it_behaves_like
"matches the method pattern"
,
:absolute_path
do
let
(
:target
)
{
subject
.
class
}
let
(
:target
)
{
subject
.
class
}
...
...
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