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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
31a5da40
Commit
31a5da40
authored
Feb 13, 2020
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wrong MR link in pipeline failure email
This MR fixes the pipeline failure email bug
parent
ce2fdf32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
app/mailers/emails/pipelines.rb
app/mailers/emails/pipelines.rb
+7
-1
changelogs/unreleased/fix-wrong-mr-id-in-pipeline-failure-email.yml
.../unreleased/fix-wrong-mr-id-in-pipeline-failure-email.yml
+5
-0
spec/mailers/emails/pipelines_spec.rb
spec/mailers/emails/pipelines_spec.rb
+41
-1
No files found.
app/mailers/emails/pipelines.rb
View file @
31a5da40
...
...
@@ -15,7 +15,13 @@ module Emails
def
pipeline_mail
(
pipeline
,
recipients
,
status
)
@project
=
pipeline
.
project
@pipeline
=
pipeline
@merge_request
=
pipeline
.
all_merge_requests
.
first
@merge_request
=
if
pipeline
.
merge_request?
pipeline
.
merge_request
else
pipeline
.
merge_requests_as_head_pipeline
.
first
end
add_headers
# We use bcc here because we don't want to generate these emails for a
...
...
changelogs/unreleased/fix-wrong-mr-id-in-pipeline-failure-email.yml
0 → 100644
View file @
31a5da40
---
title
:
Fix wrong MR link is shown on pipeline failure email
merge_request
:
author
:
type
:
fixed
spec/mailers/emails/pipelines_spec.rb
View file @
31a5da40
...
...
@@ -19,6 +19,25 @@ describe Emails::Pipelines do
expect
(
subject
).
to
have_body_text
status_text
end
context
'when pipeline on master branch has a merge request'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
ref:
'master'
,
sha:
sha
,
project:
project
)
}
let!
(
:merge_request
)
do
create
(
:merge_request
,
source_branch:
'master'
,
target_branch:
'feature'
,
source_project:
project
,
target_project:
project
)
end
it
'has correct information that there is no merge request link'
do
expect
(
subject
)
.
to
have_subject
"
#{
project
.
name
}
| Pipeline #
#{
pipeline
.
id
}
has "
\
"
#{
status
}
for
#{
pipeline
.
source_ref
}
| "
\
"
#{
pipeline
.
short_sha
}
"
.
to_s
expect
(
subject
).
to
have_body_text
pipeline
.
source_ref
expect
(
subject
).
to
have_body_text
status_text
end
end
context
'when pipeline for merge requests'
do
let
(
:pipeline
)
{
merge_request
.
all_pipelines
.
first
}
...
...
@@ -28,7 +47,7 @@ describe Emails::Pipelines do
target_project:
project
)
end
it
'has
a correct information with
merge request link'
do
it
'has
correct information that there is a
merge request link'
do
expect
(
subject
)
.
to
have_subject
"
#{
project
.
name
}
| Pipeline #
#{
pipeline
.
id
}
has "
\
"
#{
status
}
for
#{
pipeline
.
source_ref
}
| "
\
...
...
@@ -39,6 +58,27 @@ describe Emails::Pipelines do
expect
(
subject
).
not_to
have_body_text
pipeline
.
ref
end
end
context
'when branch pipeline is set to a merge request as a head pipeline'
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
ref:
ref
,
sha:
sha
,
merge_requests_as_head_pipeline:
[
merge_request
])
end
let
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
end
it
'has correct information that there is a merge request link'
do
expect
(
subject
)
.
to
have_subject
"
#{
project
.
name
}
| Pipeline #
#{
pipeline
.
id
}
has "
\
"
#{
status
}
for
#{
pipeline
.
source_ref
}
| "
\
"
#{
pipeline
.
short_sha
}
in !
#{
merge_request
.
iid
}
"
.
to_s
expect
(
subject
).
to
have_body_text
merge_request
.
to_reference
expect
(
subject
).
to
have_body_text
pipeline
.
source_ref
end
end
end
describe
'#pipeline_success_email'
do
...
...
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