bosh-stemcell 1.2824.0 → 1.2827.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/bosh/stemcell/archive_filename.rb +5 -2
- data/lib/bosh/stemcell/build_environment.rb +18 -2
- data/lib/bosh/stemcell/builder_options.rb +4 -7
- data/lib/bosh/stemcell/definition.rb +9 -3
- data/lib/bosh/stemcell/infrastructure.rb +42 -7
- data/lib/bosh/stemcell/stage_collection.rb +50 -70
- data/lib/bosh/stemcell/stemcell.rb +22 -0
- data/lib/bosh/stemcell/stemcell_builder.rb +6 -2
- data/lib/bosh/stemcell/stemcell_packager.rb +75 -0
- data/lib/bosh/stemcell/version.rb +1 -1
- metadata +28 -47
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1c339921855e06733713773ff4bcf64e21bdd2b
|
4
|
+
data.tar.gz: 321ea72e34e48f90542109061bf8285805c4b648
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a4027b6c935f99ea31e7bbfa156100316e2a5fe42ff0e7e92ee4cf9985cb971ead1135650afcaa03809233a42b7810ed061375624985c6cc4825604dd27de55
|
7
|
+
data.tar.gz: 632be5e53195844d33857540e085d3a4f2397137454990ad586a9f2384d3f4df893f551936f10268e7a102e48c4ee18f272dafe371fb78c34ce64c074f6d94ac
|
@@ -4,18 +4,20 @@ module Bosh::Stemcell
|
|
4
4
|
class ArchiveFilename
|
5
5
|
extend Forwardable
|
6
6
|
|
7
|
-
def initialize(version, definition, base_name)
|
7
|
+
def initialize(version, definition, base_name, disk_format)
|
8
8
|
@version = version
|
9
9
|
@definition = definition
|
10
10
|
@base_name = base_name
|
11
|
+
@disk_format = disk_format
|
11
12
|
end
|
12
13
|
|
13
14
|
def to_s
|
14
15
|
stemcell_filename_parts = [
|
15
16
|
name,
|
16
17
|
version,
|
17
|
-
definition.stemcell_name
|
18
|
+
definition.stemcell_name(disk_format)
|
18
19
|
]
|
20
|
+
|
19
21
|
"#{stemcell_filename_parts.join('-')}.tgz"
|
20
22
|
end
|
21
23
|
|
@@ -29,6 +31,7 @@ module Bosh::Stemcell
|
|
29
31
|
:base_name,
|
30
32
|
:version,
|
31
33
|
:definition,
|
34
|
+
:disk_format,
|
32
35
|
)
|
33
36
|
end
|
34
37
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'bosh/core/shell'
|
2
2
|
require 'bosh/stemcell/builder_options'
|
3
|
+
require 'bosh/stemcell/stemcell'
|
3
4
|
require 'forwardable'
|
4
5
|
|
5
6
|
module Bosh::Stemcell
|
@@ -13,6 +14,7 @@ module Bosh::Stemcell
|
|
13
14
|
@environment = env
|
14
15
|
@definition = definition
|
15
16
|
@os_image_tarball_path = os_image_tarball_path
|
17
|
+
@version = version
|
16
18
|
@stemcell_builder_options = BuilderOptions.new(
|
17
19
|
env: env,
|
18
20
|
definition: definition,
|
@@ -23,11 +25,14 @@ module Bosh::Stemcell
|
|
23
25
|
@shell = Bosh::Core::Shell.new
|
24
26
|
end
|
25
27
|
|
28
|
+
attr_reader :version
|
29
|
+
|
26
30
|
def prepare_build
|
27
31
|
sanitize
|
28
32
|
prepare_build_path
|
29
33
|
copy_stemcell_builder_to_build_path
|
30
34
|
prepare_work_root
|
35
|
+
prepare_stemcell_path
|
31
36
|
persist_settings_for_bash
|
32
37
|
end
|
33
38
|
|
@@ -55,8 +60,11 @@ module Bosh::Stemcell
|
|
55
60
|
File.join(build_root, 'build')
|
56
61
|
end
|
57
62
|
|
58
|
-
def
|
59
|
-
|
63
|
+
def stemcell_files
|
64
|
+
definition.disk_formats.map do |disk_format|
|
65
|
+
stemcell_filename = Stemcell.new(@definition, 'bosh-stemcell', @version, disk_format)
|
66
|
+
File.join(work_path, stemcell_filename.name)
|
67
|
+
end
|
60
68
|
end
|
61
69
|
|
62
70
|
def chroot_dir
|
@@ -71,6 +79,10 @@ module Bosh::Stemcell
|
|
71
79
|
File.join(work_root, 'work')
|
72
80
|
end
|
73
81
|
|
82
|
+
def stemcell_tarball_path
|
83
|
+
work_path
|
84
|
+
end
|
85
|
+
|
74
86
|
def command_env
|
75
87
|
"env #{hash_as_bash_env(proxy_settings_from_environment)}"
|
76
88
|
end
|
@@ -116,6 +128,10 @@ module Bosh::Stemcell
|
|
116
128
|
FileUtils.mkdir_p(build_path, verbose: true)
|
117
129
|
end
|
118
130
|
|
131
|
+
def prepare_stemcell_path
|
132
|
+
FileUtils.mkdir_p(File.join(work_path, 'stemcell'))
|
133
|
+
end
|
134
|
+
|
119
135
|
def copy_stemcell_builder_to_build_path
|
120
136
|
FileUtils.cp_r(Dir.glob("#{STEMCELL_BUILDER_SOURCE_DIR}/*"), build_path, preserve: true, verbose: true)
|
121
137
|
end
|
@@ -18,8 +18,6 @@ module Bosh::Stemcell
|
|
18
18
|
|
19
19
|
def default
|
20
20
|
{
|
21
|
-
'stemcell_name' => "bosh-#{@definition.stemcell_name}",
|
22
|
-
'stemcell_tgz' => archive_filename.to_s,
|
23
21
|
'stemcell_image_name' => stemcell_image_name,
|
24
22
|
'stemcell_version' => stemcell_version,
|
25
23
|
'stemcell_hypervisor' => infrastructure.hypervisor,
|
@@ -34,6 +32,10 @@ module Bosh::Stemcell
|
|
34
32
|
}.merge(bosh_micro_options).merge(environment_variables).merge(ovf_options)
|
35
33
|
end
|
36
34
|
|
35
|
+
attr_reader(
|
36
|
+
:stemcell_version,
|
37
|
+
)
|
38
|
+
|
37
39
|
private
|
38
40
|
|
39
41
|
def_delegators(
|
@@ -45,7 +47,6 @@ module Bosh::Stemcell
|
|
45
47
|
|
46
48
|
attr_reader(
|
47
49
|
:environment,
|
48
|
-
:stemcell_version,
|
49
50
|
:definition,
|
50
51
|
:image_create_disk_size,
|
51
52
|
:bosh_micro_release_tgz_path,
|
@@ -76,10 +77,6 @@ module Bosh::Stemcell
|
|
76
77
|
}
|
77
78
|
end
|
78
79
|
|
79
|
-
def archive_filename
|
80
|
-
ArchiveFilename.new(stemcell_version, definition, 'bosh-stemcell')
|
81
|
-
end
|
82
|
-
|
83
80
|
def stemcell_image_name
|
84
81
|
"#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}.raw"
|
85
82
|
end
|
@@ -19,7 +19,7 @@ module Bosh::Stemcell
|
|
19
19
|
hypervisor_name,
|
20
20
|
Bosh::Stemcell::OperatingSystem.for(operating_system_name, operating_system_version),
|
21
21
|
Bosh::Stemcell::Agent.for(agent_name),
|
22
|
-
light
|
22
|
+
light,
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
@@ -31,7 +31,7 @@ module Bosh::Stemcell
|
|
31
31
|
@light = light
|
32
32
|
end
|
33
33
|
|
34
|
-
def stemcell_name
|
34
|
+
def stemcell_name(disk_format)
|
35
35
|
stemcell_name_parts = [
|
36
36
|
infrastructure.name,
|
37
37
|
hypervisor_name,
|
@@ -39,9 +39,15 @@ module Bosh::Stemcell
|
|
39
39
|
]
|
40
40
|
stemcell_name_parts << operating_system.version if operating_system.version
|
41
41
|
stemcell_name_parts << "#{agent.name}_agent" unless agent.name == 'ruby'
|
42
|
+
stemcell_name_parts << disk_format unless disk_format == infrastructure.default_disk_format
|
43
|
+
|
42
44
|
stemcell_name_parts.join('-')
|
43
45
|
end
|
44
46
|
|
47
|
+
def disk_formats
|
48
|
+
infrastructure.disk_formats
|
49
|
+
end
|
50
|
+
|
45
51
|
def ==(other)
|
46
52
|
infrastructure == other.infrastructure &&
|
47
53
|
operating_system == other.operating_system &&
|
@@ -50,7 +56,7 @@ module Bosh::Stemcell
|
|
50
56
|
end
|
51
57
|
|
52
58
|
def light?
|
53
|
-
@light
|
59
|
+
@light == true
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
@@ -20,13 +20,22 @@ module Bosh::Stemcell
|
|
20
20
|
end
|
21
21
|
|
22
22
|
class Base
|
23
|
-
attr_reader :name, :hypervisor, :default_disk_size
|
23
|
+
attr_reader :name, :hypervisor, :default_disk_size, :disk_formats
|
24
24
|
|
25
25
|
def initialize(options = {})
|
26
26
|
@name = options.fetch(:name)
|
27
27
|
@supports_light_stemcell = options.fetch(:supports_light_stemcell, false)
|
28
28
|
@hypervisor = options.fetch(:hypervisor)
|
29
29
|
@default_disk_size = options.fetch(:default_disk_size)
|
30
|
+
@disk_formats = options.fetch(:disk_formats)
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_disk_format
|
34
|
+
disk_formats.first
|
35
|
+
end
|
36
|
+
|
37
|
+
def additional_cloud_properties
|
38
|
+
{}
|
30
39
|
end
|
31
40
|
|
32
41
|
def ==(other)
|
@@ -38,37 +47,63 @@ module Bosh::Stemcell
|
|
38
47
|
|
39
48
|
class NullInfrastructure < Base
|
40
49
|
def initialize
|
41
|
-
super(name: 'null', hypervisor: 'null', default_disk_size: -1)
|
50
|
+
super(name: 'null', hypervisor: 'null', default_disk_size: -1, disk_formats: [])
|
42
51
|
end
|
43
52
|
end
|
44
53
|
|
45
54
|
class OpenStack < Base
|
46
55
|
def initialize
|
47
|
-
super(name: 'openstack', hypervisor: 'kvm', default_disk_size: 3072)
|
56
|
+
super(name: 'openstack', hypervisor: 'kvm', default_disk_size: 3072, disk_formats: ['qcow2', 'raw'])
|
57
|
+
end
|
58
|
+
|
59
|
+
def additional_cloud_properties
|
60
|
+
{'auto_disk_config' => true}
|
48
61
|
end
|
49
62
|
end
|
50
63
|
|
51
64
|
class Vsphere < Base
|
52
65
|
def initialize
|
53
|
-
super(name: 'vsphere', hypervisor: 'esxi', default_disk_size: 3072)
|
66
|
+
super(name: 'vsphere', hypervisor: 'esxi', default_disk_size: 3072, disk_formats: ['ovf'])
|
67
|
+
end
|
68
|
+
|
69
|
+
def additional_cloud_properties
|
70
|
+
{'root_device_name' => '/dev/sda1'}
|
54
71
|
end
|
55
72
|
end
|
56
73
|
|
57
74
|
class Vcloud < Base
|
58
75
|
def initialize
|
59
|
-
super(name: 'vcloud', hypervisor: 'esxi', default_disk_size: 3072)
|
76
|
+
super(name: 'vcloud', hypervisor: 'esxi', default_disk_size: 3072, disk_formats: ['ovf'])
|
77
|
+
end
|
78
|
+
|
79
|
+
def additional_cloud_properties
|
80
|
+
{'root_device_name' => '/dev/sda1'}
|
60
81
|
end
|
61
82
|
end
|
62
83
|
|
63
84
|
class Aws < Base
|
64
85
|
def initialize
|
65
|
-
super(
|
86
|
+
super(
|
87
|
+
name: 'aws',
|
88
|
+
hypervisor: 'xen',
|
89
|
+
supports_light_stemcell: true,
|
90
|
+
default_disk_size: 2048,
|
91
|
+
disk_formats: ['raw']
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
def additional_cloud_properties
|
96
|
+
{'root_device_name' => '/dev/sda1'}
|
66
97
|
end
|
67
98
|
end
|
68
99
|
|
69
100
|
class Warden < Base
|
70
101
|
def initialize
|
71
|
-
super(name: 'warden', hypervisor: 'boshlite', default_disk_size: 2048)
|
102
|
+
super(name: 'warden', hypervisor: 'boshlite', default_disk_size: 2048, disk_formats: ['files'])
|
103
|
+
end
|
104
|
+
|
105
|
+
def additional_cloud_properties
|
106
|
+
{'root_device_name' => '/dev/sda1'}
|
72
107
|
end
|
73
108
|
end
|
74
109
|
end
|
@@ -34,7 +34,7 @@ module Bosh::Stemcell
|
|
34
34
|
]
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def build_stemcell_image_stages
|
38
38
|
case infrastructure
|
39
39
|
when Infrastructure::Aws then
|
40
40
|
aws_stages
|
@@ -49,34 +49,47 @@ module Bosh::Stemcell
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def package_stemcell_stages(disk_format)
|
53
|
+
case disk_format
|
54
|
+
when 'raw' then
|
55
|
+
raw_package_stages
|
56
|
+
when 'qcow2' then
|
57
|
+
qcow2_package_stages
|
58
|
+
when 'ovf' then
|
59
|
+
ovf_package_stages
|
60
|
+
when 'files' then
|
61
|
+
files_package_stages
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def_delegators :@definition, :infrastructure, :operating_system, :agent
|
68
|
+
|
52
69
|
def openstack_stages
|
53
70
|
if operating_system.instance_of?(OperatingSystem::Centos)
|
54
71
|
centos_openstack_stages
|
55
72
|
else
|
56
|
-
|
73
|
+
ubuntu_openstack_stages
|
57
74
|
end
|
58
75
|
end
|
59
76
|
|
60
77
|
def vsphere_stages
|
61
78
|
if operating_system.instance_of?(OperatingSystem::Centos)
|
62
|
-
|
79
|
+
centos_vmware_stages
|
63
80
|
else
|
64
|
-
|
81
|
+
ubuntu_vmware_stages
|
65
82
|
end
|
66
83
|
end
|
67
84
|
|
68
85
|
def vcloud_stages
|
69
86
|
if operating_system.instance_of?(OperatingSystem::Centos)
|
70
|
-
|
87
|
+
centos_vmware_stages
|
71
88
|
else
|
72
|
-
|
89
|
+
ubuntu_vmware_stages
|
73
90
|
end
|
74
91
|
end
|
75
92
|
|
76
|
-
private
|
77
|
-
|
78
|
-
def_delegators :@definition, :infrastructure, :operating_system, :agent
|
79
|
-
|
80
93
|
def centos_os_stages
|
81
94
|
[
|
82
95
|
:base_centos,
|
@@ -120,7 +133,7 @@ module Bosh::Stemcell
|
|
120
133
|
]
|
121
134
|
end
|
122
135
|
|
123
|
-
def
|
136
|
+
def centos_vmware_stages
|
124
137
|
[
|
125
138
|
#:system_open_vm_tools,
|
126
139
|
:system_vsphere_cdrom,
|
@@ -129,26 +142,6 @@ module Bosh::Stemcell
|
|
129
142
|
:bosh_harden,
|
130
143
|
:image_create,
|
131
144
|
:image_install_grub,
|
132
|
-
:image_ovf_vmx,
|
133
|
-
:image_ovf_generate,
|
134
|
-
:image_ovf_prepare_stemcell,
|
135
|
-
:stemcell,
|
136
|
-
]
|
137
|
-
end
|
138
|
-
|
139
|
-
def centos_vcloud_stages
|
140
|
-
[
|
141
|
-
#:system_open_vm_tools,
|
142
|
-
:system_vsphere_cdrom,
|
143
|
-
:system_parameters,
|
144
|
-
:bosh_clean,
|
145
|
-
:bosh_harden,
|
146
|
-
:image_create,
|
147
|
-
:image_install_grub,
|
148
|
-
:image_ovf_vmx,
|
149
|
-
:image_ovf_generate,
|
150
|
-
:image_ovf_prepare_stemcell,
|
151
|
-
:stemcell
|
152
145
|
]
|
153
146
|
end
|
154
147
|
|
@@ -164,10 +157,6 @@ module Bosh::Stemcell
|
|
164
157
|
:bosh_openstack_agent_settings,
|
165
158
|
:image_create,
|
166
159
|
:image_install_grub,
|
167
|
-
:image_openstack_qcow2,
|
168
|
-
:image_openstack_prepare_stemcell,
|
169
|
-
# Final stemcell
|
170
|
-
:stemcell_openstack,
|
171
160
|
]
|
172
161
|
end
|
173
162
|
|
@@ -185,13 +174,10 @@ module Bosh::Stemcell
|
|
185
174
|
:image_create,
|
186
175
|
:image_install_grub,
|
187
176
|
:image_aws_update_grub,
|
188
|
-
:image_aws_prepare_stemcell,
|
189
|
-
# Final stemcell
|
190
|
-
:stemcell,
|
191
177
|
]
|
192
178
|
end
|
193
179
|
|
194
|
-
def
|
180
|
+
def ubuntu_openstack_stages
|
195
181
|
[
|
196
182
|
# Misc
|
197
183
|
:system_openstack_network,
|
@@ -206,14 +192,10 @@ module Bosh::Stemcell
|
|
206
192
|
# Image/bootloader
|
207
193
|
:image_create,
|
208
194
|
:image_install_grub,
|
209
|
-
:image_openstack_qcow2,
|
210
|
-
:image_openstack_prepare_stemcell,
|
211
|
-
# Final stemcell
|
212
|
-
:stemcell_openstack,
|
213
195
|
]
|
214
196
|
end
|
215
197
|
|
216
|
-
def
|
198
|
+
def ubuntu_vmware_stages
|
217
199
|
[
|
218
200
|
:system_open_vm_tools,
|
219
201
|
:system_vsphere_cdrom,
|
@@ -225,48 +207,46 @@ module Bosh::Stemcell
|
|
225
207
|
# Image/bootloader
|
226
208
|
:image_create,
|
227
209
|
:image_install_grub,
|
228
|
-
:image_ovf_vmx,
|
229
|
-
:image_ovf_generate,
|
230
|
-
:image_ovf_prepare_stemcell,
|
231
|
-
# Final stemcell
|
232
|
-
:stemcell,
|
233
210
|
]
|
234
211
|
end
|
235
212
|
|
236
|
-
def
|
213
|
+
def warden_stages
|
237
214
|
[
|
238
|
-
:system_open_vm_tools,
|
239
|
-
:system_vsphere_cdrom,
|
240
|
-
# Misc
|
241
215
|
:system_parameters,
|
216
|
+
:base_warden,
|
242
217
|
# Finalisation
|
243
218
|
:bosh_clean,
|
244
219
|
:bosh_harden,
|
245
|
-
#
|
220
|
+
# only used for spec test
|
246
221
|
:image_create,
|
247
|
-
|
222
|
+
]
|
223
|
+
end
|
224
|
+
|
225
|
+
def raw_package_stages
|
226
|
+
[
|
227
|
+
:prepare_raw_image_stemcell,
|
228
|
+
]
|
229
|
+
end
|
230
|
+
|
231
|
+
def qcow2_package_stages
|
232
|
+
[
|
233
|
+
:prepare_qcow2_image_stemcell,
|
234
|
+
]
|
235
|
+
end
|
236
|
+
|
237
|
+
def ovf_package_stages
|
238
|
+
[
|
248
239
|
:image_ovf_vmx,
|
249
240
|
:image_ovf_generate,
|
250
|
-
:
|
251
|
-
# Final stemcell
|
252
|
-
:stemcell
|
241
|
+
:prepare_ovf_image_stemcell,
|
253
242
|
]
|
254
243
|
end
|
255
244
|
|
256
|
-
def
|
245
|
+
def files_package_stages
|
257
246
|
[
|
258
|
-
:
|
259
|
-
:base_warden,
|
260
|
-
# Finalisation
|
261
|
-
:bosh_clean,
|
262
|
-
:bosh_harden,
|
263
|
-
# Image copy
|
264
|
-
:bosh_copy_root,
|
265
|
-
# only used for spec test
|
266
|
-
:image_create,
|
267
|
-
# Final stemcell
|
268
|
-
:stemcell,
|
247
|
+
:prepare_files_image_stemcell,
|
269
248
|
]
|
270
249
|
end
|
250
|
+
|
271
251
|
end
|
272
252
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Bosh
|
2
|
+
module Stemcell
|
3
|
+
class Stemcell
|
4
|
+
attr_reader :version, :definition, :disk_format, :base_name
|
5
|
+
|
6
|
+
def initialize(definition, base_name, version, disk_format)
|
7
|
+
@definition = definition
|
8
|
+
@base_name = base_name
|
9
|
+
@version = version
|
10
|
+
@disk_format = disk_format
|
11
|
+
end
|
12
|
+
|
13
|
+
def infrastructure
|
14
|
+
@definition.infrastructure
|
15
|
+
end
|
16
|
+
|
17
|
+
def name
|
18
|
+
ArchiveFilename.new(version, definition, base_name, disk_format).to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,18 +1,22 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'bosh/stemcell/stage_collection'
|
3
|
+
|
1
4
|
module Bosh::Stemcell
|
2
5
|
class StemcellBuilder
|
3
6
|
def initialize(dependencies = {})
|
4
7
|
@gem_components = dependencies.fetch(:gem_components)
|
5
8
|
@environment = dependencies.fetch(:environment)
|
6
|
-
@collection = dependencies.fetch(:collection)
|
7
9
|
@runner = dependencies.fetch(:runner)
|
10
|
+
@collection = dependencies.fetch(:collection)
|
8
11
|
end
|
9
12
|
|
10
13
|
def build
|
11
14
|
gem_components.build_release_gems
|
12
15
|
environment.prepare_build
|
16
|
+
|
13
17
|
stemcell_stages = collection.extract_operating_system_stages +
|
14
18
|
collection.agent_stages +
|
15
|
-
collection.
|
19
|
+
collection.build_stemcell_image_stages
|
16
20
|
runner.configure_and_apply(stemcell_stages)
|
17
21
|
end
|
18
22
|
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Bosh
|
2
|
+
module Stemcell
|
3
|
+
class StemcellPackager
|
4
|
+
def initialize(definition, version, work_path, tarball_path, runner, collection)
|
5
|
+
@definition = definition
|
6
|
+
@version = version
|
7
|
+
@stemcell_build_path = File.join(work_path, 'stemcell')
|
8
|
+
@tarball_path = tarball_path
|
9
|
+
@runner = runner
|
10
|
+
@collection = collection
|
11
|
+
end
|
12
|
+
|
13
|
+
def package(disk_format)
|
14
|
+
File.delete(stemcell_image_path) if File.exist?(stemcell_image_path)
|
15
|
+
|
16
|
+
runner.configure_and_apply(collection.package_stemcell_stages(disk_format))
|
17
|
+
|
18
|
+
write_manifest(disk_format)
|
19
|
+
create_tarball(disk_format)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :definition, :version, :stemcell_build_path, :tarball_path, :runner, :collection
|
25
|
+
|
26
|
+
def write_manifest(disk_format)
|
27
|
+
manifest_filename = File.join(stemcell_build_path, "stemcell.MF")
|
28
|
+
File.open(manifest_filename, "w") do |f|
|
29
|
+
f.write(Psych.dump(manifest(disk_format)))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def manifest(disk_format)
|
34
|
+
infrastructure = definition.infrastructure
|
35
|
+
|
36
|
+
{
|
37
|
+
'name' => definition.stemcell_name(disk_format),
|
38
|
+
'version' => version.to_s,
|
39
|
+
'bosh_protocol' => 1,
|
40
|
+
'sha1' => image_checksum,
|
41
|
+
'cloud_properties' => {
|
42
|
+
'name' => definition.stemcell_name(disk_format),
|
43
|
+
'version' => version.to_s,
|
44
|
+
'infrastructure' => infrastructure.name,
|
45
|
+
'hypervisor' => infrastructure.hypervisor,
|
46
|
+
'disk_format' => disk_format,
|
47
|
+
'container_format' => 'bare',
|
48
|
+
'os_type' => 'linux',
|
49
|
+
'os_distro' => definition.operating_system.name,
|
50
|
+
'architecture' => 'x86_64',
|
51
|
+
}.merge(infrastructure.additional_cloud_properties)
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_tarball(disk_format)
|
56
|
+
stemcell_name = ArchiveFilename.new(version, definition, 'bosh-stemcell', disk_format).to_s
|
57
|
+
tarball_name = File.join(tarball_path, stemcell_name)
|
58
|
+
|
59
|
+
Dir.chdir(stemcell_build_path) do
|
60
|
+
system("tar zcf #{tarball_name} *")
|
61
|
+
end
|
62
|
+
|
63
|
+
tarball_name
|
64
|
+
end
|
65
|
+
|
66
|
+
def image_checksum
|
67
|
+
`shasum -a 1 #{stemcell_image_path}`.split(/\s/).first
|
68
|
+
end
|
69
|
+
|
70
|
+
def stemcell_image_path
|
71
|
+
File.join(stemcell_build_path, 'image')
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,142 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-stemcell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2827.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Pivotal
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bosh_aws_cpi
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
19
|
+
version: 1.2827.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.
|
26
|
+
version: 1.2827.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: fakefs
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec-its
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: timecop
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: serverspec
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: foodcritic
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ">="
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - ">="
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
description: Bosh::Stemcell provides tools to manage stemcells
|
@@ -145,6 +128,7 @@ executables: []
|
|
145
128
|
extensions: []
|
146
129
|
extra_rdoc_files: []
|
147
130
|
files:
|
131
|
+
- README.md
|
148
132
|
- lib/bosh/stemcell.rb
|
149
133
|
- lib/bosh/stemcell/agent.rb
|
150
134
|
- lib/bosh/stemcell/archive.rb
|
@@ -162,36 +146,33 @@ files:
|
|
162
146
|
- lib/bosh/stemcell/os_image_builder.rb
|
163
147
|
- lib/bosh/stemcell/stage_collection.rb
|
164
148
|
- lib/bosh/stemcell/stage_runner.rb
|
149
|
+
- lib/bosh/stemcell/stemcell.rb
|
165
150
|
- lib/bosh/stemcell/stemcell_builder.rb
|
151
|
+
- lib/bosh/stemcell/stemcell_packager.rb
|
166
152
|
- lib/bosh/stemcell/version.rb
|
167
153
|
- lib/monkeypatch/serverspec/backend/exec.rb
|
168
|
-
- README.md
|
169
154
|
homepage: https://github.com/cloudfoundry/bosh
|
170
155
|
licenses:
|
171
156
|
- Apache 2.0
|
157
|
+
metadata: {}
|
172
158
|
post_install_message:
|
173
159
|
rdoc_options: []
|
174
160
|
require_paths:
|
175
161
|
- lib
|
176
162
|
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
163
|
requirements:
|
179
|
-
- -
|
164
|
+
- - ">="
|
180
165
|
- !ruby/object:Gem::Version
|
181
166
|
version: 1.9.3
|
182
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
-
none: false
|
184
168
|
requirements:
|
185
|
-
- -
|
169
|
+
- - ">="
|
186
170
|
- !ruby/object:Gem::Version
|
187
171
|
version: '0'
|
188
|
-
segments:
|
189
|
-
- 0
|
190
|
-
hash: 3884337251874964436
|
191
172
|
requirements: []
|
192
173
|
rubyforge_project:
|
193
|
-
rubygems_version:
|
174
|
+
rubygems_version: 2.2.2
|
194
175
|
signing_key:
|
195
|
-
specification_version:
|
176
|
+
specification_version: 4
|
196
177
|
summary: Bosh::Stemcell provides tools to manage stemcells
|
197
178
|
test_files: []
|