diff --git a/app/models/shipit/deploy_spec/bundler_discovery.rb b/app/models/shipit/deploy_spec/bundler_discovery.rb index 0312935bc..7f077fcee 100644 --- a/app/models/shipit/deploy_spec/bundler_discovery.rb +++ b/app/models/shipit/deploy_spec/bundler_discovery.rb @@ -26,9 +26,14 @@ def discover_machine_env end def bundle_install - bundle = %(bundle install #{frozen_flag} --jobs 4 --path #{bundle_path} --retry 2) + freeze_config = if frozen? + %(bundle config set frozen true) + else + %(bundle config set frozen false) + end + bundle = %(bundle install --jobs 4 --path #{bundle_path} --retry 2) bundle += " --without=#{bundler_without.join(':')}" unless bundler_without.empty? - [remove_ruby_version_from_gemfile, bundle] + [remove_ruby_version_from_gemfile, freeze_config, bundle] end def remove_ruby_version_from_gemfile @@ -41,11 +46,11 @@ def remove_ruby_version_from_gemfile end end - def frozen_flag - return unless gemfile_lock_exists? - return if config('dependencies', 'bundler', 'frozen') == false + def frozen? + return false unless gemfile_lock_exists? + return false if config('dependencies', 'bundler', 'frozen') == false - '--frozen' + true end def bundler_without diff --git a/test/dummy/db/seeds.rb b/test/dummy/db/seeds.rb index cbcd69908..4bc195174 100644 --- a/test/dummy/db/seeds.rb +++ b/test/dummy/db/seeds.rb @@ -53,7 +53,7 @@ module Shipit ] }, "override": [ - "bundle check --path=/tmp/bundler || bundle install --frozen --path=/tmp/bundler --retry=2 --without=default:production:development:test:staging:benchmark:debug" + "bundle check --path=/tmp/bundler || bundle install --path=/tmp/bundler --retry=2 --without=default:production:development:test:staging:benchmark:debug" ] }, "fetch": [ diff --git a/test/models/deploy_spec_test.rb b/test/models/deploy_spec_test.rb index 06c5a996d..dfab6b52a 100644 --- a/test/models/deploy_spec_test.rb +++ b/test/models/deploy_spec_test.rb @@ -67,7 +67,6 @@ class DeploySpecTest < ActiveSupport::TestCase @spec.stubs(:gemfile_lock_exists?).returns(true) command = %( bundle install - --frozen --jobs 4 --path #{DeploySpec.bundle_path} --retry 2 @@ -81,7 +80,6 @@ class DeploySpecTest < ActiveSupport::TestCase @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } }) command = %( bundle install - --frozen --jobs 4 --path #{DeploySpec.bundle_path} --retry 2 @@ -90,22 +88,22 @@ class DeploySpecTest < ActiveSupport::TestCase assert_equal command, @spec.bundle_install.last end - test '#bundle_install has --frozen option if Gemfile.lock is present' do + test '#bundle_install has frozen option if Gemfile.lock is present' do @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } }) @spec.stubs(:gemfile_lock_exists?).returns(true) - assert @spec.bundle_install.last.include?('--frozen') + assert @spec.bundle_install.any?.include?('bundle config set frozen true') end - test '#bundle_install does not have --frozen option if Gemfile.lock is not present' do + test '#bundle_install does not set frozen option if Gemfile.lock is not present' do @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'without' => %w[some custom groups] } }) @spec.stubs(:gemfile_lock_exists?).returns(false) - refute @spec.bundle_install.last.include?('--frozen') + assert @spec.bundle_install.any?.include?('bundle config set frozen false') end - test '#bundle_install does not have --frozen if overridden in shipit.yml' do + test '#bundle_install does not have frozen if overridden in shipit.yml' do @spec.stubs(:load_config).returns('dependencies' => { 'bundler' => { 'frozen' => false } }) @spec.stubs(:gemfile_lock_exists?).returns(true) - refute @spec.bundle_install.last.include?('--frozen') + assert @spec.bundle_install.any?.include?('bundle config set frozen false') end test "#provisioning_handler returns `provision.handler` if present" do