Class: Conan::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/conan/deploy.rb

Class Method Summary collapse

Class Method Details

.run(options, pl, env) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/conan/deploy.rb', line 6

def self.run(options, pl, env)
  puts "> Pipeline: #{pl}"
  puts "> Environment: #{env}"

  manifest = ManifestBuilder.build(options, pl, env) {
    m = File.join(options[:directory], 'environments.rb')
    puts "> Manifest: #{m}"
    instance_eval(File.read(m), m)
  }

  case options[:action]
  when :provision
    manifest.provision
  when :configure
    manifest.configure
  when :deploy
    manifest.deploy
  when :bg_configure
    manifest.bg_configure
  when :bg_deploy
    manifest.bg_deploy
  when :bg_switch
    manifest.bg_switch
  when :bg_clean
    manifest.bg_clean
  when :all
    manifest.provision
    manifest.configure
    manifest.deploy
  when :bg_all
    manifest.provision
    manifest.bg_configure
    manifest.bg_deploy
    if(manifest.is_inactive_node_healthy?)
      manifest.bg_switch
      manifest.bg_clean
    else
      raise RuntimeError.new "Blue node is not healthy. Skipping switch and cleaning to facilitate troubleshooting."
    end

  else
    raise ArgumentError.new "Invalid action: #{options[:action]}"
  end
end