Welcome to mirror list, hosted at ThFree Co, Russian Federation.

job_basic.rb « ci « entities « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3d9318ec428cbd8599186ecea5f29a852dc2e89b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
        expose :duration,
               documentation: { type: 'Floating', desc: 'Time spent running' }
        expose :queued_duration,
               documentation: { type: 'Floating', desc: 'Time spent enqueued' }
        expose :user, with: ::API::Entities::User
        expose :commit, with: ::API::Entities::Commit
        expose :pipeline, with: ::API::Entities::Ci::PipelineBasic
        expose :failure_reason, if: -> (job) { job.failed? }

        expose :web_url do |job, _options|
          Gitlab::Routing.url_helpers.project_job_url(job.project, job)
        end

        expose :project do
          expose :ci_job_token_scope_enabled do |job|
            job.project.ci_job_token_scope_enabled?
          end
        end
      end
    end
  end
end