Class: Bosh::Stemcell::BuildEnvironment
- Inherits:
-
Object
- Object
- Bosh::Stemcell::BuildEnvironment
- Extended by:
- Forwardable
- Defined in:
- lib/bosh/stemcell/build_environment.rb
Constant Summary collapse
- STEMCELL_BUILDER_SOURCE_DIR =
File.join(File.('../../../../..', __FILE__), 'stemcell_builder')
- STEMCELL_SPECS_DIR =
File.('../../..', File.dirname(__FILE__))
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #build_path ⇒ Object
- #chroot_dir ⇒ Object
- #command_env ⇒ Object
-
#initialize(env, definition, version, release_tarball_path, os_image_tarball_path) ⇒ BuildEnvironment
constructor
A new instance of BuildEnvironment.
- #os_image_rspec_command ⇒ Object
- #prepare_build ⇒ Object
- #settings_path ⇒ Object
- #stemcell_disk_size ⇒ Object
- #stemcell_files ⇒ Object
- #stemcell_rspec_command ⇒ Object
- #stemcell_tarball_path ⇒ Object
- #work_path ⇒ Object
Constructor Details
#initialize(env, definition, version, release_tarball_path, os_image_tarball_path) ⇒ BuildEnvironment
Returns a new instance of BuildEnvironment.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bosh/stemcell/build_environment.rb', line 13 def initialize(env, definition, version, release_tarball_path, os_image_tarball_path) @environment = env @definition = definition @os_image_tarball_path = os_image_tarball_path @version = version @stemcell_builder_options = BuilderOptions.new( env: env, definition: definition, version: version, release_tarball: release_tarball_path, os_image_tarball: os_image_tarball_path, ) @shell = Bosh::Core::Shell.new end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
28 29 30 |
# File 'lib/bosh/stemcell/build_environment.rb', line 28 def version @version end |
Instance Method Details
#build_path ⇒ Object
65 66 67 |
# File 'lib/bosh/stemcell/build_environment.rb', line 65 def build_path File.join(build_root, 'build') end |
#chroot_dir ⇒ Object
76 77 78 |
# File 'lib/bosh/stemcell/build_environment.rb', line 76 def chroot_dir File.join(work_path, 'chroot') end |
#command_env ⇒ Object
96 97 98 |
# File 'lib/bosh/stemcell/build_environment.rb', line 96 def command_env "env #{hash_as_bash_env(proxy_settings_from_environment)}" end |
#os_image_rspec_command ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/bosh/stemcell/build_environment.rb', line 41 def os_image_rspec_command [ "cd #{STEMCELL_SPECS_DIR};", "OS_IMAGE=#{os_image_tarball_path}", "bundle exec rspec -fd#{exclude_arch_exclusions}", "spec/os_image/#{}_spec.rb", ].join(' ') end |
#prepare_build ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bosh/stemcell/build_environment.rb', line 30 def prepare_build if (ENV['resume_from'] == NIL) sanitize prepare_build_path end copy_stemcell_builder_to_build_path prepare_work_root prepare_stemcell_path persist_settings_for_bash end |
#settings_path ⇒ Object
80 81 82 |
# File 'lib/bosh/stemcell/build_environment.rb', line 80 def settings_path File.join(build_path, 'etc', 'settings.bash') end |
#stemcell_disk_size ⇒ Object
92 93 94 |
# File 'lib/bosh/stemcell/build_environment.rb', line 92 def stemcell_disk_size .image_create_disk_size end |
#stemcell_files ⇒ Object
69 70 71 72 73 74 |
# File 'lib/bosh/stemcell/build_environment.rb', line 69 def stemcell_files definition.disk_formats.map do |disk_format| stemcell_filename = Stemcell.new(@definition, 'bosh-stemcell', @version, disk_format) File.join(work_path, stemcell_filename.name) end end |
#stemcell_rspec_command ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/bosh/stemcell/build_environment.rb', line 50 def stemcell_rspec_command [ "cd #{STEMCELL_SPECS_DIR};", "STEMCELL_IMAGE=#{image_file_path}", "STEMCELL_WORKDIR=#{work_path}", "OS_NAME=#{.name}", "bundle exec rspec -fd#{exclude_exclusions}", "spec/os_image/#{}_spec.rb", "spec/stemcells/#{}_spec.rb", "spec/stemcells/#{agent.name}_agent_spec.rb", "spec/stemcells/#{infrastructure.name}_spec.rb", 'spec/stemcells/stig_spec.rb' ].join(' ') end |
#stemcell_tarball_path ⇒ Object
88 89 90 |
# File 'lib/bosh/stemcell/build_environment.rb', line 88 def stemcell_tarball_path work_path end |
#work_path ⇒ Object
84 85 86 |
# File 'lib/bosh/stemcell/build_environment.rb', line 84 def work_path File.join(work_root, 'work') end |