Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
b0dbc47e
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0dbc47e
编写于
8月 08, 2018
作者:
S
Shinya Maeda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify fixtures
上级
693a95f2
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
20 addition
and
87 deletion
+20
-87
db/fixtures/development/14_pipelines.rb
db/fixtures/development/14_pipelines.rb
+20
-87
spec/fixtures/junit/junit_feature.xml.gz
spec/fixtures/junit/junit_feature.xml.gz
+0
-0
spec/fixtures/junit/junit_feature_ant.xml.gz
spec/fixtures/junit/junit_feature_ant.xml.gz
+0
-0
spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz
spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz
+0
-0
spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz
spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz
+0
-0
spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz
spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz
+0
-0
spec/fixtures/junit/junit_master.xml.gz
spec/fixtures/junit/junit_master.xml.gz
+0
-0
spec/fixtures/junit/junit_master_ant.xml.gz
spec/fixtures/junit/junit_master_ant.xml.gz
+0
-0
spec/fixtures/junit/junit_master_rspec_0_3.xml.gz
spec/fixtures/junit/junit_master_rspec_0_3.xml.gz
+0
-0
spec/fixtures/junit/junit_master_rspec_1_3.xml.gz
spec/fixtures/junit/junit_master_rspec_1_3.xml.gz
+0
-0
spec/fixtures/junit/junit_master_rspec_2_3.xml.gz
spec/fixtures/junit/junit_master_rspec_2_3.xml.gz
+0
-0
未找到文件。
db/fixtures/development/14_pipelines.rb
浏览文件 @
b0dbc47e
...
...
@@ -30,8 +30,6 @@ class Gitlab::Seeder::Pipelines
queued_at:
8
.
hour
.
ago
,
started_at:
8
.
hour
.
ago
,
finished_at:
7
.
hour
.
ago
},
{
name:
'spinach:osx'
,
stage:
'test'
,
status: :failed
,
allow_failure:
true
,
queued_at:
8
.
hour
.
ago
,
started_at:
8
.
hour
.
ago
,
finished_at:
7
.
hour
.
ago
},
{
name:
'java ant'
,
stage:
'test'
,
status: :failed
,
allow_failure:
true
,
queued_at:
8
.
hour
.
ago
,
started_at:
8
.
hour
.
ago
,
finished_at:
7
.
hour
.
ago
},
# deploy stage
{
name:
'staging'
,
stage:
'deploy'
,
environment:
'staging'
,
status_event: :success
,
...
...
@@ -63,51 +61,6 @@ class Gitlab::Seeder::Pipelines
end
end
def
create_running_pipeline_with_test_reports
(
ref
,
rspec_pattern
:,
ant_pattern
:)
raise
'Unknown result_pattern'
unless
%w[pass failed-1 failed-2 failed-3 corrupted]
.
include?
(
rspec_pattern
)
raise
'Unknown result_pattern'
unless
%w[pass failed-1 failed-2 failed-3]
.
include?
(
ant_pattern
)
last_commit
=
@project
.
repository
.
commit
(
ref
)
pipeline
=
create_pipeline!
(
@project
,
ref
,
last_commit
)
@project
.
merge_requests
.
find_by_source_branch
(
ref
).
update!
(
head_pipeline_id:
pipeline
.
id
)
if
ref
!=
'master'
(
0
...
3
).
each
do
|
index
|
Ci
::
Build
.
create!
(
name:
"rspec:pg
#{
index
}
3"
,
stage:
'test'
,
status: :running
,
project:
@project
,
pipeline:
pipeline
,
ref:
ref
).
tap
do
|
build
|
path
=
if
rspec_pattern
==
'corrupted'
Rails
.
root
+
"spec/fixtures/junit/junit_with_corrupted_data.xml.gz"
else
Rails
.
root
+
"spec/fixtures/junit/
#{
rspec_pattern
}
-rspec-
#{
index
}
-3.xml.gz"
end
artifacts_cache_file
(
path
)
do
|
file
|
build
.
job_artifacts
.
create!
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
end
end
Ci
::
Build
.
create!
(
name:
"java ant"
,
stage:
'test'
,
status: :running
,
project:
@project
,
pipeline:
pipeline
,
ref:
ref
).
tap
do
|
build
|
path
=
Rails
.
root
+
"spec/fixtures/junit/
#{
ant_pattern
}
-ant-test.xml.gz"
artifacts_cache_file
(
path
)
do
|
file
|
build
.
job_artifacts
.
create!
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
end
pipeline
.
update_duration
pipeline
.
update_status
end
def
finish_last_pipeline
(
ref
)
last_pipeline
=
@project
.
pipelines
.
where
(
ref:
ref
).
last
last_pipeline
.
builds
.
update_all
(
status: :success
)
last_pipeline
.
update_status
end
def
destroy_pipeline
(
ref
)
@project
.
pipelines
.
where
(
ref:
ref
).
destroy_all
end
private
def
pipelines
...
...
@@ -153,8 +106,8 @@ class Gitlab::Seeder::Pipelines
# (id required), that is why we need `#tap` method instead of passing
# block directly to `Ci::Build#create!`.
setup_artifacts
(
build
)
if
%w[build test]
.
include?
(
build
.
stage
)
setup_test_reports
(
build
)
if
%w[test]
.
include?
(
build
.
stage
)
setup_artifacts
(
build
)
setup_test_reports
(
build
)
setup_build_log
(
build
)
build
.
project
.
environments
.
...
...
@@ -165,6 +118,8 @@ class Gitlab::Seeder::Pipelines
end
def
setup_artifacts
(
build
)
return
unless
build
.
stage
==
"build"
artifacts_cache_file
(
artifacts_archive_path
)
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :archive
,
file_format: :zip
,
file:
file
)
end
...
...
@@ -175,27 +130,15 @@ class Gitlab::Seeder::Pipelines
end
def
setup_test_reports
(
build
)
return
unless
build
.
stage
==
"test"
&&
build
.
name
==
"rspec:osx"
if
build
.
ref
==
build
.
project
.
default_branch
if
build
.
name
.
include?
(
'rspec:linux'
)
artifacts_cache_file
(
artifacts_rspec_junit_master_path
(
build
.
name
))
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
elsif
build
.
name
.
include?
(
'java ant'
)
artifacts_cache_file
(
artifacts_ant_junit_master_path
)
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
artifacts_cache_file
(
test_reports_pass_path
)
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
else
if
build
.
name
.
include?
(
'rspec:linux'
)
artifacts_rspec_junit_feature_path
(
build
.
name
).
try
do
|
path
|
artifacts_cache_file
(
path
)
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
end
elsif
build
.
name
.
include?
(
'java ant'
)
artifacts_cache_file
(
artifacts_ant_junit_feature_path
)
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
artifacts_cache_file
(
test_reports_failed_path
)
do
|
file
|
build
.
job_artifacts
.
build
(
project:
build
.
project
,
file_type: :junit
,
file_format: :gzip
,
file:
file
)
end
end
end
...
...
@@ -239,22 +182,12 @@ class Gitlab::Seeder::Pipelines
Rails
.
root
+
'spec/fixtures/ci_build_artifacts_metadata.gz'
end
def
artifacts_rspec_junit_master_path
(
build_name
)
index
,
total
=
build_name
.
scan
(
/ (\d) (\d)/
).
first
Rails
.
root
+
"spec/fixtures/junit/junit_master_rspec_
#{
index
}
_
#{
total
}
.xml.gz"
end
def
artifacts_rspec_junit_feature_path
(
build_name
)
index
,
total
=
build_name
.
scan
(
/ (\d) (\d)/
).
first
Rails
.
root
+
"spec/fixtures/junit/junit_feature_rspec_
#{
index
}
_
#{
total
}
.xml.gz"
def
test_reports_pass_path
Rails
.
root
+
'spec/fixtures/junit/pass-rspec-0-3.xml.gz'
end
def
artifacts_ant_junit_master_path
Rails
.
root
+
"spec/fixtures/junit/junit_master_ant.xml.gz"
end
def
artifacts_ant_junit_feature_path
Rails
.
root
+
"spec/fixtures/junit/junit_feature_ant.xml.gz"
def
test_reports_failed_path
Rails
.
root
+
'spec/fixtures/junit/failed-1-rspec-0-3.xml.gz'
end
def
artifacts_cache_file
(
file_path
)
...
...
@@ -267,9 +200,9 @@ class Gitlab::Seeder::Pipelines
end
end
#
Gitlab::Seeder.quiet do
#
Project.all.sample(5).each do |project|
#
project_builds = Gitlab::Seeder::Pipelines.new(project)
#
project_builds.seed!
#
end
#
end
Gitlab
::
Seeder
.
quiet
do
Project
.
all
.
sample
(
5
).
each
do
|
project
|
project_builds
=
Gitlab
::
Seeder
::
Pipelines
.
new
(
project
)
project_builds
.
seed!
end
end
spec/fixtures/junit/junit_feature.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_feature_ant.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_feature_rspec_0_3.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_feature_rspec_1_3.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_feature_rspec_2_3.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_master.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_master_ant.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_master_rspec_0_3.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_master_rspec_1_3.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
spec/fixtures/junit/junit_master_rspec_2_3.xml.gz
已删除
100644 → 0
浏览文件 @
693a95f2
文件已删除
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录