Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .bundle/config

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- name: test-bosh-stemcell
run: |
bundle install
bundle exec rspec
bundle exec rake
working-directory: bosh-stemcell/
Comment thread
coderabbitai[bot] marked this conversation as resolved.
55 changes: 0 additions & 55 deletions .rubocop.yml

This file was deleted.

12 changes: 2 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
source 'https://rubygems.org'

group :development, :test do
gem 'bosh-stemcell', path: 'bosh-stemcell'
gem 'fakefs'
gem 'logging'
gem 'rake'
gem 'rspec'
gem 'rspec-instafail'
gem 'rspec-its'
gem 'timecop'
end
gem 'rake'
gem 'bosh-stemcell', path: 'bosh-stemcell'
32 changes: 0 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,14 @@ PATH
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.6.2)
fakefs (3.2.1)
little-plugger (1.1.4)
logging (2.4.0)
little-plugger (~> 1.1)
multi_json (~> 1.14)
multi_json (1.20.0)
rake (13.3.1)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-instafail (1.0.0)
rspec
rspec-its (2.0.0)
rspec-core (>= 3.13.0)
rspec-expectations (>= 3.13.0)
rspec-mocks (3.13.8)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
timecop (0.9.10)

PLATFORMS
ruby

DEPENDENCIES
bosh-stemcell!
fakefs
logging
rake
rspec
rspec-instafail
rspec-its
timecop

BUNDLED WITH
2.5.23
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,17 @@ locally, run:
```shell
bundle install --local
cd /opt/bosh/bosh-stemcell
OS_IMAGE=/opt/bosh/tmp/ubuntu_base_image.tgz bundle exec rspec spec/ --tag shellout_types
```

If on macOS, run:

```shell
OSX=true OS_IMAGE=/opt/bosh/tmp/ubuntu_base_image.tgz bundle exec rspec spec/ --tag shellout_types
OS_IMAGE=/opt/bosh/tmp/ubuntu_base_image.tgz bundle exec rake spec:shellout_types
Comment thread
coderabbitai[bot] marked this conversation as resolved.
```

### How to run tests for BOSH Linux Stemcell Builder

The BOSH Linux Stemcell Builder code itself can be tested with the following command's:

```shell
bundle install --local
cd /opt/bosh/bosh-stemcell
bundle exec rspec spec/
bundle install
bundle exec rake
```

## Troubleshooting
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'json'
require 'logging'

namespace :stemcell do
desc 'Build a base OS image for use in stemcells'
Expand Down
63 changes: 0 additions & 63 deletions bosh-stemcell/.rubocop.yml

This file was deleted.

3 changes: 3 additions & 0 deletions bosh-stemcell/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gemspec
12 changes: 12 additions & 0 deletions bosh-stemcell/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require "rspec/core/rake_task"
require "standard/rake"

task default: [:standard, :spec]

RSpec::Core::RakeTask.new(:spec)

namespace :spec do
RSpec::Core::RakeTask.new(:shellout_types) do |t|
t.rspec_opts = "--tag shellout_types"
end
end
34 changes: 20 additions & 14 deletions bosh-stemcell/bosh-stemcell.gemspec
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# coding: utf-8
require File.expand_path('../lib/bosh/stemcell/version', __FILE__)
require File.expand_path("../lib/bosh/stemcell/version", __FILE__)

version = Bosh::Stemcell::VERSION

Gem::Specification.new do |spec|
spec.name = 'bosh-stemcell'
spec.version = version
spec.authors = 'Pivotal'
spec.email = 'support@cloudfoundry.com'
spec.description = 'Bosh::Stemcell provides tools to manage stemcells'
spec.summary = 'Bosh::Stemcell provides tools to manage stemcells'
spec.homepage = 'https://github.com/cloudfoundry/bosh'
spec.license = 'Apache 2.0'
spec.name = "bosh-stemcell"
spec.version = version
spec.authors = "Pivotal"
spec.email = "support@cloudfoundry.com"
spec.description = "Bosh::Stemcell provides tools to manage stemcells"
spec.summary = "Bosh::Stemcell provides tools to manage stemcells"
spec.homepage = "https://github.com/cloudfoundry/bosh"
spec.license = "Apache 2.0"

