BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
37 deletions
+48
-37
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,39 +77,41 @@ class Gitlab::Seeder::CycleAnalytics
end
def
seed!
Sidekiq
::
Testing
.
inline!
do
issues
=
create_issues
puts
'.'
# Stage 1
Timecop
.
travel
5
.
days
.
from_now
add_milestones_and_list_labels
(
issues
)
print
'.'
# Stage 2
Timecop
.
travel
5
.
days
.
from_now
branches
=
mention_in_commits
(
issues
)
print
'.'
# Stage 3
Timecop
.
travel
5
.
days
.
from_now
merge_requests
=
create_merge_requests_closing_issues
(
issues
,
branches
)
print
'.'
# Stage 4
Timecop
.
travel
5
.
days
.
from_now
run_builds
(
merge_requests
)
print
'.'
# Stage 5
Timecop
.
travel
5
.
days
.
from_now
merge_merge_requests
(
merge_requests
)
print
'.'
# Stage 6 / 7
Timecop
.
travel
5
.
days
.
from_now
deploy_to_production
(
merge_requests
)
print
'.'
Sidekiq
::
Worker
.
skipping_transaction_check
do
Sidekiq
::
Testing
.
inline!
do
issues
=
create_issues
puts
'.'
# Stage 1
Timecop
.
travel
5
.
days
.
from_now
add_milestones_and_list_labels
(
issues
)
print
'.'
# Stage 2
Timecop
.
travel
5
.
days
.
from_now
branches
=
mention_in_commits
(
issues
)
print
'.'
# Stage 3
Timecop
.
travel
5
.
days
.
from_now
merge_requests
=
create_merge_requests_closing_issues
(
issues
,
branches
)
print
'.'
# Stage 4
Timecop
.
travel
5
.
days
.
from_now
run_builds
(
merge_requests
)
print
'.'
# Stage 5
Timecop
.
travel
5
.
days
.
from_now
merge_merge_requests
(
merge_requests
)
print
'.'
# Stage 6 / 7
Timecop
.
travel
5
.
days
.
from_now
deploy_to_production
(
merge_requests
)
print
'.'
end
end
print
'.'
...
...
@@ -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