Class: Manifest
- Inherits:
-
Object
- Object
- Manifest
- Defined in:
- lib/conan/manifest.rb
Instance Method Summary collapse
- #appVersion(pipeline_id, app_id) ⇒ Object
- #bg_deploy ⇒ Object
- #configure ⇒ Object
- #deploy ⇒ Object
- #environment(env_id, &block) ⇒ Object
-
#initialize(options, artifact_repo, output) ⇒ Manifest
constructor
A new instance of Manifest.
- #paas ⇒ Object
- #pipeline(pipeline_id, &block) ⇒ Object
- #provision ⇒ Object
-
#select(pipeline_id, env_id) ⇒ Object
select a pipeline and environment to do operations on.
- #validateThatEnvironmentIsSelected ⇒ Object
Constructor Details
#initialize(options, artifact_repo, output) ⇒ Manifest
Returns a new instance of Manifest.
3 4 5 6 7 8 9 |
# File 'lib/conan/manifest.rb', line 3 def initialize(, artifact_repo, output) @pipelines = {} @environments = {} @options = @artifact_repo = artifact_repo @output = output end |
Instance Method Details
#appVersion(pipeline_id, app_id) ⇒ Object
36 37 38 |
# File 'lib/conan/manifest.rb', line 36 def appVersion(pipeline_id, app_id) @pipelines[pipeline_id].appVersion(app_id) end |
#bg_deploy ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/conan/manifest.rb', line 83 def bg_deploy validateThatEnvironmentIsSelected puts "Blue/green deploy #{@current_environment.id} for #{@current_pipeline.id} pipeline" force = @options[:'force-deploy'] || false @current_pipeline.bg_deploy(@current_environment, paas, force) end |
#configure ⇒ Object
47 48 49 50 51 |
# File 'lib/conan/manifest.rb', line 47 def configure validateThatEnvironmentIsSelected puts "Configure #{@current_environment.id} manifest files for #{@current_pipeline.id} pipeline" @current_pipeline.configure(@current_environment) end |
#deploy ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/conan/manifest.rb', line 65 def deploy validateThatEnvironmentIsSelected puts "Deploy #{@current_environment.id} for #{@current_pipeline.id} pipeline" nr_api_key = @options[:'new-relic-api-key'] || ENV['NEWRELIC_API_KEY'] force = @options[:'force-deploy'] || false @current_pipeline.deploy(@current_environment, paas, force) { |app_name| if (nr_api_key) puts 'Reporting Deployment to New Relic' job = @options[:'job-url'] || 'nexus-app-manifest' NewRelic.alertDeployment(nr_api_key, app_name, "Deployed by #{job}") else puts "WARNING: Skipping New Relic alert. No API defined" end } end |
#environment(env_id, &block) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/conan/manifest.rb', line 29 def environment(env_id, &block) e = Environment.new(env_id) e.instance_eval(&block) @environments[env_id] = e e end |
#paas ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/conan/manifest.rb', line 53 def paas paas_user = @options[:'paas-user'] || ENV['PAAS_USER'] paas_pwd = @options[:'paas-password'] || ENV['PAAS_PASSWORD'] paas_space = @options[:'paas-space'] || ENV['PAAS_SPACE'] paas_manifest = @options[:'paas-manifest'] || ENV['PAAS_MANIFEST'] paas_executable = @options[:'paas-executable'] || ENV['PAAS_EXECUTABLE'] no_start = @options[:'no-start'] || false dry_run = @options[:'dry-run'] || false Stackato.new(paas_user, paas_pwd, paas_space, paas_manifest, paas_executable, no_start, dry_run) end |
#pipeline(pipeline_id, &block) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/conan/manifest.rb', line 22 def pipeline(pipeline_id, &block) pl = Pipeline.new(pipeline_id, @artifact_repo, @output, @options) pl.instance_eval(&block) @pipelines[pipeline_id] = pl pl end |
#provision ⇒ Object
40 41 42 43 44 45 |
# File 'lib/conan/manifest.rb', line 40 def provision validateThatEnvironmentIsSelected # TODO banners puts "Update #{@current_environment.id} manifest files for #{@current_pipeline.id} pipeline" @current_pipeline.update(@current_environment, @environments[@current_environment.upstream_env]) end |
#select(pipeline_id, env_id) ⇒ Object
select a pipeline and environment to do operations on
12 13 14 15 16 17 18 19 20 |
# File 'lib/conan/manifest.rb', line 12 def select(pipeline_id, env_id) env = @environments[env_id] raise ArgumentError.new "Invalid environment id: '#{env_id}'. Valid options are #{@environments.keys.join(", ")}" if env.nil? @current_environment = env pl = @pipelines[pipeline_id] raise ArgumentError.new "Invalid pipeline id: '#{pipeline_id}'. Valid options are #{@pipelines.keys.join(", ")}" if pl.nil? @current_pipeline = pl pl.load!(env, @options[:'deploy-shipcloud']) end |
#validateThatEnvironmentIsSelected ⇒ Object
92 93 94 95 96 |
# File 'lib/conan/manifest.rb', line 92 def validateThatEnvironmentIsSelected unless @current_environment && @current_pipeline raise ScriptError, 'Environment and Pipeline must be selected' end end |