diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a6ed44..3e3a9b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ Bootstrap script should install latest ChefDK available by default * Fix [#142](https://github.com/Nordstrom/chefdk_bootstrap/issues/142) Add fix_profile and remove posh-git install for kitchen tests to avoid hanging +* Fix [#143](https://github.com/Nordstrom/chefdk_bootstrap/issues/143) + Remove support of custom cookbooks and private supermarkets * Add Appveyor for windows integration testing * Add version as a named parameter diff --git a/README.md b/README.md index 8c42ecc..12e4ec6 100644 --- a/README.md +++ b/README.md @@ -110,19 +110,8 @@ ruby -e "$(curl https://raw.githubusercontent.com/Nordstrom/chefdk_bootstrap/mas ``` ### Custom cookbook -#### Windows - -```PowerShell -Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/Nordstrom/chefdk_bootstrap/master/bootstrap.ps1 | Invoke-Expression - -install -cookbook -berks_source -``` - -#### Mac -```bash -ruby -e "$(curl https://raw.githubusercontent.com/Nordstrom/chefdk_bootstrap/master/bootstrap.rb)" - --cookbook --berks-source -``` +Deprecated. If you would like to use a custom cookbook, please use an earlier version of ChefDK_bootstrap. ### ChefDK Version You can specify the version of chefdk to install as a named parameter in the bootstrap script. By default, the bootstrap script will install the latest version of chefdk. The script will not re-install chefdk if the target version is already installed. diff --git a/bootstrap.ps1 b/bootstrap.ps1 index 5e89b7e..f125939 100644 --- a/bootstrap.ps1 +++ b/bootstrap.ps1 @@ -31,10 +31,7 @@ function die { function Install-Project { Param( [string] $version, - [string] $cookbook, [string] $json_attributes, - [string] $berks_source, - [string] $branch ) if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(` @@ -64,17 +61,6 @@ function Install-Project { } $bootstrapCookbook = 'chefdk_bootstrap' - if ($cookbook) { - $bootstrapCookbook = $cookbook - } - - if ($berks_source) { - $privateSource = "source '$berks_source'" - } - - if ($branch) { - $devbranch = ", github: 'Nordstrom/chefdk_bootstrap', branch: '$branch'" - } $userChefDir = Join-Path -path $env:USERPROFILE -childPath 'chef' $dotChefDKDir = Join-Path -path $env:LOCALAPPDATA -childPath 'chefdk' @@ -89,9 +75,8 @@ function Install-Project { $berksfile = @" source 'https://supermarket.chef.io' - $privateSource - cookbook '$bootstrapCookbook'$devbranch + cookbook '$bootstrapCookbook' "@ $chefConfig = @" @@ -103,7 +88,7 @@ function Install-Project { ### This bootstrap script will: 1. Install the ChefDK version $targetChefDk. - 2. Download the $bootstrapCookbook cookbook via Berkshelf $privateSource + 2. Download the $bootstrapCookbook cookbook via Berkshelf 3. Run chef-client to install the rest of the tools you'll need. "@ diff --git a/bootstrap.rb b/bootstrap.rb index cc7844c..3aa0af6 100755 --- a/bootstrap.rb +++ b/bootstrap.rb @@ -44,14 +44,6 @@ def parse executable_name = File.basename($PROGRAM_NAME) opts.banner = "Usage: #{executable_name} [options]" - opts.on('-c', '--cookbook COOKBOOK', 'Enter your custom ChefDK_bootstrap wrapper cookbook name.') do |v| - options[:cookbook] = v - end - - opts.on('-b', '--berks-source BSOURCE_URL', 'Enter your private supermarket URL.') do |v| - options[:berks_source] = v - end - opts.on('-j', '--json-attributes JSON_ATTRIBUTES', 'Enter your URL/path to the JSON file containing your JSON attributes.') do |v| options[:json_attributes] = v end @@ -81,7 +73,6 @@ class Berksfile # * :berks_source [String] private supermarket URL # * :json_attributes [String] URL/path to the JSON file def initialize(options) - @berks_source = options[:berks_source] @cookbook = options[:cookbook] || 'chefdk_bootstrap' end @@ -90,11 +81,9 @@ def initialize(options) # @return [File] berksfile object def create @tempdir = Dir.mktmpdir('chefdk_bootstrap-') - private_source = "source '#{@berks_source}'" if @berks_source berksfile_content = <<-EOH.gsub(/^\s+/, '') source 'https://supermarket.chef.io' - #{private_source} cookbook '#{@cookbook}' EOH diff --git a/metadata.rb b/metadata.rb index deb3202..da719a1 100644 --- a/metadata.rb +++ b/metadata.rb @@ -18,7 +18,7 @@ maintainer_email 'techcheftm@nordstrom.com' license 'Apache 2.0' description 'Bootstrap a developer workstation for local Chef development using the ChefDK' -version '1.9.0' +version '2.0.0' supports 'windows' supports 'mac_os_x' diff --git a/recipes/conemu.rb b/recipes/conemu.rb index 7f2d94e..e7da7aa 100644 --- a/recipes/conemu.rb +++ b/recipes/conemu.rb @@ -18,4 +18,5 @@ # installation script and we don't want to touch it not_if '(& "C:\Program Files\ConEmu\ConEmu\ConEmuC.exe" /IsConEmu); $LASTEXITCODE -eq 1' guard_interpreter :powershell_script + options '--allow-empty-checksums' end diff --git a/recipes/git.rb b/recipes/git.rb index eb006c7..0e8abce 100644 --- a/recipes/git.rb +++ b/recipes/git.rb @@ -16,8 +16,12 @@ case node['platform_family'] when 'windows' # chocolatey_package %w(git git-credential-manager-for-windows poshgit) - chocolatey_package 'git' - chocolatey_package 'git-credential-manager-for-windows' + chocolatey_package 'git' do + options '--allow-empty-checksums' + end + chocolatey_package 'git-credential-manager-for-windows' do + options '--allow-empty-checksums' + end # chocolatey_package 'poshgit' when 'mac_os_x' package 'git' diff --git a/recipes/gitextensions.rb b/recipes/gitextensions.rb index 81811c9..51dab56 100644 --- a/recipes/gitextensions.rb +++ b/recipes/gitextensions.rb @@ -13,4 +13,6 @@ # limitations under the License. # -chocolatey_package 'gitextensions' +chocolatey_package 'gitextensions' do + options '--allow-empty-checksums' +end diff --git a/recipes/kdiff3.rb b/recipes/kdiff3.rb index b6f9c89..abee17f 100644 --- a/recipes/kdiff3.rb +++ b/recipes/kdiff3.rb @@ -13,4 +13,6 @@ # limitations under the License. # -chocolatey_package 'kdiff3' +chocolatey_package 'kdiff3' do + options '--allow-empty-checksums' +end diff --git a/recipes/poshgit.rb b/recipes/poshgit.rb index 73a6e33..d3d036f 100644 --- a/recipes/poshgit.rb +++ b/recipes/poshgit.rb @@ -13,4 +13,6 @@ # limitations under the License. # -chocolatey_package 'poshgit' +chocolatey_package 'poshgit' do + options '--allow-empty-checksums' +end diff --git a/recipes/virtualbox.rb b/recipes/virtualbox.rb index 966b402..c254a66 100644 --- a/recipes/virtualbox.rb +++ b/recipes/virtualbox.rb @@ -15,7 +15,9 @@ case node['platform_family'] when 'windows' - chocolatey_package 'virtualbox' + chocolatey_package 'virtualbox' do + options '--allow-empty-checksums' + end when 'mac_os_x' dmg_package 'Virtualbox' do source node['chefdk_bootstrap']['virtualbox']['source'] diff --git a/spec/unit/bootstrap_spec.rb b/spec/unit/bootstrap_spec.rb index 6105867..10c1ff3 100644 --- a/spec/unit/bootstrap_spec.rb +++ b/spec/unit/bootstrap_spec.rb @@ -30,13 +30,12 @@ context 'long options' do let(:arguments) do - %w(--cookbook your_cookbook --berks-source https://supermarket.chef.io --json-attributes http://server/attributes.json --version 0.14.25) + %w(--json-attributes http://server/attributes.json --version 0.14.25) end it 'all long options specified' do options = { - cookbook: 'your_cookbook', - berks_source: 'https://supermarket.chef.io', + cookbook: 'chefdk_bootstrap', json_attributes: 'http://server/attributes.json', version: '0.14.25' } @@ -45,13 +44,12 @@ end context 'short options' do - let(:arguments) { %w(-c your_cookbook -b https://supermarket.chef.io -j http://server/attributes.json -v 0.14.25) } + let(:arguments) { %w(-j http://server/attributes.json -v 0.14.25) } it 'all short options specified' do options = { - cookbook: 'your_cookbook', - berks_source: 'https://supermarket.chef.io', + cookbook: 'chefdk_bootstrap', json_attributes: 'http://server/attributes.json', version: '0.14.25' } @@ -73,33 +71,6 @@ .to include("cookbook 'chefdk_bootstrap'") .and include("source 'https://supermarket.chef.io'") end - - it 'creates berksfile with custom berksfile source' do - options[:berks_source] = 'http://chef.example.com' - berksfile.create - expect(File.read(berksfile.path)) - .to include("cookbook 'chefdk_bootstrap'") - .and include("source 'https://supermarket.chef.io'") - .and include("source 'http://chef.example.com'") - end - - it 'creates berksfile with custom cookbook' do - options[:cookbook] = 'my_cookbook' - berksfile.create - expect(File.read(berksfile.path)) - .to include("cookbook 'my_cookbook'") - .and include("source 'https://supermarket.chef.io'") - end - - it 'creates berksfile with custom cookbook and custom berksfile source' do - options[:cookbook] = 'my_cookbook2' - options[:berks_source] = 'http://chef.example2.com' - berksfile.create - expect(File.read(berksfile.path)) - .to include("cookbook 'my_cookbook2'") - .and include("source 'https://supermarket.chef.io'") - .and include("source 'http://chef.example2.com'") - end end describe '#delete' do