Commit 049a8657 authored by Kev's avatar Kev

Expose finished_at in job details JSON

This fixes a bug where the time a job has been running (including when
it is complete), the running time, is always labelled **Elapsed time**
in the job sidebar. This, however, is not intended following the
change of https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75811,
and the running time should be labelled **Elapsed time** only when the
job is running and default to the **Duration** text.

The bug is fixed by adding `finished_at` to the `BuildDetailsEntity`
because it was missing there.

Changelog: fixed
parent 641dfe75
# frozen_string_literal: true # frozen_string_literal: true
class BuildDetailsEntity < Ci::JobEntity class BuildDetailsEntity < Ci::JobEntity
expose :coverage, :erased_at, :duration expose :coverage, :erased_at, :finished_at, :duration
expose :tag_list, as: :tags expose :tag_list, as: :tags
expose :has_trace?, as: :has_trace expose :has_trace?, as: :has_trace
expose :stage expose :stage
......
...@@ -29,7 +29,7 @@ RSpec.describe BuildDetailsEntity do ...@@ -29,7 +29,7 @@ RSpec.describe BuildDetailsEntity do
end end
it 'contains the needed key value pairs' do it 'contains the needed key value pairs' do
expect(subject).to include(:coverage, :erased_at, :duration) expect(subject).to include(:coverage, :erased_at, :finished_at, :duration)
expect(subject).to include(:runner, :pipeline) expect(subject).to include(:runner, :pipeline)
expect(subject).to include(:raw_path, :new_issue_path) expect(subject).to include(:raw_path, :new_issue_path)
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