2020-10-24 23:57:45 +05:30
|
|
|
# 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-06-08 01:23:25 +05:30
|
|
|
expose :duration,
|
|
|
|
documentation: { type: 'Floating', desc: 'Time spent running' }
|
|
|
|
expose :queued_duration,
|
|
|
|
documentation: { type: 'Floating', desc: 'Time spent enqueued' }
|
2020-10-24 23:57:45 +05:30
|
|
|
expose :user, with: ::API::Entities::User
|
|
|
|
expose :commit, with: ::API::Entities::Commit
|
|
|
|
expose :pipeline, with: ::API::Entities::Ci::PipelineBasic
|
2022-01-26 12:08:38 +05:30
|
|
|
expose :failure_reason, if: -> (job) { job.failed? }
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
expose :web_url do |job, _options|
|
|
|
|
Gitlab::Routing.url_helpers.project_job_url(job.project, job)
|
|
|
|
end
|
2022-10-11 01:57:18 +05:30
|
|
|
|
|
|
|
expose :project do
|
|
|
|
expose :ci_job_token_scope_enabled do |job|
|
2022-11-25 23:54:43 +05:30
|
|
|
job.project.ci_outbound_job_token_scope_enabled?
|
2022-10-11 01:57:18 +05:30
|
|
|
end
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|