2018-07-19 18:43:13 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-01-26 00:08:57 +00:00
|
|
|
class PipelineDetailsEntity < Ci::PipelineEntity
|
2020-01-13 12:08:04 +00:00
|
|
|
expose :project, using: ProjectEntity
|
|
|
|
|
2019-05-06 08:08:42 +00:00
|
|
|
expose :flags do
|
|
|
|
expose :latest?, as: :latest
|
|
|
|
end
|
|
|
|
|
2017-05-26 08:31:42 +00:00
|
|
|
expose :details do
|
2021-04-28 18:10:12 +00:00
|
|
|
expose :has_downloadable_artifacts?, as: :has_downloadable_artifacts
|
|
|
|
expose :artifacts, unless: proc { options[:disable_artifacts] } do |pipeline, options|
|
2020-06-04 12:08:21 +00:00
|
|
|
rel = pipeline.downloadable_artifacts
|
2020-02-18 06:09:06 +00:00
|
|
|
|
2020-12-21 00:10:18 +00:00
|
|
|
if Feature.enabled?(:non_public_artifacts, type: :development)
|
|
|
|
rel = rel.select { |artifact| can?(request.current_user, :read_job_artifacts, artifact.job) }
|
|
|
|
end
|
|
|
|
|
2021-04-06 09:09:03 +00:00
|
|
|
BuildArtifactEntity.represent(rel, options.merge(project: pipeline.project))
|
2020-02-18 06:09:06 +00:00
|
|
|
end
|
2017-05-26 08:31:42 +00:00
|
|
|
expose :manual_actions, using: BuildActionEntity
|
2018-10-01 06:27:34 +00:00
|
|
|
expose :scheduled_actions, using: BuildActionEntity
|
2017-05-26 08:31:42 +00:00
|
|
|
end
|
2019-09-13 13:26:31 +00:00
|
|
|
|
2019-10-16 09:07:51 +00:00
|
|
|
expose :triggered_by_pipeline, as: :triggered_by, with: TriggeredPipelineEntity
|
|
|
|
expose :triggered_pipelines, as: :triggered, using: TriggeredPipelineEntity
|
|
|
|
end
|