Class: Shipit::FetchDeployedRevisionJob

Inherits:
BackgroundJob
  • Object
show all
Defined in:
app/jobs/shipit/fetch_deployed_revision_job.rb

Constant Summary

Constants inherited from BackgroundJob

BackgroundJob::DEFAULT_RETRY_TIME_IN_SECONDS

Instance Method Summary collapse

Instance Method Details

#perform(stack) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/jobs/shipit/fetch_deployed_revision_job.rb', line 7

def perform(stack)
  return if stack.active_task?
  return if stack.inaccessible?

  commands = StackCommands.new(stack)

  begin
    sha = commands.fetch_deployed_revision
  rescue DeploySpec::Error
  end

  return if sha.blank?

  begin
    stack.update_deployed_revision(sha)
  rescue ActiveRecord::RecordNotFound
  end
end