Fix Error 500 in CI charts by gracefully handling commits with no durations
Closes #17730
This commit is contained in:
parent
53ad33e4ba
commit
9bb0d0b407
3 changed files with 10 additions and 1 deletions
|
@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
|
|||
|
||||
v 8.8.2 (unreleased)
|
||||
- Fix Error 500 when accessing application settings due to nil disabled OAuth sign-in sources
|
||||
- Fix Error 500 in CI charts by gracefully handling commits with no durations
|
||||
|
||||
v 8.8.1
|
||||
- Add documentation for the "Health Check" feature
|
||||
|
|
|
@ -64,7 +64,8 @@ module Ci
|
|||
|
||||
commits.each do |commit|
|
||||
@labels << commit.short_sha
|
||||
@build_times << (commit.duration / 60)
|
||||
duration = commit.duration || 0
|
||||
@build_times << (duration / 60)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,5 +12,12 @@ describe Ci::Charts, lib: true do
|
|||
chart = Ci::Charts::BuildTime.new(@commit.project)
|
||||
expect(chart.build_times).to eq([2])
|
||||
end
|
||||
|
||||
it 'should handle nil build times' do
|
||||
create(:ci_commit, duration: nil, project: @commit.project)
|
||||
|
||||
chart = Ci::Charts::BuildTime.new(@commit.project)
|
||||
expect(chart.build_times).to eq([2, 0])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue