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
f52f62d7
Commit
f52f62d7
authored
Aug 16, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update fixtures to make development testing easier
parent
fee7992c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
db/fixtures/development/14_builds.rb
db/fixtures/development/14_builds.rb
+26
-6
No files found.
db/fixtures/development/14_builds.rb
View file @
f52f62d7
...
...
@@ -28,24 +28,44 @@ class Gitlab::Seeder::Builds
build_create!
(
pipeline
,
name:
'production'
,
stage:
'deploy'
,
environment:
'production'
,
when:
'manual'
,
status: :success
)
commit_status_create!
(
pipeline
,
name:
'jenkins'
,
status: :success
)
print
'.'
rescue
ActiveRecord
::
RecordInvalid
print
'F'
ensure
pipeline
.
build_updated
end
end
end
def
pipelines
commits
=
@project
.
repository
.
commits
(
'master'
,
limit:
5
)
commits_sha
=
commits
.
map
{
|
commit
|
commit
.
raw
.
id
}
commits_sha
.
map
do
|
sha
|
@project
.
ensure_pipeline
(
sha
,
'master'
)
master_pipelines
+
merge_request_pipelines
end
def
master_pipelines
create_pipelines_for
(
@project
,
'master'
)
rescue
[]
end
def
merge_request_pipelines
@project
.
merge_requests
.
last
(
5
).
map
do
|
merge_request
|
create_pipelines
(
merge_request
.
source_project
,
merge_request
.
source_branch
,
merge_request
.
commits
.
last
(
5
))
end
.
flatten
rescue
[]
end
def
create_pipelines_for
(
project
,
ref
)
commits
=
project
.
repository
.
commits
(
ref
,
limit:
5
)
create_pipelines
(
project
,
ref
,
commits
)
end
def
create_pipelines
(
project
,
ref
,
commits
)
commits
.
map
do
|
commit
|
project
.
pipelines
.
create
(
sha:
commit
.
id
,
ref:
ref
)
end
end
def
build_create!
(
pipeline
,
opts
=
{})
attributes
=
build_attributes_for
(
pipeline
,
opts
)
build
=
Ci
::
Build
.
create!
(
attributes
)
...
...
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