spec.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
spec.required_ruby_version = Gem::Requirement.new(">= 1.9.3")

spec.files = Dir['README.md', 'lib/**/*'].select{ |f| File.file? f }
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.files = Dir["README.md", "lib/**/*"].select { |f| File.file? f }
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = %w[lib]

spec.add_development_dependency "fakefs"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rspec-instafail"
spec.add_development_dependency "rspec-its"
spec.add_development_dependency "standard"
spec.add_development_dependency "timecop"
end
10 changes: 5 additions & 5 deletions bosh-stemcell/lib/bosh/core/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def run_command(command, options)
stdout.puts command if options[:output_command]
lines = []

if options[:env]
popen_args = if options[:env]
# Wrap in a shell because existing api to Shell#run takes a string
# which makes it really hard to pass it to popen with custom environment.
popen_args = [options[:env], ENV['SHELL'] || 'bash', '-c', command]
[options[:env], ENV["SHELL"] || "bash", "-c", command]
else
popen_args = command
command
end

io = IO.popen(popen_args)
Expand All @@ -50,7 +50,7 @@ def report(cmd, command_output, options)

redacted_cmd = cmd
if options[:redact]
redacted_cmd = redacted_cmd.gsub(/#{options[:redact].join('|')}/, "[REDACTED]")
redacted_cmd = redacted_cmd.gsub(/#{options[:redact].join("|")}/, "[REDACTED]")
end

err_msg = "Failed: '#{redacted_cmd}' from #{pwd}, with exit status #{$?.to_i}\n\n #{command_output}"
Expand All @@ -64,7 +64,7 @@ def command_exited_successfully?
def pwd
Dir.pwd
rescue Errno::ENOENT
'a deleted directory'
"a deleted directory"
end
end
end
4 changes: 2 additions & 2 deletions bosh-stemcell/lib/bosh/stemcell/arch.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module Bosh::Stemcell
class Arch
def self.arch
RbConfig::CONFIG['host_cpu']
RbConfig::CONFIG["host_cpu"]
end

def self.x86_64?
arch == 'x86_64'
arch == "x86_64"
end
end
end
24 changes: 12 additions & 12 deletions bosh-stemcell/lib/bosh/stemcell/archive.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'yaml'
require 'rake/file_utils_ext'
require 'bosh/stemcell/aws/region'
require "yaml"
require "rake/file_utils_ext"
require "bosh/stemcell/aws/region"

module Bosh::Stemcell
class Archive
attr_reader :path

def initialize(path = '')
def initialize(path = "")
@path = path
validate_stemcell
end
Expand All @@ -16,25 +16,25 @@ def manifest
end

def name
manifest.fetch('name')
manifest.fetch("name")
end

def infrastructure
cloud_properties.fetch('infrastructure')
cloud_properties.fetch("infrastructure")
end

def version
cloud_properties.fetch('version')
cloud_properties.fetch("version")
end

def sha1
sha1 = manifest.fetch('sha1')
raise 'sha1 must not be nil' unless sha1
sha1 = manifest.fetch("sha1")
raise "sha1 must not be nil" unless sha1
sha1.to_s
end

def light?
infrastructure == 'aws' && has_ami?
infrastructure == "aws" && has_ami?
end

def extract(tar_options = {}, &block)
Expand All @@ -51,11 +51,11 @@ def extract(tar_options = {}, &block)
private

def has_ami?
cloud_properties.has_key? 'ami'
cloud_properties.has_key? "ami"
end

def cloud_properties
manifest.fetch('cloud_properties')
manifest.fetch("cloud_properties")
end

def validate_stemcell
Expand Down
Loading
Loading