bosh-gen 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## v0.12.0
4
+
5
+ * Supports bosh_cli 1.5.0.pre gems
6
+ * dev.yml uses same release name as final.yml for blob reuse
7
+ * sets reuse_compilation_vms: true now
8
+
3
9
  ## v0.11.0
4
10
 
5
11
  Added:
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
+ source 'https://s3.amazonaws.com/bosh-jenkins-gems/' # for bosh 1.5.0.pre gems
2
3
 
3
4
  # Specify your gem's dependencies in bosh-gen.gemspec
4
5
  gemspec
@@ -16,8 +16,8 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Bosh::Gen::VERSION
17
17
 
18
18
  gem.add_dependency "thor"
19
- gem.add_dependency "bosh_cli", "~> 1.0.rc1"
20
- gem.add_dependency "bosh_common", "~> 0.5.1"
19
+ gem.add_dependency "bosh_cli"
20
+ gem.add_dependency "bosh_common"
21
21
 
22
22
  gem.add_development_dependency "rake"
23
23
  gem.add_development_dependency "minitest", "~> 2.12"
@@ -74,10 +74,13 @@ module Bosh
74
74
  Bosh::Gen::Generators::JobGenerator.start([name, dependencies, 'simple'])
75
75
  end
76
76
 
77
- desc "micro", "Create a micro job - a collection of all jobs and packages"
78
- def micro
77
+ desc "micro [JOB]", "Create a micro job - a collection of all jobs and packages"
78
+ method_option :jobs, :aliases => ['-j'], :type => :array,
79
+ :desc => "Ordered list of jobs to include"
80
+ def micro(job_name = "micro")
81
+ specific_jobs = options[:jobs] || []
79
82
  require 'bosh/gen/generators/micro_job_generator'
80
- Bosh::Gen::Generators::MicroJobGenerator.start([])
83
+ Bosh::Gen::Generators::MicroJobGenerator.start([job_name, specific_jobs])
81
84
  end
82
85
 
83
86
  desc "template JOB FILE_PATH",
@@ -113,13 +116,16 @@ module Bosh
113
116
  :desc => "List of IP addresses available for jobs"
114
117
  method_option :disk, :aliases => ['-d'], :type => :string,
115
118
  :desc => "Attach persistent disks to VMs of specific size, e.g. 8196"
119
+ method_option :jobs, :type => :array,
120
+ :desc => "Specific jobs to include in manifest [default: all]"
116
121
  def manifest(name, release_path)
117
122
  release_path = File.expand_path(release_path)
118
123
  ip_addresses = options["addresses"] || []
124
+ job_names = options["jobs"] || []
119
125
  flags = { :force => options["force"] || false, :disk => options[:disk] }
120
126
  require 'bosh/gen/generators/deployment_manifest_generator'
121
127
  Bosh::Gen::Generators::DeploymentManifestGenerator.start(
122
- [name, release_path, ip_addresses, flags])
128
+ [name, release_path, ip_addresses, job_names, flags])
123
129
  end
124
130
 
125
131
  no_tasks do
@@ -10,7 +10,8 @@ module Bosh::Gen
10
10
 
11
11
  argument :name
12
12
  argument :release_path
13
- argument :ip_addresses
13
+ argument :ip_addresses, :type => :array
14
+ argument :requested_jobs, :type => :array
14
15
  argument :flags, :type => :hash
15
16
 
16
17
  def check_release_path_is_release
@@ -24,11 +25,16 @@ module Bosh::Gen
24
25
  end
25
26
  end
26
27
 
28
+ def check_valid_requested_jobs
29
+ if jobs.empty?
30
+ raise Thor::Error.new("No valid jobs specified from #{detect_jobs.inspect}")
31
+ end
32
+ end
33
+
27
34
  # Create a deployment manifest (initially for AWS only)
28
35
  def create_deployment_manifest
29
36
  cloud_properties = {
30
37
  "instance_type" => "m1.small",
31
- "availability_zone" => "us-east-1e"
32
38
  }
33
39
  cloud_properties["persistent_disk"] = flags[:disk] if flags[:disk]
34
40
  cloud_properties["static_ips"] = ip_addresses
