Last active
June 5, 2020 18:48
-
-
Save amaltson/f763531bb2689ad311ed to your computer and use it in GitHub Desktop.
Kitchen.yml for Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
driver: | |
name: vagrant | |
provisioner: | |
name: chef_zero | |
platforms: | |
- name: windows-7 | |
transport: | |
name: winrm | |
driver: | |
guest: :windows | |
box: windows-7-test-kitchen | |
box_url: http://internal-url | |
winrm: | |
username: <some username> | |
password: <some password> | |
gui: true | |
suites: | |
- name: default | |
run_list: | |
- recipe[some-recipes] | |
attributes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
group :development do | |
# ChefDK | |
gem 'berkshelf', '3.1.3' | |
gem 'nokogiri', '1.6.4.1' | |
gem 'pry', '~> 0.10.1' | |
end | |
group :test do | |
# ChefDK | |
gem 'chefspec', '4.0.1' | |
gem 'foodcritic', '4.0.0' | |
gem 'test-kitchen', git: 'https://github.com/mwrock/test-kitchen', branch: 'WinRM' | |
gem 'kitchen-vagrant', git: 'https://github.com/afiune/kitchen-vagrant', branch: 'WinRM' | |
gem 'kitchen-docker', '~> 1.5' | |
gem 'rake', '~> 10.3' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
==> default: Importing base box 'windows-7-test-kitchen'... | |
==> default: Matching MAC address for NAT networking... | |
==> default: Setting the name of the VM: test_default_1422970648952_22381 | |
==> default: Fixed port collision for 5985 => 55985. Now on port 2200. | |
==> default: Clearing any previously set network interfaces... | |
==> default: Preparing network interfaces based on configuration... | |
default: Adapter 1: nat | |
==> default: Forwarding ports... | |
default: 5985 => 2200 (adapter 1) | |
==> default: Booting VM... | |
==> default: Waiting for machine to boot. This may take a few minutes... | |
==> default: Machine booted and ready! | |
==> default: Checking for guest additions in VM... | |
==> default: Mounting shared folders... | |
default: /vagrant => /Users/arthur/vms/test | |
==> default: Running provisioner: shell... | |
default: Running: inline PowerShell script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the Vagrantfile that 'vagrant package' made that's bundled with the Vagrant box | |
Vagrant::Config.run do |config| | |
# This Vagrantfile is auto-generated by `vagrant package` to contain | |
# the MAC address of the box. Custom configuration should be placed in | |
# the actual `Vagrantfile` in this box. | |
config.vm.base_mac = "0800275297C3" | |
end | |
# Load include vagrant file if it exists after the auto-generated | |
# so it can override any of the settings | |
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__) | |
load include_vagrantfile if File.exist?(include_vagrantfile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "windows-7-test-kitchen" | |
config.vm.guest = :windows | |
config.vm.communicator = "winrm" | |
config.vm.base_mac = "080027527704" | |
config.vm.provider "virtualbox" do |v| | |
v.gui = true | |
end | |
config.winrm.username = "<account>" | |
config.winrm.password = "<password>" | |
config.vm.provision "shell", inline: '"Hello World" | Out-File C:\chef.txt' | |
end |
Thanks again @mwrock, the missing bits for me was which specific Git branches to use as the custom test-kitchen and kitchen-vagrant gems to use.
Nevermind, I've gotten further now by providing my own vagrantfile_erb
, it can successfully kitchen create
, but now it's failing on the converge:
$ bundle exec kitchen converge
-----> Starting Kitchen (v1.3.2.dev)
-----> Converging <default-windows-7>...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 3.1.3...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [[Kitchen::Transport::Winrm] WinRM::WinRMAuthorizationError using shell: [powershell] and command: [ $ProgressPreference='SilentlyContinue'; if (-Not (Test-Path "/tmp/kitchen")) {
mkdir "/tmp/kitchen" | Out-Null
}
if ( Test-Path '/tmp/kitchen/data' ) { rm -r '/tmp/kitchen/data' };if ( Test-Path '/tmp/kitchen/data_bags' ) { rm -r '/tmp/kitchen/data_bags' };if ( Test-Path '/tmp/kitchen/environments' ) { rm -r '/tmp/kitchen/environments' };if ( Test-Path '/tmp/kitchen/roles' ) { rm -r '/tmp/kitchen/roles' };if ( Test-Path '/tmp/kitchen/clients' ) { rm -r '/tmp/kitchen/clients' };
if (-Not (Test-Path "/tmp/kitchen")) {
mkdir "/tmp/kitchen" | Out-Null
}
if ( Test-Path '/tmp/kitchen/data' ) { rm -r '/tmp/kitchen/data' };if ( Test-Path '/tmp/kitchen/data_bags' ) { rm -r '/tmp/kitchen/data_bags' };if ( Test-Path '/tmp/kitchen/environments' ) { rm -r '/tmp/kitchen/environments' };if ( Test-Path '/tmp/kitchen/roles' ) { rm -r '/tmp/kitchen/roles' };if ( Test-Path '/tmp/kitchen/clients' ) { rm -r '/tmp/kitchen/clients' };
if (-Not (Test-Path "/tmp/kitchen")) {
mkdir "/tmp/kitchen" | Out-Null
}
if ( Test-Path '/tmp/kitchen/data' ) { rm -r '/tmp/kitchen/data' };if ( Test-Path '/tmp/kitchen/data_bags' ) { rm -r '/tmp/kitchen/data_bags' };if ( Test-Path '/tmp/kitchen/environments' ) { rm -r '/tmp/kitchen/environments' };if ( Test-Path '/tmp/kitchen/roles' ) { rm -r '/tmp/kitchen/roles' };if ( Test-Path '/tmp/kitchen/clients' ) { rm -r '/tmp/kitchen/clients' };
if (-Not (Test-Path "/tmp/kitchen")) {
mkdir "/tmp/kitchen" | Out-Null
}
if ( Test-Path '/tmp/kitchen/data' ) { rm -r '/tmp/kitchen/data' };if ( Test-Path '/tmp/kitchen/data_bags' ) { rm -r '/tmp/kitchen/data_bags' };if ( Test-Path '/tmp/kitchen/environments' ) { rm -r '/tmp/kitchen/environments' };if ( Test-Path '/tmp/kitchen/roles' ) { rm -r '/tmp/kitchen/roles' };if ( Test-Path '/tmp/kitchen/clients' ) { rm -r '/tmp/kitchen/clients' };
if (-Not (Test-Path "/tmp/kitchen")) {
mkdir "/tmp/kitchen" | Out-Null
}
if ( Test-Path '/tmp/kitchen/data' ) { rm -r '/tmp/kitchen/data' };if ( Test-Path '/tmp/kitchen/data_bags' ) { rm -r '/tmp/kitchen/data_bags' };if ( Test-Path '/tmp/kitchen/environments' ) { rm -r '/tmp/kitchen/environments' };if ( Test-Path '/tmp/kitchen/roles' ) { rm -r '/tmp/kitchen/roles' };if ( Test-Path '/tmp/kitchen/clients' ) { rm -r '/tmp/kitchen/clients' };
if (-Not (Test-Path "/tmp/kitchen")) {
mkdir "/tmp/kitchen" | Out-Null
}
if ( Test-Path '/tmp/kitchen/data' ) { rm -r '/tmp/kitchen/data' };if ( Test-Path '/tmp/kitchen/data_bags' ) { rm -r '/tmp/kitchen/data_bags' };if ( Test-Path '/tmp/kitchen/environments' ) { rm -r '/tmp/kitchen/environments' };if ( Test-Path '/tmp/kitchen/roles' ) { rm -r '/tmp/kitchen/roles' };if ( Test-Path '/tmp/kitchen/clients' ) { rm -r '/tmp/kitchen/clients' };]]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
I got the exact same error when using Vagrant 1.7.2. kitchen create works fine, but converge fails. I downgraded to Vagrant 1.6.3 and the issue didn't seem to manifest anymore.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lots has changed here. This is the best way to make sure you have the latest good bits:
Here is how I build my vagrant workstation and our build agents:
As for the kitchen-Vagrant driver, get it from https://github.com/afiune/kitchen-vagrant - the
Transport
branch