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
272af7a2
Commit
272af7a2
authored
Feb 21, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
porting spec/support/db
parent
b47d64b0
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
33 additions
and
38 deletions
+33
-38
app/controllers/concerns/send_file_upload.rb
app/controllers/concerns/send_file_upload.rb
+0
-0
app/models/ci/job_artifact.rb
app/models/ci/job_artifact.rb
+7
-0
app/models/lfs_object.rb
app/models/lfs_object.rb
+7
-0
db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
+0
-0
db/migrate/20170918072949_add_file_store_job_artifacts.rb
db/migrate/20170918072949_add_file_store_job_artifacts.rb
+0
-0
db/migrate/20171214144320_add_store_column_to_uploads.rb
db/migrate/20171214144320_add_store_column_to_uploads.rb
+0
-0
doc/administration/job_artifacts.md
doc/administration/job_artifacts.md
+3
-2
doc/workflow/lfs/lfs_administration.md
doc/workflow/lfs/lfs_administration.md
+1
-1
ee/app/models/ee/ci/job_artifact.rb
ee/app/models/ee/ci/job_artifact.rb
+0
-8
ee/app/models/ee/lfs_object.rb
ee/app/models/ee/lfs_object.rb
+0
-9
spec/support/shared_examples/uploaders/object_storage_shared_examples.rb
...ared_examples/uploaders/object_storage_shared_examples.rb
+0
-0
spec/support/stub_object_storage.rb
spec/support/stub_object_storage.rb
+0
-0
spec/tasks/gitlab/artifacts_rake_spec.rb
spec/tasks/gitlab/artifacts_rake_spec.rb
+0
-0
spec/tasks/gitlab/lfs/migrate_rake_spec.rb
spec/tasks/gitlab/lfs/migrate_rake_spec.rb
+0
-0
spec/tasks/gitlab/uploads/check_rake_spec.rb
spec/tasks/gitlab/uploads/check_rake_spec.rb
+15
-18
spec/tasks/gitlab/uploads/migrate_rake_spec.rb
spec/tasks/gitlab/uploads/migrate_rake_spec.rb
+0
-0
No files found.
ee/
app/controllers/concerns/send_file_upload.rb
→
app/controllers/concerns/send_file_upload.rb
View file @
272af7a2
File moved
app/models/ci/job_artifact.rb
View file @
272af7a2
...
...
@@ -2,6 +2,7 @@ module Ci
class
JobArtifact
<
ActiveRecord
::
Base
prepend
EE
::
Ci
::
JobArtifact
include
AfterCommitQueue
include
ObjectStorage
::
BackgroundMove
extend
Gitlab
::
Ci
::
Model
belongs_to
:project
...
...
@@ -9,6 +10,8 @@ module Ci
before_save
:set_size
,
if: :file_changed?
scope
:with_files_stored_locally
,
->
{
where
(
file_store:
[
nil
,
::
JobArtifactUploader
::
Store
::
LOCAL
])
}
mount_uploader
:file
,
JobArtifactUploader
delegate
:exists?
,
:open
,
to: :file
...
...
@@ -23,6 +26,10 @@ module Ci
self
.
where
(
project:
project
).
sum
(
:size
)
end
def
local_store?
[
nil
,
::
JobArtifactUploader
::
Store
::
LOCAL
].
include?
(
self
.
file_store
)
end
def
set_size
self
.
size
=
file
.
size
end
...
...
app/models/lfs_object.rb
View file @
272af7a2
class
LfsObject
<
ActiveRecord
::
Base
prepend
EE
::
LfsObject
include
AfterCommitQueue
include
ObjectStorage
::
BackgroundMove
has_many
:lfs_objects_projects
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:projects
,
through: :lfs_objects_projects
scope
:with_files_stored_locally
,
->
{
where
(
file_store:
[
nil
,
LfsObjectUploader
::
Store
::
LOCAL
])
}
validates
:oid
,
presence:
true
,
uniqueness:
true
mount_uploader
:file
,
LfsObjectUploader
...
...
@@ -19,6 +22,10 @@ class LfsObject < ActiveRecord::Base
projects
.
exists?
(
project
.
lfs_storage_project
.
id
)
end
def
local_store?
[
nil
,
LfsObjectUploader
::
Store
::
LOCAL
].
include?
(
self
.
file_store
)
end
def
self
.
destroy_unreferenced
joins
(
"LEFT JOIN lfs_objects_projects ON lfs_objects_projects.lfs_object_id =
#{
table_name
}
.id"
)
.
where
(
lfs_objects_projects:
{
id:
nil
})
...
...
ee/
db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
→
db/migrate/20170825015534_add_file_store_to_lfs_objects.rb
View file @
272af7a2
File moved
ee/
db/migrate/20170918072949_add_file_store_job_artifacts.rb
→
db/migrate/20170918072949_add_file_store_job_artifacts.rb
View file @
272af7a2
File moved
ee/
db/migrate/20171214144320_add_store_column_to_uploads.rb
→
db/migrate/20171214144320_add_store_column_to_uploads.rb
View file @
272af7a2
File moved
doc/administration/job_artifacts.md
View file @
272af7a2
...
...
@@ -93,11 +93,12 @@ _The artifacts are stored by default in
9.
4 lacks this feature.
> Available in [GitLab Premium](https://about.gitlab.com/products/) and
[
GitLab.com Silver
](
https://about.gitlab.com/gitlab-com/
)
.
> Since version 10.6, available in [GitLab CE](https://about.gitlab.com/products/)
If you don't want to use the local disk where GitLab is installed to store the
artifacts, you can use an object storage like AWS S3 instead.
This configuration relies on valid AWS credentials to be configured already.
Use an
[
Object storage option
][
ee-
os
]
like AWS S3 to store job artifacts.
Use an
[
Object storage option
][
os
]
like AWS S3 to store job artifacts.
### Object Storage Settings
...
...
@@ -313,4 +314,4 @@ memory and disk I/O.
[
eep
]:
https://about.gitlab.com/products/
"GitLab Premium"
[
ee-1762
]:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1762
[
browsable
]:
../user/project/pipelines/job_artifacts.md#browsing-job-artifacts
[
ee-os
]:
https://docs.gitlab.com/ee
/administration/job_artifacts.html#using-object-storage
[
os
]:
https://docs.gitlab.com
/administration/job_artifacts.html#using-object-storage
doc/workflow/lfs/lfs_administration.md
View file @
272af7a2
...
...
@@ -21,7 +21,6 @@ There are various configuration options to help GitLab server administrators:
### Omnibus packages
In
`/etc/gitlab/gitlab.rb`
:
```
ruby
...
...
@@ -48,6 +47,7 @@ In `config/gitlab.yml`:
## Setting up S3 compatible object storage
> **Note:** [Introduced][ee-2760] in [GitLab Premium][eep] 10.0.
> Available in [GitLab CE][ce] 10.6
It is possible to store LFS objects on remote object storage instead of on a local disk.
...
...
ee/app/models/ee/ci/job_artifact.rb
View file @
272af7a2
...
...
@@ -7,15 +7,7 @@ module EE
extend
ActiveSupport
::
Concern
prepended
do
include
ObjectStorage
::
BackgroundMove
after_destroy
:log_geo_event
scope
:with_files_stored_locally
,
->
{
where
(
file_store:
[
nil
,
::
JobArtifactUploader
::
Store
::
LOCAL
])
}
end
def
local_store?
[
nil
,
::
JobArtifactUploader
::
Store
::
LOCAL
].
include?
(
self
.
file_store
)
end
private
...
...
ee/app/models/ee/lfs_object.rb
View file @
272af7a2
...
...
@@ -7,16 +7,7 @@ module EE
extend
ActiveSupport
::
Concern
prepended
do
include
ObjectStorage
::
BackgroundMove
after_destroy
:log_geo_event
scope
:with_files_stored_locally
,
->
{
where
(
file_store:
[
nil
,
LfsObjectUploader
::
Store
::
LOCAL
])
}
scope
:with_files_stored_remotely
,
->
{
where
(
file_store:
ObjectStorage
::
Store
::
REMOTE
)
}
end
def
local_store?
[
nil
,
LfsObjectUploader
::
Store
::
LOCAL
].
include?
(
self
.
file_store
)
end
private
...
...
ee/
spec/support/shared_examples/uploaders/object_storage_shared_examples.rb
→
spec/support/shared_examples/uploaders/object_storage_shared_examples.rb
View file @
272af7a2
File moved
ee/
spec/support/stub_object_storage.rb
→
spec/support/stub_object_storage.rb
View file @
272af7a2
File moved
ee/
spec/tasks/gitlab/artifacts_rake_spec.rb
→
spec/tasks/gitlab/artifacts_rake_spec.rb
View file @
272af7a2
File moved
ee/
spec/tasks/gitlab/lfs/migrate_rake_spec.rb
→
spec/tasks/gitlab/lfs/migrate_rake_spec.rb
View file @
272af7a2
File moved
spec/tasks/gitlab/uploads/check_rake_spec.rb
View file @
272af7a2
require
'rake_helper'
describe
'gitlab:uploads rake tasks'
do
describe
'check'
do
let!
(
:upload
)
{
create
(
:upload
,
path:
Rails
.
root
.
join
(
'spec/fixtures/banana_sample.gif'
))
}
describe
'gitlab:uploads:check rake tasks'
do
let!
(
:upload
)
{
create
(
:upload
,
path:
Rails
.
root
.
join
(
'spec/fixtures/banana_sample.gif'
))
}
before
do
Rake
.
application
.
rake_require
(
'tasks/gitlab/uploads/check'
)
stub_env
(
'VERBOSE'
=>
'true'
)
end
before
do
Rake
.
application
.
rake_require
'tasks/gitlab/uploads/check'
end
it
'outputs the integrity check for each batch
'
do
expect
{
run_rake_task
(
'gitlab:uploads:check'
)
}.
to
output
(
/Failures: 0
/
).
to_stdout
end
it
'outputs the integrity check for each uploaded file
'
do
expect
{
run_rake_task
(
'gitlab:uploads:check'
)
}.
to
output
(
/Checking file \(
#{
upload
.
id
}
\):
#{
Regexp
.
quote
(
upload
.
absolute_path
)
}
/
).
to_stdout
end
it
'errors out about missing files on the file system'
do
missing_upload
=
create
(
:upload
)
it
'errors out about missing files on the file system'
do
create
(
:upload
)
expect
{
run_rake_task
(
'gitlab:uploads:check'
)
}.
to
output
(
/No such file.*
#{
Regexp
.
quote
(
missing_upload
.
absolute_path
)
}
/
).
to_stdout
end
expect
{
run_rake_task
(
'gitlab:uploads:check'
)
}.
to
output
(
/File does not exist on the file system
/
).
to_stdout
end
it
'errors out about invalid checksum'
do
upload
.
update_column
(
:checksum
,
'01a3156db2cf4f67ec823680b40b7302f89ab39179124ad219f94919b8a1769e'
)
it
'errors out about invalid checksum'
do
upload
.
update_column
(
:checksum
,
'01a3156db2cf4f67ec823680b40b7302f89ab39179124ad219f94919b8a1769e'
)
expect
{
run_rake_task
(
'gitlab:uploads:check'
)
}.
to
output
(
/Checksum mismatch/
).
to_stdout
end
expect
{
run_rake_task
(
'gitlab:uploads:check'
)
}.
to
output
(
/File checksum \(9e697aa09fe196909813ee36103e34f721fe47a5fdc8aac0e4e4ac47b9b38282\) does not match the one in the database \(
#{
upload
.
checksum
}
\)/
).
to_stdout
end
end
ee/
spec/tasks/gitlab/uploads/migrate_rake_spec.rb
→
spec/tasks/gitlab/uploads/migrate_rake_spec.rb
View file @
272af7a2
File moved
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