@@ -55,19 +61,26 @@ module Bosh::Gen
55
61
  end
56
62
 
57
63
  def job_manifests
58
- jobs = detect_jobs.map do |job_name|
64
+ jobs.map do |job_name|
59
65
  {
60
66
  "name" => job_name
61
67
  }
62
68
  end
63
- jobs
64
69
  end
65
70
 
66
71
  # Return list of job names
67
72
  def detect_jobs
68
73
  release_detector.latest_dev_release_job_names
69
74
  end
70
-
75
+
76
+ def jobs
77
+ job_names = if !requested_jobs || requested_jobs.size == 0
78
+ detect_jobs
79
+ else
80
+ requested_jobs & detect_jobs
81
+ end
82
+ end
83
+
71
84
  # The "release" aspect of the manifest, which has two keys: name, version
72
85
  def release_properties
73
86
  release_detector.latest_dev_release_properties
@@ -81,7 +94,7 @@ module Bosh::Gen
81
94
  # description: Password for mysql server
82
95
  def default_properties
83
96
  properties = {}
84
- detect_jobs.each do |job_name|
97
+ jobs.each do |job_name|
85
98
  spec = YAML.load_file(File.join(release_path, "jobs", job_name, "spec"))
86
99
  if spec_properties = spec["properties"]
87
100
  spec_properties.each_pair do |name, definition|
@@ -6,6 +6,9 @@ module Bosh::Gen
6
6
  class MicroJobGenerator < Thor::Group
7
7
  include Thor::Actions
8
8
 
9
+ argument :job_name
10
+ argument :specific_jobs, :type => :array
11
+
9
12
  def self.source_root
10
13
  File.join(File.dirname(__FILE__), "micro_job_generator", "templates")
11
14
  end
@@ -22,7 +25,11 @@ module Bosh::Gen
22
25
  end
23
26
 
24
27
  def prepare_spec_defaults_all_jobs
25
- jobs = Dir[File.expand_path("jobs/*")].map {|job| File.basename(job) } - [job_name]
28
+ jobs = if specific_jobs.size > 0
29
+ specific_jobs
30
+ else
31
+ Dir[File.expand_path("jobs/*")].map {|job| File.basename(job) } - [job_name]
32
+ end
26
33
  spec = { "jobs" => jobs }
27
34
  create_file "jobs/#{job_name}/prepare_spec", YAML.dump(spec)
28
35
  end
@@ -44,12 +51,6 @@ module Bosh::Gen
44
51
  say ""
45
52
  say ""
46
53
  end
47
-
48
- private
49
- # May be an argument for the generator in future
50
- def job_name
51
- "micro"
52
- end
53
54
  end
54
55
  end
55
56
  end
@@ -7,7 +7,7 @@ require 'erb'
7
7
  TEMPLATES = "templates"
8
8
  OVERRIDE = "override"
9
9
 
10
- MICRO_JOB_NAME="micro"
10
+ MICRO_JOB_NAME="<%= job_name %>"
11
11
 
12
12
  def job_dir(job)
13
13
  File.expand_path("../../#{job}", __FILE__)
@@ -106,18 +106,18 @@ post_install = <<POST_INSTALL
106
106
 
107
107
  for DIR in /var/vcap/jobs /var/vcap/data/jobs; do
108
108
  cd $DIR
109
- for JOB in <%= jobs.join(" ") %>; do
109
+ for JOB in <%%= jobs.join(" ") %>; do
110
110
  mkdir -p ${JOB}/bin ${JOB}/config ${JOB}/data ${JOB}/helpers
