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
7edbc0f8
Commit
7edbc0f8
authored
Dec 18, 2017
by
Christiaan Van den Poel
Committed by
Grzegorz Bizon
Dec 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix job count in pipeline success mail
parent
cfb8d001
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
7 deletions
+28
-7
pipeline.rb
app/models/ci/pipeline.rb
+4
-0
pipeline_success_email.html.haml
app/views/notify/pipeline_success_email.html.haml
+1
-1
pipeline_success_email.text.erb
app/views/notify/pipeline_success_email.text.erb
+2
-2
_info.html.haml
app/views/projects/pipelines/_info.html.haml
+1
-1
_with_tabs.html.haml
app/views/projects/pipelines/_with_tabs.html.haml
+1
-1
fix_build_count_in_pipeline_success_maild.yml
.../unreleased/fix_build_count_in_pipeline_success_maild.yml
+5
-0
pipeline_spec.rb
spec/features/projects/pipelines/pipeline_spec.rb
+2
-2
pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+12
-0
No files found.
app/models/ci/pipeline.rb
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
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