Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
7edbc0f8
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,发现更多精彩内容 >>
提交
7edbc0f8
编写于
12月 18, 2017
作者:
C
Christiaan Van den Poel
提交者:
Grzegorz Bizon
12月 18, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix job count in pipeline success mail
上级
cfb8d001
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
28 addition
and
7 deletion
+28
-7
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+4
-0
app/views/notify/pipeline_success_email.html.haml
app/views/notify/pipeline_success_email.html.haml
+1
-1
app/views/notify/pipeline_success_email.text.erb
app/views/notify/pipeline_success_email.text.erb
+2
-2
app/views/projects/pipelines/_info.html.haml
app/views/projects/pipelines/_info.html.haml
+1
-1
app/views/projects/pipelines/_with_tabs.html.haml
app/views/projects/pipelines/_with_tabs.html.haml
+1
-1
changelogs/unreleased/fix_build_count_in_pipeline_success_maild.yml
.../unreleased/fix_build_count_in_pipeline_success_maild.yml
+5
-0
spec/features/projects/pipelines/pipeline_spec.rb
spec/features/projects/pipelines/pipeline_spec.rb
+2
-2
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+12
-0
未找到文件。
app/models/ci/pipeline.rb
浏览文件 @
7edbc0f8
...
...
@@ -228,6 +228,10 @@ module Ci
statuses
.
select
(
:stage
).
distinct
.
count
end
def
total_size
statuses
.
count
(
:id
)
end
def
stages_names
statuses
.
order
(
:stage_idx
).
distinct
.
pluck
(
:stage
,
:stage_idx
).
map
(
&
:first
)
...
...
app/views/notify/pipeline_success_email.html.haml
浏览文件 @
7edbc0f8
...
...
@@ -109,7 +109,7 @@
API
%tr
%td
{
colspan:
2
,
style:
"font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;color:#333333;font-size:15px;font-weight:300;line-height:1.4;padding:15px 5px;text-align:center;"
}
-
job_count
=
@pipeline
.
statuses
.
latest
.
size
-
job_count
=
@pipeline
.
total_
size
-
stage_count
=
@pipeline
.
stages_count
successfully completed
#{
job_count
}
#{
'job'
.
pluralize
(
job_count
)
}
...
...
app/views/notify/pipeline_success_email.text.erb
浏览文件 @
7edbc0f8
...
...
@@ -22,11 +22,11 @@ Committed by: <%= commit.committer_name %>
<%
end
-%>
<%
end
-%>
<%
build_count
=
@pipeline
.
statuses
.
latest
.
size
-%>
<%
job_count
=
@pipeline
.
total_
size
-%>
<%
stage_count
=
@pipeline
.
stages_count
-%>
<%
if
@pipeline
.
user
-%>
Pipeline #
<%=
@pipeline
.
id
%>
(
<%=
pipeline_url
(
@pipeline
)
%>
) triggered by
<%=
@pipeline
.
user
.
name
%>
(
<%=
user_url
(
@pipeline
.
user
)
%>
)
<%
else
-%>
Pipeline #
<%=
@pipeline
.
id
%>
(
<%=
pipeline_url
(
@pipeline
)
%>
) triggered by API
<%
end
-%>
successfully completed
<%=
build_count
%>
<%=
'build'
.
pluralize
(
build
_count
)
%>
in
<%=
stage_count
%>
<%=
'stage'
.
pluralize
(
stage_count
)
%>
.
successfully completed
<%=
job_count
%>
<%=
'job'
.
pluralize
(
job
_count
)
%>
in
<%=
stage_count
%>
<%=
'stage'
.
pluralize
(
stage_count
)
%>
.
app/views/projects/pipelines/_info.html.haml
浏览文件 @
7edbc0f8
...
...
@@ -13,7 +13,7 @@
.well-segment.pipeline-info
.icon-container
=
icon
(
'clock-o'
)
=
pluralize
@pipeline
.
statuses
.
count
(
:id
)
,
"job"
=
pluralize
@pipeline
.
total_size
,
"job"
-
if
@pipeline
.
ref
from
=
link_to
@pipeline
.
ref
,
project_ref_path
(
@project
,
@pipeline
.
ref
),
class:
"ref-name"
...
...
app/views/projects/pipelines/_with_tabs.html.haml
浏览文件 @
7edbc0f8
...
...
@@ -8,7 +8,7 @@
%li
.js-builds-tab-link
=
link_to
builds_project_pipeline_path
(
@project
,
@pipeline
),
data:
{
target:
'div#js-tab-builds'
,
action:
'builds'
,
toggle:
'tab'
},
class:
'builds-tab'
do
Jobs
%span
.badge.js-builds-counter
=
pipeline
.
statuses
.
count
%span
.badge.js-builds-counter
=
pipeline
.
total_size
-
if
failed_builds
.
present?
%li
.js-failures-tab-link
=
link_to
failures_project_pipeline_path
(
@project
,
@pipeline
),
data:
{
target:
'div#js-tab-failures'
,
action:
'failures'
,
toggle:
'tab'
},
class:
'failures-tab'
do
...
...
changelogs/unreleased/fix_build_count_in_pipeline_success_maild.yml
0 → 100644
浏览文件 @
7edbc0f8
---
title
:
fix build count in pipeline success mail
merge_request
:
15827
author
:
Christiaan Van den Poel
type
:
fixed
spec/features/projects/pipelines/pipeline_spec.rb
浏览文件 @
7edbc0f8
...
...
@@ -152,7 +152,7 @@ describe 'Pipeline', :js do
end
it
'shows counter in Jobs tab'
do
expect
(
page
.
find
(
'.js-builds-counter'
).
text
).
to
eq
(
pipeline
.
statuses
.
count
.
to_s
)
expect
(
page
.
find
(
'.js-builds-counter'
).
text
).
to
eq
(
pipeline
.
total_size
.
to_s
)
end
it
'shows Pipeline tab as active'
do
...
...
@@ -248,7 +248,7 @@ describe 'Pipeline', :js do
end
it
'shows counter in Jobs tab'
do
expect
(
page
.
find
(
'.js-builds-counter'
).
text
).
to
eq
(
pipeline
.
statuses
.
count
.
to_s
)
expect
(
page
.
find
(
'.js-builds-counter'
).
text
).
to
eq
(
pipeline
.
total_size
.
to_s
)
end
it
'shows Jobs tab as active'
do
...
...
spec/models/ci/pipeline_spec.rb
浏览文件 @
7edbc0f8
...
...
@@ -1530,4 +1530,16 @@ describe Ci::Pipeline, :mailer do
expect
(
query_count
).
to
eq
(
1
)
end
end
describe
'#total_size'
do
let!
(
:build_job1
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_idx:
0
)
}
let!
(
:build_job2
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_idx:
0
)
}
let!
(
:test_job_failed_and_retried
)
{
create
(
:ci_build
,
:failed
,
:retried
,
pipeline:
pipeline
,
stage_idx:
1
)
}
let!
(
:second_test_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_idx:
1
)
}
let!
(
:deploy_job
)
{
create
(
:ci_build
,
pipeline:
pipeline
,
stage_idx:
2
)
}
it
'returns all jobs (including failed and retried)'
do
expect
(
pipeline
.
total_size
).
to
eq
(
5
)
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录