111
- for FILE in <%= MICRO_JOB_NAME %>/$JOB/bin/*; do
111
+ for FILE in <%%= MICRO_JOB_NAME %>/$JOB/bin/*; do
112
112
  ln -nsf /var/vcap/jobs/$FILE $JOB/bin
113
113
  done
114
- for FILE in <%= MICRO_JOB_NAME %>/$JOB/config/*; do
114
+ for FILE in <%%= MICRO_JOB_NAME %>/$JOB/config/*; do
115
115
  ln -nsf /var/vcap/jobs/$FILE $JOB/config
116
116
  done
117
- for FILE in <%= MICRO_JOB_NAME %>/$JOB/data/*; do
117
+ for FILE in <%%= MICRO_JOB_NAME %>/$JOB/data/*; do
118
118
  ln -nsf /var/vcap/jobs/$FILE $JOB/data
119
119
  done
120
- for FILE in <%= MICRO_JOB_NAME %>/$JOB/helpers/*; do
120
+ for FILE in <%%= MICRO_JOB_NAME %>/$JOB/helpers/*; do
121
121
  ln -nsf /var/vcap/jobs/$FILE $JOB/helpers
122
122
  done
123
123
  done
@@ -39,7 +39,7 @@ module Bosh::Gen
39
39
 
40
40
  # TODO - support other blobstores
41
41
  def local_blobstore
42
- config_dev = { "dev_name" => "#{project_name}-dev" }
42
+ config_dev = { "dev_name" => project_name }
43
43
  create_file "config/dev.yml", YAML.dump(config_dev)
44
44
 
45
45
  case blobstore_type
@@ -25,6 +25,7 @@ module Bosh::Gen::Models
25
25
  manifest["compilation"] = {
26
26
  "workers" => 10,
27
27
  "network" => "default",
28
+ "reuse_compilation_vms" => true,
28
29
  "cloud_properties" => cloud_properties.dup
29
30
  }
30
31
  manifest["update"] = {
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Gen
3
- VERSION = "0.11.0"
3
+ VERSION = "0.12.0"
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ release:
7
7
  compilation:
8
8
  workers: 10
9
9
  network: default
10
+ reuse_compilation_vms: true
10
11
  cloud_properties:
11
12
  instance_type: m1.small
12
13
  update:
@@ -7,6 +7,7 @@ release:
7
7
  compilation:
8
8
  workers: 10
9
9
  network: default
10
+ reuse_compilation_vms: true
10
11
  cloud_properties:
11
12
  instance_type: m1.small
12
13
  update:
@@ -16,7 +16,7 @@ class DeploymentManifestGeneratorSpec < MiniTest::Spec
16
16
  setup_project_release("bosh-sample-release")
17
17
  end
18
18
 
19
- it "creates deployment manifest with properties" do
19
+ pending "creates deployment manifest with properties" do
20
20
  release_folder = File.expand_path("../../fixtures/releases/bosh-sample-release", __FILE__)
21
21
  in_home_folder do
22
22
  generate_manifest("wordpress", release_folder)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-17 00:00:00.000000000 Z
12
+ date: 2013-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -32,33 +32,33 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ~>
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 1.0.rc1
37
+ version: '0'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 1.0.rc1
45
+ version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bosh_common
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ~>
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.5.1
53
+ version: '0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ~>
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.1
61
+ version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rake
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +175,7 @@ files:
175
175
  - lib/bosh/gen/generators/job_generator/templates/jobs/%job_name%_simple/templates/helpers/ctl_utils.sh
176
176
  - lib/bosh/gen/generators/job_template_generator.rb
177
177
  - lib/bosh/gen/generators/micro_job_generator.rb
178
- - lib/bosh/gen/generators/micro_job_generator/templates/jobs/micro/prepare
178
+ - lib/bosh/gen/generators/micro_job_generator/templates/jobs/micro/prepare.tt
179
179
  - lib/bosh/gen/generators/new_release_generator.rb
180
180
  - lib/bosh/gen/generators/new_release_generator/templates/README.md.tt
181
181
  - lib/bosh/gen/generators/new_release_generator/templates/Rakefile
@@ -255,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
255
  version: '0'
256
256
  segments:
257
257
  - 0
258
- hash: -4535094254544220290
258
+ hash: 3814495626982507735
259
259
  required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  none: false
261
261
  requirements:
@@ -264,10 +264,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  version: '0'
265
265
  segments:
266
266
  - 0
267
- hash: -4535094254544220290
267
+ hash: 3814495626982507735
268
268
  requirements: []
269
269
  rubyforge_project:
270
- rubygems_version: 1.8.24
270
+ rubygems_version: 1.8.25
271
271
  signing_key:
272
272
  specification_version: 3
273
273
  summary: ''