Class: Shipit::ContinuousDeliveryJob

Inherits:
BackgroundJob
  • Object
show all
Includes:
BackgroundJob::Unique
Defined in:
app/jobs/shipit/continuous_delivery_job.rb

Constant Summary

Constants included from BackgroundJob::Unique

BackgroundJob::Unique::ConcurrentJobError, BackgroundJob::Unique::DEFAULT_TIMEOUT

Constants inherited from BackgroundJob

BackgroundJob::DEFAULT_RETRY_TIME_IN_SECONDS

Instance Method Summary collapse

Methods included from BackgroundJob::Unique

#acquire_lock, #lock_key

Instance Method Details

#perform(stack) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/jobs/shipit/continuous_delivery_job.rb', line 10

def perform(stack)
  return unless stack.continuous_deployment?

  # If there is a schedule defined for this stack, make sure we are within a
  # deployment window before proceeding.
  return if stack.continuous_delivery_schedule && !stack.continuous_delivery_schedule.can_deploy?

  # checks if there are any tasks running, including concurrent tasks
  return if stack.occupied?

  stack.trigger_continuous_delivery
end