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
4c1a9080
Commit
4c1a9080
authored
Mar 14, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing specs
parent
d7e629f6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
98 deletions
+15
-98
app/models/upload.rb
app/models/upload.rb
+2
-0
app/uploaders/personal_file_uploader.rb
app/uploaders/personal_file_uploader.rb
+0
-6
config/gitlab.yml.example
config/gitlab.yml.example
+12
-14
ee/lib/ee/gitlab/verify/lfs_objects.rb
ee/lib/ee/gitlab/verify/lfs_objects.rb
+0
-16
ee/lib/ee/gitlab/verify/uploads.rb
ee/lib/ee/gitlab/verify/uploads.rb
+0
-16
lib/tasks/gitlab/uploads/check.rake
lib/tasks/gitlab/uploads/check.rake
+1
-23
lib/tasks/gitlab/uploads/helpers.rb
lib/tasks/gitlab/uploads/helpers.rb
+0
-23
No files found.
app/models/upload.rb
View file @
4c1a9080
class
Upload
<
ActiveRecord
::
Base
class
Upload
<
ActiveRecord
::
Base
prepend
EE
::
Upload
# Upper limit for foreground checksum processing
# Upper limit for foreground checksum processing
CHECKSUM_THRESHOLD
=
100
.
megabytes
CHECKSUM_THRESHOLD
=
100
.
megabytes
...
...
app/uploaders/personal_file_uploader.rb
View file @
4c1a9080
...
@@ -26,12 +26,6 @@ class PersonalFileUploader < FileUploader
...
@@ -26,12 +26,6 @@ class PersonalFileUploader < FileUploader
true
true
end
end
def
object_store
return
Store
::
LOCAL
unless
model
super
end
# Revert-Override
# Revert-Override
def
store_dir
def
store_dir
store_dirs
[
object_store
]
store_dirs
[
object_store
]
...
...
config/gitlab.yml.example
View file @
4c1a9080
...
@@ -182,19 +182,18 @@ production: &base
...
@@ -182,19 +182,18 @@ production: &base
# storage_path: public/
# storage_path: public/
# base_dir: uploads/-/system
# base_dir: uploads/-/system
object_store:
object_store:
enabled: true
enabled: false
remote_directory: uploads # Bucket name
# remote_directory: uploads # Bucket name
# background_upload: false # Temporary option to limit automatic upload (Default: true)
# background_upload: false # Temporary option to limit automatic upload (Default: true)
# proxy_download: false # Passthrough all downloads via GitLab instead of using Redirects to Object Storage
# proxy_download: false # Passthrough all downloads via GitLab instead of using Redirects to Object Storage
connection:
# connection:
provider: AWS
# provider: AWS
aws_access_key_id: AWS_ACCESS_KEY_ID
# aws_access_key_id: AWS_ACCESS_KEY_ID
aws_secret_access_key: AWS_SECRET_ACCESS_KEY
# aws_secret_access_key: AWS_SECRET_ACCESS_KEY
region: eu-central-1
# region: eu-central-1
# Use the following options to configure an AWS compatible host
# host: 'localhost' # default: s3.amazonaws.com
# host: 'localhost' # default: s3.amazonaws.com
# endpoint: 'http://127.0.0.1:9000' # default: nil
# endpoint: 'http://127.0.0.1:9000' # default: nil
# path_style: true # Use 'host/bucket_name/object' instead of 'bucket_name.host/object'
# path_style: true # Use 'host/bucket_name/object' instead of 'bucket_name.host/object'
## GitLab Pages
## GitLab Pages
pages:
pages:
...
@@ -811,7 +810,6 @@ test:
...
@@ -811,7 +810,6 @@ test:
region: us-east-1
region: us-east-1
uploads:
uploads:
storage_path: tmp/tests/public
storage_path: tmp/tests/public
enabled: true
object_store:
object_store:
enabled: false
enabled: false
connection:
connection:
...
...
ee/lib/ee/gitlab/verify/lfs_objects.rb
deleted
100644 → 0
View file @
d7e629f6
module
EE
module
Gitlab
module
Verify
module
LfsObjects
extend
::
Gitlab
::
Utils
::
Override
private
override
:relation
def
relation
super
.
with_files_stored_locally
end
end
end
end
end
ee/lib/ee/gitlab/verify/uploads.rb
deleted
100644 → 0
View file @
d7e629f6
module
EE
module
Gitlab
module
Verify
module
Uploads
extend
::
Gitlab
::
Utils
::
Override
private
override
:relation
def
relation
super
.
with_files_stored_locally
end
end
end
end
end
lib/tasks/gitlab/uploads/check.rake
View file @
4c1a9080
require_relative
'helpers'
namespace
:gitlab
do
namespace
:gitlab
do
namespace
:uploads
do
namespace
:uploads
do
desc
'GitLab | Uploads | Check integrity of uploaded files'
desc
'GitLab | Uploads | Check integrity of uploaded files'
task
check: :environment
do
task
check: :environment
do
include
UploadTaskHelpers
Gitlab
::
Verify
::
RakeTask
.
run!
(
Gitlab
::
Verify
::
Uploads
)
puts
'Checking integrity of uploaded files'
uploads_batches
do
|
batch
|
batch
.
each
do
|
upload
|
begin
puts
"- Checking file (
#{
upload
.
id
}
):
#{
upload
.
absolute_path
}
"
.
color
(
:green
)
if
upload
.
exist?
check_checksum
(
upload
)
else
puts
" * File does not exist on the file system"
.
color
(
:red
)
end
rescue
ObjectStorage
::
RemoteStoreError
puts
"- File (
#{
upload
.
id
}
): File is stored remotely, skipping"
.
color
(
:yellow
)
end
end
end
puts
'Done!'
end
end
end
end
end
end
lib/tasks/gitlab/uploads/helpers.rb
deleted
100644 → 0
View file @
d7e629f6
module
UploadTaskHelpers
def
batch_size
ENV
.
fetch
(
'BATCH'
,
200
).
to_i
end
def
calculate_checksum
(
absolute_path
)
Digest
::
SHA256
.
file
(
absolute_path
).
hexdigest
end
def
check_checksum
(
upload
)
checksum
=
calculate_checksum
(
upload
.
absolute_path
)
if
checksum
!=
upload
.
checksum
puts
" * File checksum (
#{
checksum
}
) does not match the one in the database (
#{
upload
.
checksum
}
)"
.
color
(
:red
)
end
end
def
uploads_batches
(
&
block
)
Upload
.
all
.
in_batches
(
of:
batch_size
,
start:
ENV
[
'ID_FROM'
],
finish:
ENV
[
'ID_TO'
])
do
|
relation
|
# rubocop: disable Cop/InBatches
yield
relation
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