bosh-stemcell 1.2881.0 → 1.2889.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -1
- data/lib/bosh/stemcell/build_environment.rb +6 -7
- data/lib/bosh/stemcell/operating_system.rb +5 -4
- data/lib/bosh/stemcell/os_image_builder.rb +1 -1
- data/lib/bosh/stemcell/stage_collection.rb +27 -22
- data/lib/bosh/stemcell/stage_runner.rb +23 -3
- data/lib/bosh/stemcell/stemcell_builder.rb +1 -1
- data/lib/bosh/stemcell/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba2a6ef7459587f1cff7db279bf62d32d11929f1
|
4
|
+
data.tar.gz: 8a34eae0f8cd1ec05b4f72397b636e9f826ee6b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ec689fe1a2938146844d2c1c190a9c77994def83bc1d2698b288d33810d84ef11e2d58f4625094d231aef2319eaf091621e7252aaeeaae768edf41cf29c02e6
|
7
|
+
data.tar.gz: b6e5853950d2c6fdb27fe9b92c250c2a6eb7fc9153b628265c51f945199ccef49474481747b88a0786f424a3348d3c3872c768362c9aa3b75b2a9f92f5630801
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ If you have changes that will require new OS image you need to build one. A stem
|
|
50
50
|
The arguments to `stemcell:build_os_image` are:
|
51
51
|
|
52
52
|
1. *`operating_system_name`* identifies which type of OS to fetch. Determines which package repository and packaging tool will be used to download and assemble the files. Must match a value recognized by the [OperatingSystem](lib/bosh/stemcell/operating_system.rb) module. Currently, only `ubuntu` and `centos` are recognized.
|
53
|
-
2. *`operating_system_version`* an identifier that the system may use to decide which release of the OS to download. Acceptable values depend on the operating system. For `ubuntu`, use `trusty`. For `centos`,
|
53
|
+
2. *`operating_system_version`* an identifier that the system may use to decide which release of the OS to download. Acceptable values depend on the operating system. For `ubuntu`, use `trusty`. For `centos`, use `6.5` (which builds a CentOS 6.6 OS image) or `7`. No other combinations are presently supported.
|
54
54
|
3. *`os_image_path`* the path to write the finished OS image tarball to. If a file exists at this path already, it will be overwritten without warning.
|
55
55
|
|
56
56
|
See below [Building the stemcell with local OS image](#building-the-stemcell-with-local-os-image) on how to build stemcell with the new OS image.
|
@@ -91,3 +91,23 @@ AWS stemcells can be shipped in light format which includes a reference to a pub
|
|
91
91
|
export BOSH_AWS_SECRET_ACCESS_KEY=YOUR-AWS-SECRET-KEY
|
92
92
|
bundle exec rake stemcell:build_light[/tmp/bosh-stemcell.tgz,hvm]
|
93
93
|
' remote
|
94
|
+
|
95
|
+
### When things go sideways
|
96
|
+
|
97
|
+
If you find yourself debugging any of the above processes, here is what you need to know:
|
98
|
+
|
99
|
+
1. Most of the action happens in Bash scripts, which are referred to as _stages_, and can
|
100
|
+
be found in `stemcell_builder/stages/<stage_name>/apply.sh`.
|
101
|
+
2. You should make all changes on your local machine, and sync them over to the AWS stemcell
|
102
|
+
building machine using `vagrant provision remote` as explained earlier on this page.
|
103
|
+
3. While debugging a particular stage that is failing, you can resume the process from that
|
104
|
+
stage by adding `resume_from=<stage_name>` to the end of your `bundle exec rake` command.
|
105
|
+
When a stage's `apply.sh` fails, you should see a message of the form
|
106
|
+
`Can't find stage '<stage>' to resume from. Aborting.` so you know which stage failed and
|
107
|
+
where you can resume from after fixing the problem.
|
108
|
+
|
109
|
+
For example:
|
110
|
+
|
111
|
+
```
|
112
|
+
bundle exec rake stemcell:build_os_image[ubuntu,trusty,/tmp/ubuntu_base_image.tgz] resume_from=rsyslog_build
|
113
|
+
```
|
@@ -28,8 +28,10 @@ module Bosh::Stemcell
|
|
28
28
|
attr_reader :version
|
29
29
|
|
30
30
|
def prepare_build
|
31
|
-
|
32
|
-
|
31
|
+
if (ENV['resume_from'] == NIL)
|
32
|
+
sanitize
|
33
|
+
prepare_build_path
|
34
|
+
end
|
33
35
|
copy_stemcell_builder_to_build_path
|
34
36
|
prepare_work_root
|
35
37
|
prepare_stemcell_path
|
@@ -42,6 +44,7 @@ module Bosh::Stemcell
|
|
42
44
|
"OS_IMAGE=#{os_image_tarball_path}",
|
43
45
|
'bundle exec rspec -fd',
|
44
46
|
"spec/os_image/common_spec.rb",
|
47
|
+
"spec/os_image/#{operating_system.name}_common_spec.rb",
|
45
48
|
"spec/os_image/#{operating_system_spec_name}_spec.rb",
|
46
49
|
].join(' ')
|
47
50
|
end
|
@@ -117,11 +120,7 @@ module Bosh::Stemcell
|
|
117
120
|
end
|
118
121
|
|
119
122
|
def operating_system_spec_name
|
120
|
-
|
121
|
-
if operating_system.version
|
122
|
-
spec_name = "#{spec_name}_#{operating_system.version}"
|
123
|
-
end
|
124
|
-
spec_name
|
123
|
+
"#{operating_system.name}_#{operating_system.version}"
|
125
124
|
end
|
126
125
|
|
127
126
|
def prepare_build_path
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module Bosh::Stemcell
|
2
2
|
module OperatingSystem
|
3
|
+
|
3
4
|
def self.for(operating_system_name, operating_system_version = nil)
|
4
5
|
case operating_system_name
|
5
|
-
when 'centos' then Centos.new
|
6
|
+
when 'centos' then Centos.new(operating_system_version)
|
6
7
|
when 'ubuntu' then Ubuntu.new(operating_system_version)
|
7
8
|
else raise ArgumentError.new("invalid operating system: #{operating_system_name}")
|
8
9
|
end
|
@@ -13,7 +14,7 @@ module Bosh::Stemcell
|
|
13
14
|
|
14
15
|
def initialize(options = {})
|
15
16
|
@name = options.fetch(:name)
|
16
|
-
@version = options.fetch(:version
|
17
|
+
@version = options.fetch(:version)
|
17
18
|
end
|
18
19
|
|
19
20
|
def ==(other)
|
@@ -22,8 +23,8 @@ module Bosh::Stemcell
|
|
22
23
|
end
|
23
24
|
|
24
25
|
class Centos < Base
|
25
|
-
def initialize
|
26
|
-
super(name: 'centos')
|
26
|
+
def initialize(version)
|
27
|
+
super(name: 'centos', version: version)
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -9,7 +9,7 @@ module Bosh::Stemcell
|
|
9
9
|
|
10
10
|
def build(os_image_path)
|
11
11
|
environment.prepare_build
|
12
|
-
runner.configure_and_apply(collection.operating_system_stages)
|
12
|
+
runner.configure_and_apply(collection.operating_system_stages, ENV['resume_from'])
|
13
13
|
archive_handler.compress(environment.chroot_dir, os_image_path)
|
14
14
|
end
|
15
15
|
|
@@ -91,20 +91,21 @@ module Bosh::Stemcell
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def centos_os_stages
|
94
|
-
[
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
94
|
+
os_stages = [
|
95
|
+
:base_centos,
|
96
|
+
:base_centos_packages,
|
97
|
+
:base_ssh,
|
98
|
+
bosh_steps,
|
99
|
+
:rsyslog_config,
|
100
|
+
:delay_monit_start,
|
101
|
+
:system_grub,
|
102
|
+
].flatten
|
103
|
+
|
104
|
+
if operating_system.version.to_f < 7
|
105
|
+
os_stages.insert(os_stages.index(:rsyslog_config),:rsyslog_build)
|
106
|
+
end
|
107
|
+
|
108
|
+
os_stages
|
108
109
|
end
|
109
110
|
|
110
111
|
def ubuntu_os_stages
|
@@ -119,17 +120,21 @@ module Bosh::Stemcell
|
|
119
120
|
:bosh_sysstat,
|
120
121
|
:bosh_sysctl,
|
121
122
|
:system_kernel,
|
122
|
-
|
123
|
-
:
|
124
|
-
:
|
125
|
-
:bosh_ntpdate,
|
126
|
-
:bosh_sudoers,
|
127
|
-
:rsyslog,
|
123
|
+
bosh_steps,
|
124
|
+
:rsyslog_build,
|
125
|
+
:rsyslog_config,
|
128
126
|
:delay_monit_start,
|
129
|
-
# Install GRUB/kernel/etc
|
130
127
|
:system_grub,
|
131
|
-
# Symlink vim to vim.tiny
|
132
128
|
:vim_tiny,
|
129
|
+
].flatten
|
130
|
+
end
|
131
|
+
|
132
|
+
def bosh_steps
|
133
|
+
[
|
134
|
+
:bosh_users,
|
135
|
+
:bosh_monit,
|
136
|
+
:bosh_ntpdate,
|
137
|
+
:bosh_sudoers,
|
133
138
|
]
|
134
139
|
end
|
135
140
|
|
@@ -9,7 +9,8 @@ module Bosh::Stemcell
|
|
9
9
|
@work_path = options.fetch(:work_path)
|
10
10
|
end
|
11
11
|
|
12
|
-
def configure_and_apply(stages)
|
12
|
+
def configure_and_apply(stages, resume_from_stage = nil)
|
13
|
+
stages = resume_from(stages, resume_from_stage)
|
13
14
|
configure(stages)
|
14
15
|
apply(stages)
|
15
16
|
end
|
@@ -33,9 +34,16 @@ module Bosh::Stemcell
|
|
33
34
|
puts "=== Applying '#{stage}' stage ==="
|
34
35
|
puts "== Started #{Time.now.strftime('%a %b %e %H:%M:%S %Z %Y')} =="
|
35
36
|
|
36
|
-
|
37
|
+
begin
|
38
|
+
stage_apply_script = File.join(build_path, 'stages', stage.to_s, 'apply.sh')
|
39
|
+
|
40
|
+
run_sudo_with_command_env("#{stage_apply_script} #{work_path}")
|
41
|
+
|
42
|
+
rescue => _
|
43
|
+
puts "=== You can resume_from the '#{stage}' stage by using resume_from=#{stage} ==="
|
44
|
+
raise
|
45
|
+
end
|
37
46
|
|
38
|
-
run_sudo_with_command_env("#{stage_apply_script} #{work_path}")
|
39
47
|
end
|
40
48
|
end
|
41
49
|
|
@@ -43,6 +51,18 @@ module Bosh::Stemcell
|
|
43
51
|
|
44
52
|
attr_reader :stages, :build_path, :command_env, :settings_file, :work_path
|
45
53
|
|
54
|
+
def resume_from(all_stages, resume_from_stage)
|
55
|
+
if resume_from_stage != NIL
|
56
|
+
stage_index = all_stages.index(resume_from_stage.to_sym)
|
57
|
+
if stage_index == NIL
|
58
|
+
raise "Can't find stage '#{resume_from_stage}' to resume from. Aborting."
|
59
|
+
end
|
60
|
+
all_stages.drop(stage_index)
|
61
|
+
else
|
62
|
+
all_stages
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
46
66
|
def run_sudo_with_command_env(command)
|
47
67
|
shell = Bosh::Core::Shell.new
|
48
68
|
|
@@ -17,7 +17,7 @@ module Bosh::Stemcell
|
|
17
17
|
stemcell_stages = collection.extract_operating_system_stages +
|
18
18
|
collection.agent_stages +
|
19
19
|
collection.build_stemcell_image_stages
|
20
|
-
runner.configure_and_apply(stemcell_stages)
|
20
|
+
runner.configure_and_apply(stemcell_stages, ENV['resume_from'])
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-stemcell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2889.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_aws_cpi
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2889.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2889.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bosh-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2889.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2889.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: fakefs
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|