diff --git a/ReadMe.md b/ReadMe.md index 50f877a..c9c49e3 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -30,9 +30,8 @@ You need a computer with: ## Setup To get started, ensure you have the following installed: - * Vagrant 1.8.1+ - linked clones is the huge reason here. You can technically use any version of Vagrant 1.3.5+. But you will get the best performance with 1.8.x+. It appears you can go up to Vagrant 2.1.5, but may have some issues with 2.2.2 and Windows guests (newer versions may be fine). - * Virtualbox 4.3.28+ - 5.2.20 (this flows in the selection of Vagrant - 5.2.22 seems to have some issues but newer versions may work fine) - * vagrant sahara plugin (`vagrant plugin install sahara`) + * Vagrant 2.1+ - linked clones is the huge reason here. You can technically use any version of Vagrant 1.3.5+. But you will get the best performance with 2.1.x. + * VirtualBox 5.2+ **NOTE:** If you decide to run with version 1.8.1 of Vagrant, you are going to need to set the `VAGRANT_SERVER_URL` environment variable as described in this [forum post](https://groups.google.com/forum/#!msg/vagrant-up/H8C68UTkosU/qz4YUmAgBAAJ), otherwise, you will get an HTTP 404 error when attempting to download the base vagrant box used here. @@ -49,7 +48,7 @@ To get started, ensure you have the following installed: 1. Run `vagrant up` to prepare the machine for testing. * **Note** due to the way that vagrant works, the first time that you run this command, the vagrant box named __ferventcoder/win2012r2-x64-nocm__ needs to be downloaded from the [Atlas website](https://atlas.hashicorp.com/ferventcoder/boxes/win2012r2-x64-nocm). This will take quite a while, and should only be attempted on a reasonably fast connection, that doesn't have any download limit restrictions. Once it has downloaded it will import the box and apply the scripts and configurations to the box as listed inside the `Vagrantfile`. You can find the downloaded box in the `~/.vagrant.d` or `c:\users\username\.vagrant.d` folder. 1. Now the box is ready for you to start testing against. - 1. Run the following command: `vagrant sandbox on`. This takes a snapshot of the VM using the [vagrant plugin](https://github.com/jedi4ever/sahara) that was installed earlier. This means that after testing packages, the VM can be returned to this known "good" state. + 1. Run the following command: `vagrant snapshot save good`. This takes a snapshot of the VM using the built-in snapshot functionality. This means that after testing packages, the VM can be returned to this known "good" state. ### Testing a Package @@ -62,11 +61,11 @@ For testing a package, you have two avenues. For a locally built package, you ca ### Make Changes and Retest -When you need to investigate making changes and rerunning the tests, remember that we took a snapshot of the vagrant machine (the virtual machine), so we can rollback to the earlier state each time and move forward with testing changes without the possibility of lingering artifacts. This is why we are using the sahara vagrant plugin, it allows us to take a snapshot and then revert the virtual machine back to the previous state. +When you need to investigate making changes and rerunning the tests, remember that we took a snapshot of the vagrant machine (the virtual machine), so we can rollback to the earlier state each time and move forward with testing changes without the possibility of lingering artifacts. This is why we are using the `vagrant snapshot` command, it allows us to take a snapshot and then revert the virtual machine back to the previous state. When you are ready to reset to the state just before installing: - 1. Run `vagrant sandbox rollback` + 1. Run `vagrant snapshot restore good --no-provision` 1. Follow the steps in testing a package (previous section). ### Tearing Down the Testing Environment diff --git a/Vagrantfile b/Vagrantfile index eb398db..7bd8f7e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,9 +12,7 @@ end # http://docs.vagrantup.com/v2/vagrantfile/machine_settings.html Vagrant.configure("2") do |config| - # This setting will download the atlas box at - # https://atlas.hashicorp.com/ferventcoder/boxes/win2012r2-x64-nocm - config.vm.box = "ferventcoder/win2012r2-x64-nocm" + config.vm.box = "BasicTheProgram/windows_2016" # http://docs.vagrantup.com/v2/providers/configuration.html # http://docs.vagrantup.com/v2/virtualbox/configuration.html @@ -29,7 +27,7 @@ Vagrant.configure("2") do |config| v.customize ["modifyvm", :id, "--vram", 32] # For better DNS resolution v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] - # No audo + # No audio v.customize ["modifyvm", :id, "--audio", "none"] # Clipboard enabled v.customize ["modifyvm", :id, "--clipboard", "bidirectional"] @@ -38,6 +36,8 @@ Vagrant.configure("2") do |config| v.customize ["modifyvm", :id, "--usb", "off"] # Huge performance gain here v.linked_clone = true if Vagrant::VERSION >= '1.8.0' + # virtualbox name + v.name = "chocolatey_test_environment_windows_2016" end # https://www.vagrantup.com/docs/hyperv/configuration.html @@ -81,6 +81,12 @@ Vagrant.configure("2") do |config| config.vm.communicator = "winrm" end + if Vagrant::VERSION >= '1.1.0' + # https://github.com/dotless-de/vagrant-vbguest + # Automatically installs the host's VirtualBox Guest Additions on the guest system. + # config.vbguest.auto_update = true + end + # Synced folders - http://docs.vagrantup.com/v2/synced-folders/ # A synced folder is a fancy term for shared folders - it takes a folder on # the host and shares it with the guest (vagrant) image. The entire folder @@ -88,10 +94,17 @@ Vagrant.configure("2") do |config| # naming of this directory being `vagrant` is just a coincedence). # Share `packages` directory as `C:\packages` config.vm.synced_folder "packages", "/packages" + #config.vm.synced_folder "temp", "/Users/vagrant/AppData/Local/Temp/chocolatey" # not recommended for sharing, it may have issues with `vagrant sandbox rollback` #config.vm.synced_folder "chocolatey", "/ProgramData/chocolatey" + # Access to chocolate project folder + config.vm.synced_folder "/Users/tanner/projects/", "/projects" + + # Access to Dropbox folder + config.vm.synced_folder "/Users/tanner/Dropbox/techs@real-time.com/Windows/", "/dropbox" + # Port forward WinRM / RDP # Vagrant 1.9.3 - if you run into Errno::EADDRNOTAVAIL (https://github.com/mitchellh/vagrant/issues/8395), # add host_ip: "127.0.0.1" for it to work @@ -111,10 +124,11 @@ Vagrant.configure("2") do |config| config.vm.provision :shell, :path => "shell/InstallChocolatey.ps1" config.vm.provision :shell, :path => "shell/NotifyGuiAppsOfEnvironmentChanges.ps1" else - config.vm.provision :shell, :path => "shell/PrepareWindows.ps1", :powershell_elevated_interactive => true - config.vm.provision :shell, :path => "shell/InstallNet4.ps1", :powershell_elevated_interactive => true - config.vm.provision :shell, :path => "shell/InstallChocolatey.ps1", :powershell_elevated_interactive => true - config.vm.provision :shell, :path => "shell/NotifyGuiAppsOfEnvironmentChanges.ps1", :powershell_elevated_interactive => true + config.vm.provision :shell, :path => "shell/PrepareWindows.ps1", privileged: false + config.vm.provision :shell, :path => "shell/InstallNet4.ps1", privileged: false + config.vm.provision :shell, :path => "shell/InstallChocolatey.ps1", privileged: false + config.vm.provision :shell, :path => "shell/NotifyGuiAppsOfEnvironmentChanges.ps1",privileged: false + config.vm.provision :shell, :path => "shell/InstallToolchain.ps1", privileged: false end $packageTestScript = <