Skip to content

Commit

Permalink
Don't update fips serverspec Gemfile.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeiser committed Apr 18, 2016
1 parent 9971604 commit 4ac5018
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 38 deletions.
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@ group(:linux, :bsd, :mac_os_x, :solaris, :windows) do
# may need to disable this in insolation on fussy builds like AIX, RHEL4, etc
gem "ruby-prof"
end
unless $chef_platform == "windows"
# Everything except AIX and Windows
group(:linux, :bsd, :mac_os_x, :solaris) do
gem "ruby-shadow"
end
# Everything except AIX and Windows
group(:linux, :bsd, :mac_os_x, :solaris) do
gem "ruby-shadow"
end

group(:development, :test) do
Expand Down
13 changes: 0 additions & 13 deletions acceptance/fips/test/integration/fips/serverspec/Gemfile.lock

This file was deleted.

10 changes: 5 additions & 5 deletions omnibus/config/software/chef.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@
require_relative "../../files/chef/build-chef"
extend BuildChef

chef_build_env = env.dup
chef_build_env["BUNDLE_GEMFILE"] = chef_gemfile
project_env = env.dup
project_env["BUNDLE_GEMFILE"] = project_gemfile

# Prepare to install: build config, retries, job, frozen=true
# TODO Windows install seems to sometimes install already-installed gems such
# as gherkin (and fail as a result) if you use jobs > 1.
create_bundle_config(chef_gemfile, retries: 4, jobs: windows? ? 1 : 7, frozen: true)
create_bundle_config(project_gemfile, retries: 4, jobs: windows? ? 1 : 7, frozen: true)

# Install all the things. Arguments are specified in .bundle/config (see create_bundle_config)
block { log.info(log_key) { "" } }
bundle "install --verbose", env: chef_build_env
bundle "install --verbose", env: project_env

# For whatever reason, nokogiri software def deletes this (rather small) directory
block { log.info(log_key) { "" } }
Expand All @@ -78,7 +78,7 @@

# Check that it worked
block { log.info(log_key) { "" } }
bundle "check", env: chef_build_env
bundle "check", env: project_env

# fix up git-sourced gems
properly_reinstall_git_and_path_sourced_gems
Expand Down
2 changes: 1 addition & 1 deletion omnibus/files/chef-appbundle/build-chef-appbundle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def lockdown_gem(gem_name)
# appbundler against the resulting file.
#
# Relocks the Gemfiles inside the specified gems (e.g. berkshelf, test-kitchen,
# chef) to use the chef distribution's chosen gems.
# chef) to use the distribution's chosen gems.
def appbundle_gem(gem_name)
# First lock the gemfile down.
lockdown_gem(gem_name)
Expand Down
2 changes: 1 addition & 1 deletion omnibus/files/chef-gem/build-chef-gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative "../../../version_policy"

# Common definitions and helpers (like compile environment and binary
# locations) for all chef software definitions.
# locations) for all software definitions.
module BuildChefGem
PLATFORM_FAMILY_FAMILIES = {
"linux" => %w{wrlinux debian fedora rhel suse gentoo slackware arch exherbo alpine},
Expand Down
18 changes: 9 additions & 9 deletions omnibus/files/chef/build-chef.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def create_bundle_config(gemfile, without: without_groups, retries: nil, jobs: n
#
# Get the (possibly platform-specific) path to the Gemfile.
#
def chef_gemfile
def project_gemfile
File.join(project_dir, "Gemfile")
end

Expand All @@ -41,12 +41,12 @@ def chef_gemfile
# then delete the git cached versions.
#
# Once we finish with all this, we update the Gemfile that will end up in the
# chef so that it doesn't have git or path references anymore.
# top-level install so that it doesn't have git or path references anymore.
#
def properly_reinstall_git_and_path_sourced_gems
# Emit blank line to separate different tasks
block { log.info(log_key) { "" } }
chef_env = env.dup.merge("BUNDLE_GEMFILE" => chef_gemfile)
project_env = env.dup.merge("BUNDLE_GEMFILE" => project_gemfile)

# Reinstall git-sourced or path-sourced gems, and delete the originals
block "Reinstall git-sourced gems properly" do
Expand All @@ -59,7 +59,7 @@ def properly_reinstall_git_and_path_sourced_gems
# or `gem :x, path: '.'` or `gemspec`). To do this, we just detect which ones
# have properly-installed paths (in the `gems` directory that shows up when
# you run `gem list`).
locally_installed_gems = shellout!("#{bundle_bin} list --paths", env: chef_env, cwd: project_dir).
locally_installed_gems = shellout!("#{bundle_bin} list --paths", env: project_env, cwd: project_dir).
stdout.lines.select { |gem_path| !gem_path.start_with?(gem_install_dir) }

# Install the gems for real using `rake install` in their directories
Expand All @@ -70,7 +70,7 @@ def properly_reinstall_git_and_path_sourced_gems
# Emit blank line to separate different tasks
log.info(log_key) { "" }
log.info(log_key) { "Properly installing git or path sourced gem #{gem_path} using rake install" }
shellout!("#{bundle_bin} exec #{rake_bin} install", env: chef_env, cwd: gem_path)
shellout!("#{bundle_bin} exec #{rake_bin} install", env: project_env, cwd: gem_path)
end
end
end
Expand All @@ -80,16 +80,16 @@ def install_shared_gemfile
block { log.info(log_key) { "" } }

shared_gemfile = self.shared_gemfile
chef_env = env.dup.merge("BUNDLE_GEMFILE" => chef_gemfile)
project_env = env.dup.merge("BUNDLE_GEMFILE" => project_gemfile)

# Show the config for good measure
bundle "config", env: chef_env
bundle "config", env: project_env

# Make `Gemfile` point to these by removing path and git sources and pinning versions.
block "Rewrite Gemfile using all properly-installed gems" do
gem_pins = ""
result = []
shellout!("#{bundle_bin} list", env: chef_env).stdout.lines.map do |line|
shellout!("#{bundle_bin} list", env: project_env).stdout.lines.map do |line|
if line =~ /^\s*\*\s*(\S+)\s+\((\S+).*\)\s*$/
name, version = $1, $2
# rubocop is an exception, since different projects disagree
Expand All @@ -99,7 +99,7 @@ def install_shared_gemfile
end

# Find the installed chef gem by looking for lib/chef.rb
chef_gem = File.expand_path("../..", shellout!("#{gem_bin} which chef", env: chef_env).stdout.chomp)
chef_gem = File.expand_path("../..", shellout!("#{gem_bin} which chef", env: project_env).stdout.chomp)
# Figure out the path to gemfile_util from there
gemfile_util = Pathname.new(File.join(chef_gem, "tasks", "gemfile_util"))
gemfile_util = gemfile_util.relative_path_from(Pathname.new(shared_gemfile).dirname)
Expand Down
6 changes: 2 additions & 4 deletions tasks/dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@ def berksfile_lock_task(task_name, dirs: [])
end

gemfile_lock_task :update_omnibus_gemfile_lock, dirs: %w{omnibus}
gemfile_lock_task :update_acceptance_gemfile_lock, dirs: %w{
acceptance
acceptance/fips/test/integration/fips/serverspec
}, other_platforms: false, leave_frozen: false
gemfile_lock_task :update_acceptance_gemfile_lock, dirs: %w{acceptance},
other_platforms: false, leave_frozen: false
gemfile_lock_task :update_kitchen_tests_gemfile_lock, dirs: %w{
kitchen-tests
kitchen-tests/test/integration/webapp/serverspec
Expand Down

0 comments on commit 4ac5018

Please sign in to comment.