Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ FakesAssemblies/
SampleConfig.ps1
SampleConfig/*

output-virtualbox-iso/
packer_cache/
*.box
.vagrant/
Expand Down
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ The community has also submitted a few [other options](https://github.com/Octopu

## Development

This project is setup to use [Vagrant](vagrant.io) to provide a dev/test environment. Once you've installed Vagrant, you can use the build scripts to spin up a local virtual machine and run the test scenarios (**NOTE:** The first time you run `vagrant up` in Virtualbox or Hyper-V it has to download the `octopusdeploy/dsc-test-server` box and this can take some time depending on your Internet speed, so be patient and go grab a coffee while it downloads).
This project is setup to use [Vagrant](vagrant.io) to provide a dev/test environment. Once you've installed Vagrant, you can use the build scripts to spin up a local virtual machine and run the test scenarios (**NOTE:** The first time you run `vagrant up` for Hyper-V it has to download the `octopusdeploy/dsc-test-server` box and this can take some time depending on your Internet speed, so be patient and go grab a coffee while it downloads).

There are four options provided:

- [build-aws.ps1](build-aws.ps1)
- [build-azure.ps1](build-azure.ps1)
- [build-hyperv-ps1](build-hyperv-ps1) - windows virtualisation
- [build-virtualbox.ps1](build-virtualbox.ps1) - cross-platform virtualisation

On a build server, you most likely want to use [build-aws.ps1](build-aws.ps1) to spin up a virtual machine on AWS to run the tests.

Expand All @@ -54,38 +53,32 @@ Configuration is handled by environment variables. The shell scripts will show a
To run just the scenarios locally, follow these steps:

1. Install Vagrant from [vagrantup.com](https://vagrantup.com). (Note: version after 2.2.3 have altered WinRM upload behaviour which may cause issues)
2. Install VirtualBox from [virtualbox.org](https://virtualbox.org) or Hyper-V (`Install-WindowsFeature –Name Hyper-V -IncludeManagementTools -Restart` )
2. Install Hyper-V (`Install-WindowsFeature –Name Hyper-V -IncludeManagementTools -Restart` )
3. _**If you are on a Mac or Linux**_ you need to install PowerShell, see https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md.
4. If you want to test locally using virtualbox
- Download the Octopus version of [vagrant-dsc](https://github.com/OctopusDeploy/vagrant-dsc/releases/download/v2.0.2/vagrant-dsc-2.0.2.gem)
- Run `vagrant plugin install <filepath to downloaded .gem file> ie vagrant plugin install c:\temp\vagrant-dsc-2.0.2.gem`
- Run `vagrant plugin install vagrant-winrm-syncedfolders`
- Run `Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))` to install Chocolatey on the Host system.
- Run `build-virtualbox.ps1`. This will run all the scenarios under the [Tests](Tests) folder.
5. If you want to test locally using Hyper-V
4. If you want to test locally using Hyper-V
- Download the Octopus version of [vagrant-dsc](https://github.com/OctopusDeploy/vagrant-dsc/releases/download/v2.0.2/vagrant-dsc-2.0.2.gem)
- Run `vagrant plugin install <filepath to downloaded .gem file> ie vagrant plugin install c:\temp\vagrant-dsc-2.0.2.gem`
- Run `vagrant plugin install vagrant-winrm-syncedfolders`
- Run `Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))` to install Chocolatey on the Host system.
- Optionally set the environment variable `OctopusDSCVMSwitch`, to use a specific Hyper-V switch by name. For example, for older Hyper-V systems, you may wish to set this to 'External Connection'
- Run `build-hyperv.ps1`. This will run all the scenarios under the [Tests](Tests) folder.
6. If you want to test using AWS
5. If you want to test using AWS
- Run `vagrant plugin install vagrant-aws`. If you run into issues around libxml2, take a look at https://github.com/mitchellh/vagrant-aws/issues/539
- Run `vagrant plugin install vagrant-aws-winrm`
- Set an environment variable `AWS_ACCESS_KEY_ID` to a valid value
- Set an environment variable `AWS_SECRET_ACCESS_KEY` to a valid value
- Set an environment variable `AWS_SUBNET_ID` to a valid subnet where you want the instance launched
- Set an environment variable `AWS_SECURITY_GROUP_ID` to a valid security group you want to assign to the instance
- Run `build-aws.ps1`. This will run all the scenarios under the [Tests](Tests) folder.
7. If you want to test using Azure
6. If you want to test using Azure
- Run `vagrant plugin install vagrant-azure`
- Set an environment variable `AZURE_VM_PASSWORD` to a valid value
- Set an environment variable `AZURE_SUBSCRIPTION_ID` to a valid value
- Set an environment variable `AZURE_TENANT_ID` to a valid value
- Set an environment variable `AZURE_CLIENT_ID` to a valid value
- Srt an environment variable `AZURE_CLIENT_SECRET` to a valid value
- Run `build-azure.ps1`. This will run all the scenarios under the [Tests](Tests) folder.
8. Run `vagrant destroy -f` or the appropriate `cleanup-*.ps1` once you have finished to kill the virtual machine.
7. Run `vagrant destroy -f` or the appropriate `cleanup-*.ps1` once you have finished to kill the virtual machine.

Each of the `build-*` scripts can take parameters at the command prompt.

Expand All @@ -102,4 +95,4 @@ These are generally designed to tighten the feedback loop during development, si

Tests are written in [ServerSpec](serverspec.org), which is an infrastructure oriented layer over [RSpec](rspec.info) and use our [octopus-serverspec-extensions](https://github.com/OctopusDeploy/octopus-serverspec-extensions) project for octopus-specific tests.

When creating a PR, please ensure that all existing tests run succesfully against VirtualBox, and please include a new scenario where possible. Before you start, please raise an issue to discuss your plans so we can make sure it fits with the goals of the project.
When creating a PR, please ensure that all existing tests run succesfully, and please include a new scenario where possible. Before you start, please raise an issue to discuss your plans so we can make sure it fits with the goals of the project.
4 changes: 2 additions & 2 deletions Tests/powershell-helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function Test-LogContainsRetriableFailure($log) {

function Invoke-VagrantWithRetries {
param(
[ValidateSet("aws", "azure", "hyperv", "virtualbox")]
[ValidateSet("aws", "azure", "hyperv")]
$provider,
$retries = 3,
[switch]$retainondestroy,
Expand Down Expand Up @@ -201,7 +201,7 @@ function Set-OctopusDSCEnvVars {
}

# offline installers - saves downloading a ton of installer data, can speed things up on slow connections
# only really useful for hyper-v and virtualbox. currently broken
# only really useful for hyper-v. currently broken
if($offline.IsPresent) {
Set-OfflineConfig
} else {
Expand Down
51 changes: 0 additions & 51 deletions build-virtualbox.ps1

This file was deleted.

18 changes: 0 additions & 18 deletions vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,6 @@ Vagrant.configure(VAGRANT_FILE_API_VERSION) do |config|
config.multihostsupdater.aliases = {ip_address => [hostname]}
end

config.vm.provider "virtualbox" do |v, override|
v.gui = true
v.linked_clone = true
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--audio", "none"]
v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
v.customize ["modifyvm", :id, "--usb", "off"]
v.customize ["modifyvm", :id, "--vram", "32"]
override.vm.box = "OctopusDeploy/dsc-test-server-windows-server-2019"
override.vm.box_url = "https://s3-ap-southeast-2.amazonaws.com/octopus-vagrant-boxes/vagrant/json/OctopusDeploy/virtualbox/dsc-test-server-windows-server-2019.json"
override.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct: true
override.vm.network :forwarded_port, guest: 80, host: 8000, id: "web"
override.vm.network :forwarded_port, guest: 443, host: 8443, id: "ssl"
override.vm.network :forwarded_port, guest: 22, host: 9222, id: "ssh"
override.winrm.port = 5986
override.winrm.ssl_peer_verification = false
end

if Vagrant::Util::Platform.windows? then
config.vm.provider "hyperv" do |v, override|
override.vm.box = "OctopusDeploy/dsc-test-server-windows-server-1803"
Expand Down