Class: ChatopsDeployer::DestroyJob

Inherits:
Object
  • Object
show all
Includes:
SuckerPunch::Job
Defined in:
lib/chatops_deployer/destroy_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(repository:, branch:, callback_url:) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chatops_deployer/destroy_job.rb', line 9

def perform(repository:, branch:, callback_url:)
  git_basename = repository.split('/').last
  project = File.basename(git_basename,File.extname(git_basename))
  @branch = branch
  @deployment_alias = "#{project}-#{branch}"
  project_dir = "#{WORKSPACE}/#{project}/#{branch}"
  puts "Removing #{project_dir}"
  FileUtils.rm_rf project_dir

  #TODO: No error conditions are handled in the following methods.
  if remove_nginx_config && dockerdown
    callback(callback_url, :destroy_success)
  else
    callback(callback_url, :destroy_failure)
  end
end