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
Jérome Perrin
gitlab-ce
Commits
7897d04f
Commit
7897d04f
authored
Nov 16, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CycleAnalytics seed to account for multiple issue assignees
parent
d41e66cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
37 deletions
+48
-37
db/fixtures/development/17_cycle_analytics.rb
db/fixtures/development/17_cycle_analytics.rb
+48
-37
No files found.
db/fixtures/development/17_cycle_analytics.rb
View file @
7897d04f
...
...
@@ -4,7 +4,7 @@ require './spec/support/test_env'
class
Gitlab::Seeder::CycleAnalytics
def
initialize
(
project
,
perf:
false
)
@project
=
project
@user
=
User
.
order
(
:id
).
la
st
@user
=
User
.
admins
.
fir
st
@issue_count
=
perf
?
1000
:
5
stub_git_pre_receive!
end
...
...
@@ -77,6 +77,7 @@ class Gitlab::Seeder::CycleAnalytics
end
def
seed!
Sidekiq
::
Worker
.
skipping_transaction_check
do
Sidekiq
::
Testing
.
inline!
do
issues
=
create_issues
puts
'.'
...
...
@@ -111,6 +112,7 @@ class Gitlab::Seeder::CycleAnalytics
deploy_to_production
(
merge_requests
)
print
'.'
end
end
print
'.'
end
...
...
@@ -123,7 +125,7 @@ class Gitlab::Seeder::CycleAnalytics
title:
"Cycle Analytics:
#{
FFaker
::
Lorem
.
sentence
(
6
)
}
"
,
description:
FFaker
::
Lorem
.
sentence
,
state:
'opened'
,
assignee
:
@project
.
team
.
users
.
sample
assignee
s:
[
@project
.
team
.
users
.
sample
]
}
Issues
::
CreateService
.
new
(
@project
,
@project
.
team
.
users
.
sample
,
issue_params
).
execute
...
...
@@ -155,7 +157,7 @@ class Gitlab::Seeder::CycleAnalytics
issue
.
project
.
repository
.
add_branch
(
@user
,
branch_name
,
'master'
)
commit_sha
=
issue
.
project
.
repository
.
create_file
(
@user
,
filename
,
"content"
,
message:
"Commit for #
#{
issue
.
iid
}
"
,
branch_name:
branch_name
)
commit_sha
=
issue
.
project
.
repository
.
create_file
(
@user
,
filename
,
"content"
,
message:
"Commit for
#
{
issue
.
to_reference
}
"
,
branch_name:
branch_name
)
issue
.
project
.
repository
.
commit
(
commit_sha
)
GitPushService
.
new
(
issue
.
project
,
...
...
@@ -210,6 +212,8 @@ class Gitlab::Seeder::CycleAnalytics
def
deploy_to_production
(
merge_requests
)
merge_requests
.
each
do
|
merge_request
|
next
unless
merge_request
.
head_pipeline
Timecop
.
travel
12
.
hours
.
from_now
job
=
merge_request
.
head_pipeline
.
builds
.
where
.
not
(
environment:
nil
).
last
...
...
@@ -223,7 +227,14 @@ Gitlab::Seeder.quiet do
flag
=
'SEED_CYCLE_ANALYTICS'
if
ENV
[
flag
]
Project
.
all
.
each
do
|
project
|
Project
.
find_each
do
|
project
|
# This seed naively assumes that every project has a repository, and every
# repository has a `master` branch, which may be the case for a pristine
# GDK seed, but is almost never true for a GDK that's actually had
# development performed on it.
next
unless
project
.
repository_exists?
next
unless
project
.
repository
.
commit
(
'master'
)
seeder
=
Gitlab
::
Seeder
::
CycleAnalytics
.
new
(
project
)
seeder
.
seed!
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