class Bosh::Stemcell::BuildEnvironment

Constants

STEMCELL_BUILDER_SOURCE_DIR
STEMCELL_SPECS_DIR

Attributes

definition[R]
environment[R]
os_image_tarball_path[R]
shell[R]
stemcell_builder_options[R]
version[R]

Public Class Methods

new(env, definition, version, release_tarball_path, os_image_tarball_path) click to toggle source
# 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

Public Instance Methods

build_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 66
def build_path
  File.join(build_root, 'build')
end
chroot_dir() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 77
def chroot_dir
  File.join(work_path, 'chroot')
end
command_env() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 97
def command_env
  "env #{hash_as_bash_env(proxy_settings_from_environment)}"
end
os_image_rspec_command() click to toggle source
# 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/#{operating_system_spec_name}_spec.rb",
  ].join(' ')
end
prepare_build() click to toggle source
# 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() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 81
def settings_path
  File.join(build_path, 'etc', 'settings.bash')
end
stemcell_disk_size() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 93
def stemcell_disk_size
  stemcell_builder_options.image_create_disk_size
end
stemcell_files() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 70
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() click to toggle source
# 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=#{operating_system.name}",
    "bundle exec rspec -fd#{exclude_exclusions}",
    "spec/os_image/#{operating_system_spec_name}_spec.rb",
    "spec/stemcells/#{operating_system_spec_name}_spec.rb",
    "spec/stemcells/#{agent.name}_agent_spec.rb",
    "spec/stemcells/#{infrastructure.name}_spec.rb",
    'spec/stemcells/stig_spec.rb',
    'spec/stemcells/cis_spec.rb'
  ].join(' ')
end
stemcell_tarball_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 89
def stemcell_tarball_path
  work_path
end
work_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 85
def work_path
  File.join(work_root, 'work')
end