Add scheduled_actions as an explicit group of actions
This commit is contained in:
parent
384da9279e
commit
7fc74818a3
6 changed files with 7 additions and 1 deletions
|
@ -92,7 +92,8 @@ module Ci
|
|||
scope :with_artifacts_not_expired, ->() { with_artifacts_archive.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) }
|
||||
scope :with_expired_artifacts, ->() { with_artifacts_archive.where('artifacts_expire_at < ?', Time.now) }
|
||||
scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) }
|
||||
scope :manual_actions, ->() { where(when: %i[manual delayed], status: COMPLETED_STATUSES + %i[manual scheduled]) }
|
||||
scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + %i[manual]) }
|
||||
scope :scheduled_actions, ->() { where(when: :delayed, status: COMPLETED_STATUSES + %i[scheduled]) }
|
||||
scope :ref_protected, -> { where(protected: true) }
|
||||
scope :with_live_trace, -> { where('EXISTS (?)', Ci::BuildTraceChunk.where('ci_builds.id = ci_build_trace_chunks.build_id').select(1)) }
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ module Ci
|
|||
has_many :retryable_builds, -> { latest.failed_or_canceled.includes(:project) }, foreign_key: :commit_id, class_name: 'Ci::Build'
|
||||
has_many :cancelable_statuses, -> { cancelable }, foreign_key: :commit_id, class_name: 'CommitStatus'
|
||||
has_many :manual_actions, -> { latest.manual_actions.includes(:project) }, foreign_key: :commit_id, class_name: 'Ci::Build'
|
||||
has_many :scheduled_actions, -> { latest.scheduled_actions.includes(:project) }, foreign_key: :commit_id, class_name: 'Ci::Build'
|
||||
has_many :artifacts, -> { latest.with_artifacts_not_expired.includes(:project) }, foreign_key: :commit_id, class_name: 'Ci::Build'
|
||||
|
||||
has_many :auto_canceled_pipelines, class_name: 'Ci::Pipeline', foreign_key: 'auto_canceled_by_id'
|
||||
|
|
|
@ -12,6 +12,7 @@ class BuildActionEntity < Grape::Entity
|
|||
end
|
||||
|
||||
expose :playable?, as: :playable
|
||||
expose :scheduled_at
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class JobEntity < Grape::Entity
|
|||
end
|
||||
|
||||
expose :playable?, as: :playable
|
||||
expose :scheduled_at
|
||||
expose :created_at
|
||||
expose :updated_at
|
||||
expose :detailed_status, as: :status, with: DetailedStatusEntity
|
||||
|
|
|
@ -5,5 +5,6 @@ class PipelineDetailsEntity < PipelineEntity
|
|||
expose :ordered_stages, as: :stages, using: StageEntity
|
||||
expose :artifacts, using: BuildArtifactEntity
|
||||
expose :manual_actions, using: BuildActionEntity
|
||||
expose :scheduled_actions, using: BuildActionEntity
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,6 +13,7 @@ class PipelineSerializer < BaseSerializer
|
|||
:cancelable_statuses,
|
||||
:trigger_requests,
|
||||
:manual_actions,
|
||||
:scheduled_actions,
|
||||
:artifacts,
|
||||
{
|
||||
pending_builds: :project,
|
||||
|
|
Loading…
Reference in a new issue