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
Boxiang Sun
gitlab-ce
Commits
1bd2327c
Commit
1bd2327c
authored
Aug 31, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mock email templates
parent
0997cfd7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
11 deletions
+106
-11
app/mailers/emails/pipelines.rb
app/mailers/emails/pipelines.rb
+8
-9
app/models/ci/build.rb
app/models/ci/build.rb
+5
-2
app/models/service.rb
app/models/service.rb
+1
-0
app/views/notify/pipeline_failed_email.html.haml
app/views/notify/pipeline_failed_email.html.haml
+44
-0
app/views/notify/pipeline_failed_email.text.erb
app/views/notify/pipeline_failed_email.text.erb
+15
-0
app/views/notify/pipeline_succeeded_email.html.haml
app/views/notify/pipeline_succeeded_email.html.haml
+26
-0
app/views/notify/pipeline_succeeded_email.text.erb
app/views/notify/pipeline_succeeded_email.text.erb
+7
-0
No files found.
app/mailers/emails/pipelines.rb
View file @
1bd2327c
...
...
@@ -11,28 +11,27 @@ module Emails
private
def
pipeline_mail
(
params
,
to
,
status
)
@params
=
params
@project
=
params
.
project
@pipeline
=
params
.
pipeline
add_headers
mail
(
to:
to
,
subject:
pipeline_subject
(
status
))
end
def
add_headers
@project
=
@params
.
project
# `add_project_headers` needs this
add_project_headers
add_pipeline_headers
(
@params
.
pipeline
)
add_pipeline_headers
end
def
add_pipeline_headers
(
pipeline
)
headers
[
'X-GitLab-Pipeline-Id'
]
=
pipeline
.
id
headers
[
'X-GitLab-Pipeline-Ref'
]
=
pipeline
.
ref
headers
[
'X-GitLab-Pipeline-Status'
]
=
pipeline
.
status
def
add_pipeline_headers
headers
[
'X-GitLab-Pipeline-Id'
]
=
@
pipeline
.
id
headers
[
'X-GitLab-Pipeline-Ref'
]
=
@
pipeline
.
ref
headers
[
'X-GitLab-Pipeline-Status'
]
=
@
pipeline
.
status
end
def
pipeline_subject
(
status
)
subject
(
"Pipeline
#{
status
}
for
#{
@params
.
project
.
name
}
"
,
@params
.
pipeline
.
short_sha
)
"Pipeline
#{
status
}
for
#{
@project
.
name
}
"
,
@pipeline
.
short_sha
)
end
end
end
app/models/ci/build.rb
View file @
1bd2327c
...
...
@@ -133,8 +133,11 @@ module Ci
end
def
trace_with_state
(
state
=
nil
)
trace_with_state
=
Ci
::
Ansi2html
::
convert
(
trace
,
state
)
if
trace
.
present?
trace_with_state
||
{}
if
trace
.
present?
Ci
::
Ansi2html
.
convert
(
trace
,
state
)
else
{}
end
end
def
timeout
...
...
app/models/service.rb
View file @
1bd2327c
...
...
@@ -198,6 +198,7 @@ class Service < ActiveRecord::Base
bamboo
buildkite
builds_email
pipelines_email
bugzilla
campfire
custom_issue_tracker
...
...
app/views/notify/pipeline_failed_email.html.haml
0 → 100644
View file @
1bd2327c
.p
Project:
=
@project
.
path_with_namespace
.p
Branch:
=
@pipeline
.
ref
.p
Commit:
=
@pipeline
.
short_sha
(
=
@pipeline
.
sha
)
.p
Commit Message:
=
@pipeline
.
git_commit_message
.p
Commit Author:
=
@pipeline
.
git_author_name
.p
Pusher:
=
@pipeline
.
user
.
try
(
:name
)
-
failed
=
@pipeline
.
statuses
.
latest
.
failed
.p
Pipeline
#
=
@pipeline
.
id
had
=
failed
.
size
failed
=
'job'
.
plural
(
failed
.
size
)
.
-
failed
.
each
do
|
job
|
.p
ID:
=
job
.
id
.p
Stage:
=
job
.
stage
.p
Name:
=
job
.
name
.p
Trace:
=
job
.
trace_with_state
[
:html
].
html_safe
app/views/notify/pipeline_failed_email.text.erb
0 → 100644
View file @
1bd2327c
Project:
<%=
@project
.
path_with_namespace
%>
Branch:
<%=
@pipeline
.
ref
%>
Commit:
<%=
@pipeline
.
short_sha
%>
(
<%=
@pipeline
.
sha
%>
)
Commit Message:
<%=
@pipeline
.
git_commit_message
%>
Commit Author:
<%=
@pipeline
.
git_author_name
%>
Pusher:
<%=
@pipeline
.
user
.
try
(
:name
)
%>
<%
failed
=
@pipeline
.
statuses
.
latest
.
failed
%>
Pipeline #
<%=
@pipeline
.
id
%>
had
<%=
failed
.
size
%>
failed
<%=
'job'
.
plural
(
failed
.
size
)
%>
.
<%
failed
.
each
do
|
job
|
%>
ID:
<%=
job
.
id
%>
Stage:
<%=
job
.
stage
%>
Name:
<%=
job
.
name
%>
Trace:
<%=
job
.
trace_with_state
[
:html
]
%>
<%
end
%>
app/views/notify/pipeline_succeeded_email.html.haml
0 → 100644
View file @
1bd2327c
.p
Project:
=
@project
.
path_with_namespace
.p
Branch:
=
@pipeline
.
ref
.p
Commit:
=
@pipeline
.
short_sha
(
=
@pipeline
.
sha
)
.p
Commit Message:
=
@pipeline
.
git_commit_message
.p
Commit Author:
=
@pipeline
.
git_author_name
.p
Pusher:
=
@pipeline
.
user
.
try
(
:name
)
-
failed
=
@pipeline
.
statuses
.
latest
.
failed
.p
Pipeline
#
=
@pipeline
.
id
had succeeded.
app/views/notify/pipeline_succeeded_email.text.erb
0 → 100644
View file @
1bd2327c
Project:
<%=
@project
.
path_with_namespace
%>
Branch:
<%=
@pipeline
.
ref
%>
Commit:
<%=
@pipeline
.
short_sha
%>
(
<%=
@pipeline
.
sha
%>
)
Commit Message:
<%=
@pipeline
.
git_commit_message
%>
Commit Author:
<%=
@pipeline
.
git_author_name
%>
Pusher:
<%=
@pipeline
.
user
.
try
(
:name
)
%>
Pipeline #
<%=
@pipeline
.
id
%>
had succeeded.
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