This repository contains a PowerShell module with DSC resources that can be used to install and configure an Octopus Deploy Server and Tentacle agent.
There are two main resources:
Server authentication can be configured to use:
Other resources of note are:
Version 3.0 of OctopusDSC supports Octopus Deploy 4.x and above with backwards compatibility to 3.x
PowerShellGet\Install-Module -Name OctopusDSC
%USERPROFILE%\Documents\WindowsPowerShell\Modules
)Get-Module -ListAvailable -Name OctopusDSC
The community has also submitted a few other options.
This project is setup to use Vagrant 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).
There are four options provided:
On a build server, you most likely want to use build-aws.ps1 to spin up a virtual machine on AWS to run the tests.
Configuration is handled by environment variables. The shell scripts will show a message letting you know what variables need to be set. The build-*
scripts also invoke Pester and PSScriptAnalyzer tests, so you'll need those modules installed. Be sure to update Pester, the version that ships with Windows 10 is incompatible.
To run just the scenarios locally, follow these steps:
Install-WindowsFeature –Name Hyper-V -IncludeManagementTools -Restart
)vagrant plugin install <filepath to downloaded .gem file> ie vagrant plugin install c:\temp\vagrant-dsc-2.0.2.gem
vagrant plugin install vagrant-winrm-syncedfolders
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.build-virtualbox.ps1
. This will run all the scenarios under the Tests folder.vagrant plugin install <filepath to downloaded .gem file> ie vagrant plugin install c:\temp\vagrant-dsc-2.0.2.gem
vagrant plugin install vagrant-winrm-syncedfolders
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.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'build-hyperv.ps1
. This will run all the scenarios under the Tests folder.vagrant plugin install vagrant-aws
. If you run into issues around libxml2, take a look at https://github.com/mitchellh/vagrant-aws/issues/539vagrant plugin install vagrant-aws-winrm
AWS_ACCESS_KEY_ID
to a valid valueAWS_SECRET_ACCESS_KEY
to a valid valueAWS_SUBNET_ID
to a valid subnet where you want the instance launchedAWS_SECURITY_GROUP_ID
to a valid security group you want to assign to the instancebuild-aws.ps1
. This will run all the scenarios under the Tests folder.vagrant plugin install vagrant-azure
AZURE_VM_PASSWORD
to a valid valueAZURE_SUBSCRIPTION_ID
to a valid valueAZURE_TENANT_ID
to a valid valueAZURE_CLIENT_ID
to a valid valueAZURE_CLIENT_SECRET
to a valid valuebuild-azure.ps1
. This will run all the scenarios under the Tests folder.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.
These are generally designed to tighten the feedback loop during development, since the VM-based integration test phase can be quite time consuming.
Parameter | Type | Default Value | Description |
---|---|---|---|
-SkipPester |
Switch | False | Skips the Pester and PSScriptAnalyzer unit tests, going straight to the slower, VM-based integration tests. |
-ServerOnly |
Switch | False | Runs only the Server-related integration scenarios. |
-TentacleOnly |
Switch | False | Runs Server scenarios 14 and 15 to install and configure an Octopus Deploy server instance, then moves on to Tentacle-related tests (which require a server to be present). |
-OctopusVersion |
String | vLatest |
Allows you to run tests against a specific version of Octopus Deploy. Does not apply to 'Scenario_07', which installs an older version in order to test upgrading. |
-RetainOnDestroy |
Switch | False | Retains the virtual machine after the tests finish, so you can examine the state of the VM. |
-debug |
Switch | False | Adds the --debug flag to the vagrant invocation, allowing you to step through the process and examine machine state before moving on. |
Tests are written in ServerSpec, which is an infrastructure oriented layer over RSpec and use our 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.