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
Léo-Paul Géneau
gitlab-ce
Commits
7027bf40
Commit
7027bf40
authored
Dec 17, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add database seed for build artifacts
parent
2c6b1119
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
db/fixtures/development/14_builds.rb
db/fixtures/development/14_builds.rb
+18
-7
No files found.
db/fixtures/development/14_builds.rb
View file @
7027bf40
Gitlab
::
Seeder
.
quiet
do
Gitlab
::
Seeder
.
quiet
do
build_artifacts_path
=
Rails
.
root
+
'spec/fixtures/ci_build_artifacts.tar.gz'
build_artifacts_cache_file
=
build_artifacts_path
.
to_s
.
gsub
(
'ci_'
,
''
)
Project
.
all
.
sample
(
5
).
each
do
|
project
|
Project
.
all
.
sample
(
5
).
each
do
|
project
|
commits
=
project
.
repository
.
commits
(
'master'
,
nil
,
10
)
commits
=
project
.
repository
.
commits
(
'master'
,
nil
,
5
)
commits_sha
=
commits
.
map
{
|
commit
|
commit
.
raw
.
id
}
commits_sha
=
commits
.
map
{
|
commit
|
commit
.
raw
.
id
}
ci_commits
=
commits_sha
.
map
do
|
sha
|
ci_commits
=
commits_sha
.
map
do
|
sha
|
project
.
ensure_ci_commit
(
sha
)
project
.
ensure_ci_commit
(
sha
)
end
end
ci_commits
.
each
do
|
ci_commit
|
ci_commits
.
each
do
|
ci_commit
|
attributes
=
{
type:
'Ci::Build'
,
name:
'test build'
,
attributes
=
{
type:
'Ci::Build'
,
name:
'test build'
,
commands:
"$ build command"
,
commands:
"$ build command"
,
stage:
'test'
,
stage:
'test'
,
stage_idx:
1
,
ref:
'master'
,
stage_idx:
1
,
ref:
'master'
,
user_id:
User
.
first
,
user_id:
project
.
team
.
users
.
sample
,
gl_project_id:
project
.
id
,
gl_project_id:
project
.
id
,
options:
'---- opts'
,
status:
%w(running pending success failed canceled)
.
sample
,
status:
%w(running pending success failed canceled)
.
sample
,
commit_id:
ci_commit
.
id
}
commit_id:
ci_commit
.
id
,
created_at:
Time
.
now
,
updated_at:
Time
.
now
}
build
=
Ci
::
Build
.
new
(
attributes
)
build
.
artifacts_metadata
=
`tar tzf
#{
build_artifacts_path
}
`
.
split
(
/\n/
)
FileUtils
.
copy
(
build_artifacts_path
,
build_artifacts_cache_file
)
build
.
artifacts_file
=
artifacts_file
=
File
.
open
(
build_artifacts_cache_file
,
'r'
)
begin
begin
Ci
::
Build
.
create!
(
attributes
)
build
.
save!
print
'.'
print
'.'
rescue
ActiveRecord
::
RecordInvalid
rescue
ActiveRecord
::
RecordInvalid
puts
build
.
error
.
messages
.
inspect
print
'F'
print
'F'
ensure
artifacts_file
.
close
end
end
end
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