Commit 796c0809 authored by Kamil Trzciński's avatar Kamil Trzciński Committed by Alejandro Rodríguez

Merge branch 'fix-failed-email-for-external-jobs' into 'master'

External jobs do not have show page nor traces

Fixes #24677

See merge request !7617
parent 8e9dd2fe
...@@ -135,15 +135,19 @@ class CommitStatus < ActiveRecord::Base ...@@ -135,15 +135,19 @@ class CommitStatus < ActiveRecord::Base
allow_failure? && (failed? || canceled?) allow_failure? && (failed? || canceled?)
end end
def duration
calculate_duration
end
def playable? def playable?
false false
end end
def duration def stuck?
calculate_duration false
end end
def stuck? def has_trace?
false false
end end
end end
%a{href: pipeline_build_url(pipeline, build), style: "color:#3777b0;text-decoration:none;"}
= build.name
Build #<%= build.id %> ( <%= pipeline_build_url(pipeline, build) %> )
...@@ -158,12 +158,14 @@ ...@@ -158,12 +158,14 @@
%td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;color:#8c8c8c;font-weight:500;font-size:15px;vertical-align:middle;"} %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;color:#8c8c8c;font-weight:500;font-size:15px;vertical-align:middle;"}
= build.stage = build.stage
%td{align: "right", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:20px 0;color:#8c8c8c;font-weight:500;font-size:15px;"} %td{align: "right", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:20px 0;color:#8c8c8c;font-weight:500;font-size:15px;"}
%a{href: pipeline_build_url(@pipeline, build), style: "color:#3777b0;text-decoration:none;"} = render "notify/links/#{build.to_partial_path}", pipeline: @pipeline, build: build
= build.name
%tr.build-log %tr.build-log
%td{colspan: "2", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:0 0 15px;"} - if build.has_trace?
%pre{style: "font-family:Monaco,'Lucida Console','Courier New',Courier,monospace;background-color:#fafafa;border-radius:3px;overflow:hidden;white-space:pre-wrap;word-break:break-all;font-size:13px;line-height:1.4;padding:12px;color:#333333;margin:0;"} %td{colspan: "2", style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:0 0 15px;"}
= build.trace_html(last_lines: 10).html_safe %pre{style: "font-family:Monaco,'Lucida Console','Courier New',Courier,monospace;background-color:#fafafa;border-radius:3px;overflow:hidden;white-space:pre-wrap;word-break:break-all;font-size:13px;line-height:1.4;padding:12px;color:#333333;margin:0;"}
= build.trace_html(last_lines: 10).html_safe
- else
%td{colspan: "2"}
%tr.footer %tr.footer
%td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;"} %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding:25px 0;font-size:13px;line-height:1.6;color:#5c5c5c;"}
%img{alt: "GitLab", height: "33", src: image_url('mailers/ci_pipeline_notif_v1/gitlab-logo-full-horizontal.gif'), style: "display:block;margin:0 auto 1em;", width: "90"}/ %img{alt: "GitLab", height: "33", src: image_url('mailers/ci_pipeline_notif_v1/gitlab-logo-full-horizontal.gif'), style: "display:block;margin:0 auto 1em;", width: "90"}/
......
...@@ -19,10 +19,12 @@ Commit Author: <%= commit.author_name %> ...@@ -19,10 +19,12 @@ Commit Author: <%= commit.author_name %>
Pipeline #<%= @pipeline.id %> ( <%= pipeline_url(@pipeline) %> ) had <%= failed.size %> failed <%= 'build'.pluralize(failed.size) %>. Pipeline #<%= @pipeline.id %> ( <%= pipeline_url(@pipeline) %> ) had <%= failed.size %> failed <%= 'build'.pluralize(failed.size) %>.
<% failed.each do |build| -%> <% failed.each do |build| -%>
Build #<%= build.id %> ( <%= pipeline_build_url(@pipeline, build) %> ) <%= render "notify/links/#{build.to_partial_path}", pipeline: @pipeline, build: build %>
Stage: <%= build.stage %> Stage: <%= build.stage %>
Name: <%= build.name %> Name: <%= build.name %>
<% if build.has_trace? -%>
Trace: <%= build.trace_with_state(last_lines: 10)[:text] %> Trace: <%= build.trace_with_state(last_lines: 10)[:text] %>
<% end -%>
<% end -%> <% end -%>
......
...@@ -571,6 +571,9 @@ describe Ci::Pipeline, models: true do ...@@ -571,6 +571,9 @@ describe Ci::Pipeline, models: true do
context 'with failed pipeline' do context 'with failed pipeline' do
before do before do
perform_enqueued_jobs do perform_enqueued_jobs do
create(:ci_build, :failed, pipeline: pipeline)
create(:generic_commit_status, :failed, pipeline: pipeline)
pipeline.drop pipeline.drop
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment