2020-08-13 14:10:36 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
module Ci
|
|
|
|
class JobBasic < Grape::Entity
|
|
|
|
expose :id, :status, :stage, :name, :ref, :tag, :coverage, :allow_failure
|
|
|
|
expose :created_at, :started_at, :finished_at
|
2021-04-26 14:09:45 -04:00
|
|
|
expose :duration,
|
|
|
|
documentation: { type: 'Floating', desc: 'Time spent running' }
|
|
|
|
expose :queued_duration,
|
|
|
|
documentation: { type: 'Floating', desc: 'Time spent enqueued' }
|
2020-08-13 14:10:36 -04:00
|
|
|
expose :user, with: ::API::Entities::User
|
|
|
|
expose :commit, with: ::API::Entities::Commit
|
|
|
|
expose :pipeline, with: ::API::Entities::Ci::PipelineBasic
|
2021-12-01 19:17:32 -05:00
|
|
|
expose :failure_reason, if: -> (job) { job.failed? }
|
2020-08-13 14:10:36 -04:00
|
|
|
|
|
|
|
expose :web_url do |job, _options|
|
|
|
|
Gitlab::Routing.url_helpers.project_job_url(job.project, job)
|
|
|
|
end
|
2022-08-30 08:12:25 -04:00
|
|
|
|
|
|
|
expose :project do
|
|
|
|
expose :ci_job_token_scope_enabled do |job|
|
|
|
|
job.project.ci_job_token_scope_enabled?
|
|
|
|
end
|
|
|
|
end
|
2020-08-13 14:10:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|