diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-13 21:09:38 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-13 21:09:38 +0000 |
commit | 602ea42669779ec431bcaeb41fd95e079b1a7021 (patch) | |
tree | 25e074ca0914fca832b826e200aa0612e45564ec /app | |
parent | 6ce0f44c6b2c2af48c7ef4fef97913d054088deb (diff) | |
download | gitlab-ce-602ea42669779ec431bcaeb41fd95e079b1a7021.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project_services/chat_message/pipeline_message.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/models/project_services/chat_message/pipeline_message.rb b/app/models/project_services/chat_message/pipeline_message.rb index 52a26f6211a..50b982a803f 100644 --- a/app/models/project_services/chat_message/pipeline_message.rb +++ b/app/models/project_services/chat_message/pipeline_message.rb @@ -34,7 +34,9 @@ module ChatMessage @duration = pipeline_attributes[:duration].to_i @finished_at = pipeline_attributes[:finished_at] ? Time.parse(pipeline_attributes[:finished_at]).to_i : nil @pipeline_id = pipeline_attributes[:id] - @failed_jobs = Array(data[:builds]).select { |b| b[:status] == 'failed' }.reverse # Show failed jobs from oldest to newest + + # Get list of jobs that have actually failed (after exhausting all retries) + @failed_jobs = actually_failed_jobs(Array(data[:builds])) @failed_stages = @failed_jobs.map { |j| j[:stage] }.uniq @project = Project.find(data[:project][:id]) @@ -90,6 +92,17 @@ module ChatMessage private + def actually_failed_jobs(builds) + succeeded_job_names = builds.map { |b| b[:name] if b[:status] == 'success' }.compact.uniq + + failed_jobs = builds.select do |build| + # Select jobs which doesn't have a successful retry + build[:status] == 'failed' && !succeeded_job_names.include?(build[:name]) + end + + failed_jobs.uniq { |job| job[:name] }.reverse + end + def fancy_notifications? Feature.enabled?(:fancy_pipeline_slack_notifications, default_enabled: true) end |