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
ad5302ba
Commit
ad5302ba
authored
Dec 30, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Seed db on development with artifacts metadata fixture
parent
662f4b9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
db/fixtures/development/14_builds.rb
db/fixtures/development/14_builds.rb
+18
-5
No files found.
db/fixtures/development/14_builds.rb
View file @
ad5302ba
...
...
@@ -9,11 +9,14 @@ class Gitlab::Seeder::Builds
ci_commits
.
each
do
|
ci_commit
|
build
=
Ci
::
Build
.
new
(
build_attributes_for
(
ci_commit
))
FileUtils
.
copy
(
artifacts_path
,
artifacts_cache_file_path
)
File
.
open
(
artifacts_cache_file_path
,
'r'
)
do
|
file
|
artifacts_cache_file
(
artifacts_archive_path
)
do
|
file
|
build
.
artifacts_file
=
file
end
artifacts_cache_file
(
artifacts_metadata_path
)
do
|
file
|
build
.
artifacts_metadata
=
file
end
begin
build
.
save!
print
'.'
...
...
@@ -49,12 +52,22 @@ class Gitlab::Seeder::Builds
BUILD_STATUSES
.
sample
end
def
artifacts_path
def
artifacts_
archive_
path
Rails
.
root
+
'spec/fixtures/ci_build_artifacts.zip'
end
def
artifacts_cache_file_path
artifacts_path
.
to_s
.
gsub
(
'ci_'
,
"p
#{
@project
.
id
}
_"
)
def
artifacts_metadata_path
Rails
.
root
+
'spec/fixtures/ci_build_artifacts_metadata.gz'
end
def
artifacts_cache_file
(
file_path
)
cache_path
=
file_path
.
to_s
.
gsub
(
'ci_'
,
"p
#{
@project
.
id
}
_"
)
FileUtils
.
copy
(
file_path
,
cache_path
)
File
.
open
(
cache_path
)
do
|
file
|
yield
file
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