├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── .gitignore ├── CONTRIBUTING.md ├── E2ETests ├── Scenarios │ ├── Configuration.psd1 │ ├── Server_Scenario_01_Install.ps1 │ ├── Server_Scenario_02_Install_Second_Node.ps1 │ ├── Server_Scenario_03_Remove.ps1 │ ├── Server_Scenario_04_Remove_Second_Node.ps1 │ ├── Server_Scenario_05_Install_Custom_Instance.ps1 │ ├── Server_Scenario_06_Remove_Custom_Instance.ps1 │ ├── Server_Scenario_07_Reinstall.ps1 │ ├── Server_Scenario_08_Upgrade.ps1 │ ├── Server_Scenario_09_Watchdog_Create.ps1 │ ├── Server_Scenario_10_Watchdog_Delete.ps1 │ ├── Server_Scenario_11_Remove.ps1 │ ├── Server_Scenario_12_Built_In_Worker.ps1 │ ├── Server_Scenario_13_Remove.ps1 │ ├── Server_Scenario_14_Install_Without_Configure.ps1 │ ├── Server_Scenario_15_Configure_Preinstalled_Instance.ps1 │ ├── Tentacle_Scenario_01_Install.ps1 │ ├── Tentacle_Scenario_02_Remove.ps1 │ ├── Tentacle_Scenario_03_Reinstall.ps1 │ ├── Tentacle_Scenario_04_Upgrade.ps1 │ ├── Tentacle_Scenario_05_Watchdog_Create.ps1 │ ├── Tentacle_Scenario_06_Watchdog_Delete.ps1 │ ├── Tentacle_Scenario_07_Remove.ps1 │ └── Tentacle_Scenario_08_Tentacle_Comms_Port.ps1 └── Spec │ ├── TestHelpers │ ├── Get-EnvironmentDetails.ps1 │ ├── Get-SpaceDetails.ps1 │ ├── Get-TentacleDetails.ps1 │ ├── Get-WorkerDetails.ps1 │ ├── Get-WorkerPoolDetails.ps1 │ └── Private │ │ ├── Get-EnvironmentViaApi.ps1 │ │ ├── Get-Environments.ps1 │ │ ├── Get-MachinePolicies.ps1 │ │ ├── Get-MachineViaApi.ps1 │ │ ├── Get-SpaceViaApi.ps1 │ │ ├── Get-Tenants.ps1 │ │ ├── Get-Thumbprint.ps1 │ │ ├── Get-WorkerPoolViaApi.ps1 │ │ ├── Get-WorkerViaApi.ps1 │ │ ├── Invoke-PollUntilMachineHasCompletedHealthCheck.ps1 │ │ ├── Invoke-PollUntilWorkerHasCompletedHealthCheck copy.ps1 │ │ ├── Test-IsTentacleOnline.ps1 │ │ ├── Test-IsWorkerOnline.ps1 │ │ └── Test-ServerSupportsSpaces.ps1 │ ├── server_scenario_01_install.Tests.ps1 │ ├── server_scenario_02_install_second_node.Tests.ps1 │ ├── server_scenario_03_remove.Tests.ps1 │ ├── server_scenario_04_remove_second_node.Tests.ps1 │ ├── server_scenario_05_install_custom_instance.Tests.ps1 │ ├── server_scenario_06_remove_custom_instance.Tests.ps1 │ ├── server_scenario_07_reinstall.Tests.ps1 │ ├── server_scenario_08_upgrade.Tests.ps1 │ ├── server_scenario_09_watchdog_create.Tests.ps1 │ ├── server_scenario_10_watchdog_delete.Tests.ps1 │ ├── server_scenario_11_remove.Tests.ps1 │ ├── server_scenario_12_built_in_worker.Tests.ps1 │ ├── server_scenario_13_remove.Tests.ps1 │ ├── server_scenario_14_install_without_configure.Tests.ps1 │ ├── server_scenario_15_configure_preinstalled_instance.Tests.ps1 │ ├── tentacle_scenario_01_install.Tests.ps1 │ ├── tentacle_scenario_02_remove.Tests.ps1 │ ├── tentacle_scenario_03_reinstall.Tests.ps1 │ ├── tentacle_scenario_04_upgrade.Tests.ps1 │ ├── tentacle_scenario_05_watchdog_create.Tests.ps1 │ ├── tentacle_scenario_06_watchdog_delete.Tests.ps1 │ ├── tentacle_scenario_07_remove.Tests.ps1 │ └── tentacle_scenario_08_tentacle_comms_port.Tests.ps1 ├── LICENSE.txt ├── OctopusDSC ├── .gitattributes ├── DSCResources │ ├── cOctopusEnvironment │ │ ├── cOctopusEnvironment.psm1 │ │ └── cOctopusEnvironment.schema.mof │ ├── cOctopusSeqLogger │ │ ├── cOctopusSeqLogger.psm1 │ │ └── cOctopusSeqLogger.schema.mof │ ├── cOctopusServer │ │ ├── cOctopusServer.psm1 │ │ └── cOctopusServer.schema.mof │ ├── cOctopusServerActiveDirectoryAuthentication │ │ ├── cOctopusServerActiveDirectoryAuthentication.psm1 │ │ └── cOctopusServerActiveDirectoryAuthentication.schema.mof │ ├── cOctopusServerAzureADAuthentication │ │ ├── cOctopusServerAzureADAuthentication.psm1 │ │ └── cOctopusServerAzureADAuthentication.schema.mof │ ├── cOctopusServerGoogleAppsAuthentication │ │ ├── cOctopusServerGoogleAppsAuthentication.psm1 │ │ └── cOctopusServerGoogleAppsAuthentication.schema.mof │ ├── cOctopusServerGuestAuthentication │ │ ├── cOctopusServerGuestAuthentication.psm1 │ │ └── cOctopusServerGuestAuthentication.schema.mof │ ├── cOctopusServerOktaAuthentication │ │ ├── cOctopusServerOktaAuthentication.psm1 │ │ └── cOctopusServerOktaAuthentication.schema.mof │ ├── cOctopusServerSpace │ │ ├── cOctopusServerSpace.psm1 │ │ └── cOctopusServerSpace.schema.mof │ ├── cOctopusServerSslCertificate │ │ ├── cOctopusServerSslCertificate.psm1 │ │ └── cOctopusServerSslCertificate.schema.mof │ ├── cOctopusServerUsernamePasswordAuthentication │ │ ├── cOctopusServerUsernamePasswordAuthentication.psm1 │ │ └── cOctopusServerUsernamePasswordAuthentication.schema.mof │ ├── cOctopusServerWatchdog │ │ ├── cOctopusServerWatchdog.psm1 │ │ └── cOctopusServerWatchdog.schema.mof │ ├── cOctopusWorkerPool │ │ ├── cOctopusWorkerPool.psm1 │ │ └── cOctopusWorkerPool.schema.mof │ ├── cTentacleAgent │ │ ├── cTentacleAgent.psm1 │ │ └── cTentacleAgent.schema.mof │ └── cTentacleWatchdog │ │ ├── cTentacleWatchdog.psm1 │ │ └── cTentacleWatchdog.schema.mof ├── Examples │ ├── ExamplePassword.txt │ ├── cOctopusEnvironment.ps1 │ ├── cOctopusSeqLogger.ps1 │ ├── cOctopusServer.ps1 │ ├── cOctopusServerActiveDirectoryAuthentication.ps1 │ ├── cOctopusServerAzureADAuthentication.ps1 │ ├── cOctopusServerGoogleAppsAuthentication.ps1 │ ├── cOctopusServerGuestAuthentication.ps1 │ ├── cOctopusServerOktaAuthentication.ps1 │ ├── cOctopusServerSpace.ps1 │ ├── cOctopusServerSslCertificate.ps1 │ ├── cOctopusServerUsernamePasswordAuthentication.ps1 │ ├── cOctopusServerWatchdog.ps1 │ ├── cOctopusWorkerPool.ps1 │ ├── cTentacleAgent_ListeningTentacle.psm1 │ ├── cTentacleAgent_PollingTentacle.psm1 │ └── cTentacleWatchdog.ps1 ├── OctopusDSC.psd1 ├── OctopusDSCHelpers.ps1 └── Tests │ ├── OctopusDSCHelpers.Tests.ps1 │ ├── OctopusServerExeInvocationFiles │ ├── ChangeWebListenPrefix │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── ConfigureWhenMsiPreInstalled │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── ConfigureWhenOlderMsiPreInstalled │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── EnableBuiltInWorkerOnExistingInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── InstallOnly │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── MasterKeySupplied │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewInstallWithBuiltInWorker │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewInstanceWithMetrics │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── UninstallingPreInstalledInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── UninstallingRunningInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── UpgradeExistingInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ └── WhenNothingChanges │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── SampleConfigs │ ├── octopus.server.exe-output-clean.json │ ├── octopus.server.exe-output-when-json-has-exception-prepended.json │ ├── octopus.server.exe.nlog-when-not-configured.xml │ ├── octopus.server.exe.nlog-with-old-sync-configuration-with-api-key.xml │ ├── octopus.server.exe.nlog-with-old-sync-configuration.xml │ ├── octopus.server.exe.nlog-with-valid-configuration-with-api-key.xml │ └── octopus.server.exe.nlog-with-valid-configuration.xml │ ├── TentacleExeInvocationFiles │ ├── InstallOnly │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewInstanceInSpace │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewPollingTentacle │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewWorker │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── NewWorkerInSpace │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── UninstallingRunningInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── UninstallingRunningInstanceInSpace │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── UpgradeExistingInstance │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ └── UpgradeExistingInstanceInSpace │ │ ├── CurrentState.ps1 │ │ ├── ExpectedResult.ps1 │ │ └── RequestedState.ps1 │ ├── cOctopusEnvironment.Tests.ps1 │ ├── cOctopusSeqLogger.Tests.ps1 │ ├── cOctopusServer.Tests.ps1 │ ├── cOctopusServerActiveDirectoryAuthentication.Tests.ps1 │ ├── cOctopusServerAzureADAuthentication.Tests.ps1 │ ├── cOctopusServerGoogleAppsAuthentication.Tests.ps1 │ ├── cOctopusServerGuestAuthentication.Tests.ps1 │ ├── cOctopusServerOktaAuthentication.Tests.ps1 │ ├── cOctopusServerSpace.Tests.ps1 │ ├── cOctopusServerSslCertificate.Tests.ps1 │ ├── cOctopusServerUsernamePasswordAuthentication.Tests.ps1 │ ├── cOctopusServerWatchdog.Tests.ps1 │ ├── cOctopusWorkerPool.tests.ps1 │ ├── cTentacleAgent.Tests.ps1 │ └── cTentacleWatchdog.Tests.ps1 ├── Octopus_blue_64px.png ├── README-cOctopusServer.md ├── README-cOctopusServerActiveDirectoryAuthentication.md ├── README-cOctopusServerAzureADAuthentication.md ├── README-cOctopusServerGoogleAppsAuthentication.md ├── README-cOctopusServerGuestAuthentication.md ├── README-cOctopusServerOktaAuthentication.md ├── README-cOctopusServerSpace.md ├── README-cOctopusServerSslCertificate.md ├── README-cOctopusServerUsernamePasswordAuthentication.md ├── README-cTentacleAgent.md ├── README.md ├── Tests ├── OctopusDSC.Tests.ps1 ├── aws_user_data.ps1 ├── configure-dsc-local-configuration-manager.ps1 ├── configure-module-for-prerelease-tests.ps1 ├── configure-octopus-for-tentacle-tests.ps1 ├── install-test-dependencies.ps1 ├── powershell-helpers.ps1 ├── register-polling-tentacle.ps1 ├── surface-logs.ps1 └── trigger-and-wait-for-healthcheck.ps1 ├── build-aws.ps1 ├── build-azure.ps1 ├── build-hyperv.ps1 ├── build-virtualbox.ps1 ├── cleanup-aws.ps1 ├── cleanup-azure.ps1 ├── publish.ps1 └── vagrantfile /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **_Are you a customer of Octopus Deploy? Don't raise the issue here. Please contact [our support team](https://octopus.com/support) so we can triage your issue, making sure it's handled appropriately._** 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | Thank you for going to the effort of contributing some code. 3 | 4 | If you've found a bug or something isn't working, please quickly check the issues in 5 | our [main issue repository](https://github.com/OctopusDeploy/Issues). 6 | 7 | If your change is small or you have already made the change, please go ahead and submit a pull request. 8 | 9 | For other changes, please raise an issue first to check that the change aligns with our plan for the product. We ask this to avoid disappointment and wasted effort if it does not. 10 | 11 | If your pull request or proposed change is for a bug that is causing problems for you, please also [contact support](http://octopusdeploy.com/support) referencing your pull request to make sure it gets prioritized properly. They may also be able to find a work around in the meantime. 12 | 13 | If you have an idea or a feature request, please post it to [our UserVoice site](http://octopusdeploy.uservoice.com) so others can vote for it. 14 | 15 | If you're a keen contributor, a regular OctopusDSC user or just curious, please feel free to join us in the `#octopusdsc` channel at our [Community Slack](https://join.slack.com/t/octopususergroup/shared_invite/enQtNDcyNjM3OTczNzAxLTU0MjI3YmIyMDc1MzdmYjk3OTYzZGY4ZTI2NTcwMzY3OGJkZTExYTVkNThjYjM1MWE2YjlmNWQyMmQwNzRmMjk) 16 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Configuration.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | AllNodes = 3 | @( 4 | @{ 5 | NodeName = "localhost"; 6 | PSDscAllowPlainTextPassword = $true; 7 | RebootIfNeeded = $True; 8 | } 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_02_Install_Second_Node.ps1: -------------------------------------------------------------------------------- 1 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 2 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 3 | 4 | Push-Location "$env:programfiles\Octopus Deploy\Octopus" 5 | $MasterKey = .\octopus.server.exe show-master-key --instance=OctopusServer 6 | Pop-Location 7 | $SecureMasterKey = ConvertTo-SecureString $MasterKey -AsPlainText -Force 8 | $MasterKeyCred = New-Object System.Management.Automation.PSCredential ("notused", $SecureMasterKey) 9 | 10 | Configuration Server_Scenario_02_Install_Second_Node 11 | { 12 | Import-DscResource -ModuleName OctopusDSC 13 | Import-DscResource -ModuleName PSDesiredStateConfiguration 14 | 15 | Node "localhost" 16 | { 17 | LocalConfigurationManager 18 | { 19 | DebugMode = "ForceModuleImport" 20 | ConfigurationMode = 'ApplyOnly' 21 | } 22 | 23 | cOctopusServer OctopusServerSecondNode 24 | { 25 | Ensure = "Present" 26 | State = "Started" 27 | 28 | Name = "HANode" 29 | 30 | # The url that Octopus will listen on 31 | WebListenPrefix = "http://localhost:82" 32 | 33 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario1;Trusted_Connection=True;" 34 | 35 | OctopusMasterKey = $MasterKeyCred 36 | 37 | # The admin user to create 38 | OctopusAdminCredential = $cred 39 | 40 | # Don't clash the comms port 41 | ListenPort = 10935 42 | 43 | # dont mess with stats 44 | AllowCollectionOfUsageStatistics = $false 45 | 46 | HomeDirectory = "C:\ChezOctopusSecondNode" 47 | 48 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 49 | 50 | ArtifactsDirectory = "C:\ChezOctopus\Artifacts" 51 | PackagesDirectory = "C:\ChezOctopus\Packages" 52 | TaskLogsDirectory = "C:\ChezOctopus\TaskLogs" 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_03_Remove.ps1: -------------------------------------------------------------------------------- 1 | function Get-CurrentSSLBinding { 2 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "")] 3 | param([string] $ApplicationId, 4 | [string]$Port) 5 | 6 | $certificateBindings = (& netsh http show sslcert) | select-object -skip 3 | out-string 7 | $newLine = [System.Environment]::NewLine 8 | $certificateBindings = $certificateBindings -split "$newLine$newLine" 9 | $certificateBindingsList = foreach ($certificateBinding in $certificateBindings) { 10 | if ($certificateBinding -ne "") { 11 | $certificateBinding = $certificateBinding -replace " ", "" -split ": " 12 | [pscustomobject]@{ 13 | IPPort = ($certificateBinding[1] -split "`n")[0] 14 | CertificateThumbprint = ($certificateBinding[2] -split "`n" -replace '[^a-zA-Z0-9]', '')[0] 15 | AppID = ($certificateBinding[3] -split "`n")[0] 16 | CertStore = ($certificateBinding[4] -split "`n")[0] 17 | } 18 | } 19 | } 20 | 21 | return ($certificateBindingsList | Where-Object {($_.AppID.Trim() -eq $ApplicationId) -and ($_.IPPort.Trim() -eq "{0}:{1}" -f "0.0.0.0", $Port) }) 22 | } 23 | 24 | $certificate = Get-CurrentSSLBinding -ApplicationId "{E2096A4C-2391-4BE1-9F17-E353F930E7F1}" -Port 443 25 | 26 | Configuration Server_Scenario_03_Remove 27 | { 28 | Import-DscResource -ModuleName OctopusDSC 29 | Import-DscResource -ModuleName PSDesiredStateConfiguration 30 | 31 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 32 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 33 | 34 | Node "localhost" 35 | { 36 | LocalConfigurationManager 37 | { 38 | DebugMode = "ForceModuleImport" 39 | ConfigurationMode = 'ApplyOnly' 40 | } 41 | 42 | cOctopusServerSslCertificate "Configure SSL Certificate" 43 | { 44 | InstanceName = "OctopusServer" 45 | Thumbprint = $certificate.CertificateThumbprint 46 | Ensure = "Absent" 47 | StoreName = "My" 48 | Port = 443 49 | } 50 | 51 | cOctopusServer OctopusServer 52 | { 53 | Ensure = "Absent" 54 | State = "Stopped" 55 | 56 | # Server instance name. Leave it as 'OctopusServer' unless you have more 57 | # than one instance 58 | Name = "OctopusServer" 59 | 60 | # The url that Octopus will listen on 61 | WebListenPrefix = "http://localhost:81,https://localhost" 62 | 63 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=Octopus;Trusted_Connection=True;" 64 | 65 | # The admin user to create 66 | OctopusAdminCredential = $cred 67 | 68 | # dont mess with stats 69 | AllowCollectionOfUsageStatistics = $false 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_04_Remove_Second_Node.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_04_Remove_Second_Node 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 7 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServerSecondNode 18 | { 19 | Ensure = "Absent" 20 | State = "Stopped" 21 | 22 | Name = "HANode" 23 | 24 | # The url that Octopus will listen on 25 | WebListenPrefix = "http://localhost:82" 26 | 27 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario1;Trusted_Connection=True;" 28 | 29 | # The admin user to create 30 | OctopusAdminCredential = $cred 31 | 32 | # dont mess with stats 33 | AllowCollectionOfUsageStatistics = $false 34 | 35 | HomeDirectory = "C:\ChezOctopusSecondNode" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_05_Install_Custom_Instance.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_05_Install_Custom_Instance 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 7 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Present" 20 | State = "Started" 21 | 22 | # Server instance name. Leave it as 'OctopusServer' unless you have more 23 | # than one instance 24 | Name = "MyOctopusServer" 25 | 26 | # The url that Octopus will listen on 27 | WebListenPrefix = "http://localhost:81" 28 | 29 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario2;Trusted_Connection=True;" 30 | 31 | # The admin user to create 32 | OctopusAdminCredential = $cred 33 | 34 | # dont mess with stats 35 | AllowCollectionOfUsageStatistics = $false 36 | } 37 | 38 | cOctopusServerUsernamePasswordAuthentication "Enable Username/Password Auth" 39 | { 40 | InstanceName = "MyOctopusServer" 41 | Enabled = $true 42 | DependsOn = "[cOctopusServer]OctopusServer" 43 | } 44 | 45 | cOctopusServerActiveDirectoryAuthentication "Enable Active Directory Auth" 46 | { 47 | InstanceName = "MyOctopusServer" 48 | Enabled = $true 49 | AllowFormsAuthenticationForDomainUsers = $true 50 | ActiveDirectoryContainer = "CN=Users,DC=GPN,DC=COM" 51 | DependsOn = "[cOctopusServer]OctopusServer" 52 | } 53 | 54 | cOctopusServerAzureADAuthentication "Enable Azure AD Auth" 55 | { 56 | InstanceName = "MyOctopusServer" 57 | Enabled = $true 58 | Issuer = "https://login.microsoftonline.com/b91ebf6a-84be-4c6f-97f3-32a1d0a11c8a" 59 | ClientID = "0272262a-b31d-4acf-8891-56e96d302018" 60 | DependsOn = "[cOctopusServer]OctopusServer" 61 | } 62 | 63 | cOctopusServerGoogleAppsAuthentication "Enable GoogleApps Auth" 64 | { 65 | InstanceName = "MyOctopusServer" 66 | Enabled = $true 67 | ClientID = "5743519123-1232358520259-3634528" 68 | HostedDomain = "https://octopus.example.com" 69 | DependsOn = "[cOctopusServer]OctopusServer" 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_06_Remove_Custom_Instance.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_06_Remove_Custom_Instance 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 7 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Absent" 20 | State = "Stopped" 21 | 22 | # Server instance name. Leave it as 'OctopusServer' unless you have more 23 | # than one instance 24 | Name = "MyOctopusServer" 25 | 26 | # The url that Octopus will listen on 27 | WebListenPrefix = "http://localhost:81" 28 | 29 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario2;Trusted_Connection=True;" 30 | 31 | # The admin user to create 32 | OctopusAdminCredential = $cred 33 | 34 | # dont mess with stats 35 | AllowCollectionOfUsageStatistics = $false 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_08_Upgrade.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_08_Upgrade 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 7 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Present" 20 | State = "Started" 21 | 22 | # Server instance name. Leave it as 'OctopusServer' unless you have more 23 | # than one instance 24 | Name = "OctopusServer" 25 | 26 | # The url that Octopus will listen on 27 | WebListenPrefix = "http://localhost:81" 28 | 29 | # use a new database, as old one is not removed 30 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario5;Trusted_Connection=True;" 31 | 32 | # The admin user to create 33 | OctopusAdminCredential = $cred 34 | 35 | # dont mess with stats 36 | AllowCollectionOfUsageStatistics = $false 37 | 38 | SkipLicenseCheck = $true 39 | } 40 | 41 | cOctopusEnvironment "Delete 'UAT 1' Environment" 42 | { 43 | Url = "http://localhost:81" 44 | Ensure = "Absent" 45 | OctopusCredentials = $cred 46 | EnvironmentName = "UAT 1" 47 | DependsOn = "[cOctopusServer]OctopusServer" 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_09_Watchdog_Create.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_09_Watchdog_Create 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | Node "localhost" 7 | { 8 | LocalConfigurationManager 9 | { 10 | DebugMode = "ForceModuleImport" 11 | ConfigurationMode = 'ApplyOnly' 12 | } 13 | 14 | cOctopusServerWatchdog OctopusServerWatchdog 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $True 18 | Interval = 10 19 | Instances = "*" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_10_Watchdog_Delete.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_10_Watchdog_Delete 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | Node "localhost" 7 | { 8 | LocalConfigurationManager 9 | { 10 | DebugMode = "ForceModuleImport" 11 | ConfigurationMode = 'ApplyOnly' 12 | } 13 | 14 | cOctopusServerWatchdog OctopusServerWatchdog 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $false 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_11_Remove.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_11_Remove 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 7 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Absent" 20 | State = "Stopped" 21 | 22 | # Server instance name. Leave it as 'OctopusServer' unless you have more 23 | # than one instance 24 | Name = "OctopusServer" 25 | 26 | # The url that Octopus will listen on 27 | WebListenPrefix = "http://localhost:81" 28 | 29 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario5;Trusted_Connection=True;" 30 | 31 | # The admin user to create 32 | OctopusAdminCredential = $cred 33 | 34 | # dont mess with stats 35 | AllowCollectionOfUsageStatistics = $false 36 | 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_13_Remove.ps1: -------------------------------------------------------------------------------- 1 | Configuration Server_Scenario_13_Remove 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 7 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Absent" 20 | State = "Stopped" 21 | 22 | # Server instance name. Leave it as 'OctopusServer' unless you have more 23 | # than one instance 24 | Name = "OctopusServer" 25 | 26 | # The url that Octopus will listen on 27 | WebListenPrefix = "http://localhost:81" 28 | 29 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario5;Trusted_Connection=True;" 30 | 31 | # The admin user to create 32 | OctopusAdminCredential = $cred 33 | 34 | # dont mess with stats 35 | AllowCollectionOfUsageStatistics = $false 36 | 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_14_Install_Without_Configure.ps1: -------------------------------------------------------------------------------- 1 | 2 | Configuration Server_Scenario_14_Install_Without_Configure 3 | { 4 | Import-DscResource -ModuleName OctopusDSC 5 | Import-DscResource -ModuleName PSDesiredStateConfiguration 6 | 7 | Node "localhost" 8 | { 9 | LocalConfigurationManager 10 | { 11 | DebugMode = "ForceModuleImport" 12 | ConfigurationMode = 'ApplyOnly' 13 | } 14 | 15 | cOctopusServer OctopusServer 16 | { 17 | Ensure = "Present" 18 | State = "Installed" 19 | Name = "OctopusServer" 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /E2ETests/Scenarios/Server_Scenario_15_Configure_Preinstalled_Instance.ps1: -------------------------------------------------------------------------------- 1 | $pass = ConvertTo-SecureString "SuperS3cretPassw0rd!" -AsPlainText -Force 2 | $cred = New-Object System.Management.Automation.PSCredential ("OctoAdmin", $pass) 3 | 4 | Configuration Server_Scenario_15_Configure_Preinstalled_Instance 5 | { 6 | Import-DscResource -ModuleName OctopusDSC 7 | Import-DscResource -ModuleName PSDesiredStateConfiguration 8 | 9 | Node "localhost" 10 | { 11 | LocalConfigurationManager 12 | { 13 | DebugMode = "ForceModuleImport" 14 | ConfigurationMode = 'ApplyOnly' 15 | } 16 | 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Present" 20 | State = "Started" 21 | Name = "ConfigurePreInstalledInstance" 22 | WebListenPrefix = "http://localhost:81" 23 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=OctopusScenario15;Trusted_Connection=True;" 24 | OctopusAdminCredential = $cred 25 | 26 | AllowCollectionOfUsageStatistics = $false 27 | } 28 | 29 | cOctopusServerUsernamePasswordAuthentication "Enable Username/Password Auth" 30 | { 31 | InstanceName = "ConfigurePreInstalledInstance" 32 | Enabled = $true 33 | DependsOn = "[cOctopusServer]OctopusServer" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Tentacle_Scenario_03_Reinstall.ps1: -------------------------------------------------------------------------------- 1 | $config = get-content "c:\temp\octopus-configured.marker" | ConvertFrom-Json 2 | $OctopusServerUrl = $config.OctopusServerUrl 3 | $ApiKey = $config.OctopusApiKey 4 | $Environments = "The-Env" 5 | $Roles = "Test-Tentacle" 6 | 7 | Configuration Tentacle_Scenario_03_Reinstall 8 | { 9 | Import-DscResource -ModuleName OctopusDSC 10 | Import-DscResource -ModuleName PSDesiredStateConfiguration 11 | 12 | Node "localhost" 13 | { 14 | LocalConfigurationManager 15 | { 16 | DebugMode = "ForceModuleImport" 17 | ConfigurationMode = 'ApplyOnly' 18 | } 19 | 20 | cTentacleAgent OctopusTentacle 21 | { 22 | Ensure = "Present"; 23 | State = "Started"; 24 | 25 | # Tentacle instance name. Leave it as 'Tentacle' unless you have more 26 | # than one instance 27 | Name = "Tentacle"; 28 | 29 | # Registration - all parameters required 30 | ApiKey = $ApiKey; 31 | OctopusServerUrl = $OctopusServerUrl; 32 | Environments = $Environments; 33 | Roles = $Roles; 34 | 35 | # Optional settings 36 | ListenPort = 10933; 37 | DefaultApplicationDirectory = "C:\Applications" 38 | TentacleDownloadUrl = "https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.20.0.msi" 39 | TentacleDownloadUrl64 = "https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.20.0-x64.msi" 40 | PublicHostNameConfiguration = "ComputerName" 41 | TentacleHomeDirectory = "C:\Octopus\OctopusTentacleHome" 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Tentacle_Scenario_04_Upgrade.ps1: -------------------------------------------------------------------------------- 1 | $config = get-content "c:\temp\octopus-configured.marker" | ConvertFrom-Json 2 | $OctopusServerUrl = $config.OctopusServerUrl 3 | $ApiKey = $config.OctopusApiKey 4 | $Environments = "The-Env" 5 | $Roles = "Test-Tentacle" 6 | 7 | Configuration Tentacle_Scenario_04_Upgrade 8 | { 9 | Import-DscResource -ModuleName OctopusDSC 10 | Import-DscResource -ModuleName PSDesiredStateConfiguration 11 | 12 | Node "localhost" 13 | { 14 | LocalConfigurationManager 15 | { 16 | DebugMode = "ForceModuleImport" 17 | ConfigurationMode = 'ApplyOnly' 18 | } 19 | 20 | cTentacleAgent OctopusTentacle 21 | { 22 | Ensure = "Present"; 23 | State = "Started"; 24 | 25 | # Tentacle instance name. Leave it as 'Tentacle' unless you have more 26 | # than one instance 27 | Name = "Tentacle"; 28 | 29 | # Registration - all parameters required 30 | ApiKey = $ApiKey; 31 | OctopusServerUrl = $OctopusServerUrl; 32 | Environments = $Environments; 33 | Roles = $Roles; 34 | 35 | # Optional settings 36 | ListenPort = 10933; 37 | DefaultApplicationDirectory = "C:\Applications" 38 | PublicHostNameConfiguration = "ComputerName" 39 | TentacleHomeDirectory = "C:\Octopus\OctopusTentacleHome" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Tentacle_Scenario_05_Watchdog_Create.ps1: -------------------------------------------------------------------------------- 1 | Configuration Tentacle_Scenario_05_Watchdog_Create 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | Node "localhost" 7 | { 8 | LocalConfigurationManager 9 | { 10 | DebugMode = "ForceModuleImport" 11 | ConfigurationMode = 'ApplyOnly' 12 | } 13 | 14 | cTentacleWatchdog TentacleWatchdog 15 | { 16 | InstanceName = "PollingTentacle" 17 | Enabled = $True 18 | Interval = 10 19 | Instances = "*" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Tentacle_Scenario_06_Watchdog_Delete.ps1: -------------------------------------------------------------------------------- 1 | Configuration Tentacle_Scenario_06_Watchdog_Delete 2 | { 3 | Import-DscResource -ModuleName OctopusDSC 4 | Import-DscResource -ModuleName PSDesiredStateConfiguration 5 | 6 | Node "localhost" 7 | { 8 | LocalConfigurationManager 9 | { 10 | DebugMode = "ForceModuleImport" 11 | ConfigurationMode = 'ApplyOnly' 12 | } 13 | 14 | cTentacleWatchdog TentacleWatchdog 15 | { 16 | InstanceName = "Tentacle" 17 | Enabled = $false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Tentacle_Scenario_07_Remove.ps1: -------------------------------------------------------------------------------- 1 | $config = get-content "c:\temp\octopus-configured.marker" | ConvertFrom-Json 2 | $OctopusServerUrl = $config.OctopusServerUrl 3 | $ApiKey = $config.OctopusApiKey 4 | $Environments = "The-Env" 5 | $Roles = "Test-Tentacle" 6 | 7 | Configuration Tentacle_Scenario_07_Remove 8 | { 9 | Import-DscResource -ModuleName OctopusDSC 10 | Import-DscResource -ModuleName PSDesiredStateConfiguration 11 | 12 | Node "localhost" 13 | { 14 | LocalConfigurationManager 15 | { 16 | DebugMode = "ForceModuleImport" 17 | ConfigurationMode = 'ApplyOnly' 18 | } 19 | 20 | cTentacleAgent OctopusTentacle 21 | { 22 | Ensure = "Absent"; 23 | State = "Stopped"; 24 | 25 | # Tentacle instance name. Leave it as 'Tentacle' unless you have more 26 | # than one instance 27 | Name = "Tentacle"; 28 | 29 | # Registration - all parameters required 30 | ApiKey = $ApiKey; 31 | OctopusServerUrl = $OctopusServerUrl; 32 | Environments = $Environments; 33 | Roles = $Roles; 34 | 35 | # Optional settings 36 | ListenPort = 10933; 37 | DefaultApplicationDirectory = "C:\Applications" 38 | PublicHostNameConfiguration = "ComputerName" 39 | TentacleHomeDirectory = "C:\Octopus\OctopusTentacleHome" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /E2ETests/Scenarios/Tentacle_Scenario_08_Tentacle_Comms_Port.ps1: -------------------------------------------------------------------------------- 1 | $config = get-content "c:\temp\octopus-configured.marker" | ConvertFrom-Json 2 | $OctopusServerUrl = $config.OctopusServerUrl 3 | $ApiKey = $config.OctopusApiKey 4 | $Environments = "The-Env" 5 | $Roles = "Test-Tentacle" 6 | 7 | Configuration Tentacle_Scenario_08_Tentacle_Comms_Port 8 | { 9 | Import-DscResource -ModuleName OctopusDSC 10 | Import-DscResource -ModuleName PSDesiredStateConfiguration 11 | 12 | Node "localhost" 13 | { 14 | LocalConfigurationManager 15 | { 16 | DebugMode = "ForceModuleImport" 17 | ConfigurationMode = 'ApplyOnly' 18 | } 19 | 20 | cTentacleAgent OctopusTentacle 21 | { 22 | Ensure = "Present"; 23 | State = "Started"; 24 | 25 | # Tentacle instance name. Leave it as 'Tentacle' unless you have more 26 | # than one instance 27 | Name = "Tentacle"; 28 | 29 | # Registration - all parameters required 30 | ApiKey = $ApiKey; 31 | OctopusServerUrl = $OctopusServerUrl; 32 | Environments = $Environments; 33 | Roles = $Roles; 34 | 35 | # Optional settings 36 | ListenPort = 10933; 37 | TentacleCommsPort = 10900; 38 | DefaultApplicationDirectory = "C:\Applications" 39 | PublicHostNameConfiguration = "ComputerName" 40 | TentacleHomeDirectory = "C:\Octopus\OctopusTentacleHome" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Get-EnvironmentDetails.ps1: -------------------------------------------------------------------------------- 1 | function Get-EnvironmentDetails { 2 | [CmdletBinding()] 3 | [OutputType([HashTable])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $EnvironmentName, 14 | [Parameter(Mandatory=$false)] 15 | [string] 16 | $SpaceId 17 | ) 18 | 19 | $serverSupportsSpaces = Test-ServerSupportsSpaces $OctopusServerUrl 20 | if ($serverSupportsSpaces -and (-not [string]::IsNullOrEmpty($SpaceId))) { 21 | $spaceFragment = "$SpaceId/" 22 | } 23 | 24 | [PSCustomObject]$environment = Get-EnvironmentViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -EnvironmentName $EnvironmentName -SpaceFragment $spaceFragment 25 | 26 | return @{ 27 | Exists = $null -ne $environment; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Get-SpaceDetails.ps1: -------------------------------------------------------------------------------- 1 | function Get-SpaceDetails { 2 | [CmdletBinding()] 3 | [OutputType([HashTable])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $SpaceName 14 | ) 15 | 16 | [PSCustomObject]$space = Get-SpaceViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -SpaceName $SpaceName 17 | $exists = $null -ne $space 18 | $description = "" 19 | if ($exists) { 20 | $description = $space.Description 21 | } 22 | return @{ 23 | Exists = $exists; 24 | Description = $description; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Get-TentacleDetails.ps1: -------------------------------------------------------------------------------- 1 | function Get-TentacleDetails { 2 | [CmdletBinding()] 3 | [OutputType([HashTable])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $InstanceName, 14 | [Parameter(Mandatory=$false)] 15 | [string] 16 | $SpaceId 17 | ) 18 | 19 | [bool]$exists = Test-Path "c:\program files\Octopus Deploy\Tentacle\Tentacle.exe" 20 | [PSCustomObject]$machine = @{} 21 | [string[]]$environments = @() 22 | [string[]]$tenants = @() 23 | [string]$machinePolicy = $null 24 | [bool]$isOnline = $false 25 | [string]$communicationStyle = $Null 26 | 27 | if ($exists) { 28 | $thumbprint = Get-Thumbprint $InstanceName 29 | $serverSupportsSpaces = Test-ServerSupportsSpaces $OctopusServerUrl 30 | if ($serverSupportsSpaces -and (-not [string]::IsNullOrEmpty($SpaceId))) { 31 | $spaceFragment = "$SpaceId/" 32 | } 33 | $machine = Get-MachineViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -Thumbprint $thumbprint -SpaceFragment $spaceFragment 34 | $communicationStyle = $machine.Endpoint.CommunicationStyle 35 | $environments = (Get-Environments -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -SpaceFragment $spaceFragment) | Where-Object { $machine.EnvironmentIds -contains $_.Id } | Select-Object -ExpandProperty Name 36 | $tenants = (Get-Tenants -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -SpaceFragment $spaceFragment) | Where-Object { $machine.TenantIds -contains $_.Id } | Select-Object -ExpandProperty Name 37 | $machinePolicy = (Get-MachinePolicies -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -SpaceFragment $spaceFragment) | Where-Object { $machine.MachinePolicyId -contains $_.Id } | Select-Object -ExpandProperty Name 38 | $isOnline = Test-IsTentacleOnline -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -thumbprint $thumbprint -SpaceFragment $spaceFragment 39 | } 40 | 41 | return @{ 42 | Exists = $exists; 43 | IsRegisteredWithTheServer = $null -ne $machine; 44 | IsOnline = $isOnline 45 | IsListening = $communicationStyle -eq "TentaclePassive" 46 | IsPolling = $communicationStyle -eq "TentacleActive" 47 | Environments = $environments 48 | Roles = $machine.Roles 49 | DisplayName = $machine.Name 50 | Tenants = $tenants 51 | TenantTags = $machine.TenantTags 52 | Policy = $machinePolicy 53 | TenantedDeploymentParticipation = $machine.TenantedDeploymentParticipation 54 | Endpoint = $machine.Uri 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Get-WorkerDetails.ps1: -------------------------------------------------------------------------------- 1 | function Get-WorkerDetails { 2 | [CmdletBinding()] 3 | [OutputType([HashTable])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $InstanceName, 14 | [Parameter(Mandatory=$false)] 15 | [string] 16 | $SpaceId 17 | ) 18 | 19 | [bool]$exists = Test-Path "c:\program files\Octopus Deploy\Tentacle\Tentacle.exe" 20 | [PSCustomObject]$worker = @{} 21 | [bool]$isOnline = $false 22 | [string]$communicationStyle = $Null 23 | 24 | if ($exists) { 25 | $thumbprint = Get-Thumbprint $InstanceName 26 | $serverSupportsSpaces = Test-ServerSupportsSpaces $OctopusServerUrl 27 | if ($serverSupportsSpaces -and (-not [string]::IsNullOrEmpty($SpaceId))) { 28 | $spaceFragment = "$SpaceId/" 29 | } 30 | $worker = Get-WorkerViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -Thumbprint $thumbprint -SpaceFragment $spaceFragment 31 | $communicationStyle = $worker.Endpoint.CommunicationStyle 32 | $isOnline = Test-IsWorkerOnline -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -thumbprint $thumbprint -SpaceFragment $spaceFragment 33 | } 34 | 35 | return @{ 36 | Exists = $exists; 37 | IsRegisteredWithTheServer = $null -ne $worker; 38 | IsOnline = $isOnline 39 | IsListening = $communicationStyle -eq "TentaclePassive" 40 | IsPolling = $communicationStyle -eq "TentacleActive" 41 | DisplayName = $worker.Name 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Get-WorkerPoolDetails.ps1: -------------------------------------------------------------------------------- 1 | function Get-WorkerPoolDetails { 2 | [CmdletBinding()] 3 | [OutputType([HashTable])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $WorkerPoolName, 14 | [Parameter(Mandatory=$false)] 15 | [string] 16 | $SpaceId 17 | ) 18 | 19 | $serverSupportsSpaces = Test-ServerSupportsSpaces $OctopusServerUrl 20 | if ($serverSupportsSpaces -and (-not [string]::IsNullOrEmpty($SpaceId))) { 21 | $spaceFragment = "$SpaceId/" 22 | } 23 | 24 | [PSCustomObject]$workerPool = Get-WorkerPoolViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -WorkerPoolName $WorkerPoolName -SpaceFragment $spaceFragment 25 | 26 | return @{ 27 | Exists = $null -ne $workerPool; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-EnvironmentViaApi.ps1: -------------------------------------------------------------------------------- 1 | function Get-EnvironmentViaApi { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $EnvironmentName, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $url = "$OctopusServerUrl/api/$($spaceFragment)environments/all?api-key=$OctopusApiKey" 21 | $response = Invoke-RestMethod $url 22 | $environment = $response | Where-Object { $_.Name -eq $EnvironmentName } 23 | 24 | return $environment 25 | } 26 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-Environments.ps1: -------------------------------------------------------------------------------- 1 | function Get-Environments { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [AllowEmptyString()] 13 | [string] 14 | $spaceFragment 15 | ) 16 | 17 | $url = "$OctopusServerUrl/api/$($spaceFragment)environments/all?api-key=$OctopusApiKey" 18 | return Invoke-RestMethod $url 19 | } 20 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-MachinePolicies.ps1: -------------------------------------------------------------------------------- 1 | function Get-MachinePolicies { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [AllowEmptyString()] 13 | [string] 14 | $spaceFragment 15 | ) 16 | 17 | $url = "$OctopusServerUrl/api/$($spaceFragment)machinepolicies/all?api-key=$OctopusApiKey" 18 | return Invoke-RestMethod $url 19 | } 20 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-MachineViaApi.ps1: -------------------------------------------------------------------------------- 1 | function Get-MachineViaApi { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $thumbprint, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $url = "$OctopusServerUrl/api/$($spaceFragment)machines/all?api-key=$OctopusApiKey" 21 | $response = Invoke-RestMethod $url 22 | $machine = $response | Where-Object { $_.Thumbprint -eq $thumbprint } 23 | 24 | return $machine 25 | } 26 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-SpaceViaApi.ps1: -------------------------------------------------------------------------------- 1 | function Get-SpaceViaApi { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $SpaceName 14 | ) 15 | 16 | $url = "$OctopusServerUrl/api/spaces/all?api-key=$OctopusApiKey" 17 | $response = Invoke-RestMethod $url 18 | $space = $response | Where-Object { $_.Name -eq $SpaceName } 19 | 20 | return $space 21 | } 22 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-Tenants.ps1: -------------------------------------------------------------------------------- 1 | function Get-Tenants { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [AllowEmptyString()] 13 | [string] 14 | $spaceFragment 15 | ) 16 | 17 | $url = "$OctopusServerUrl/api/$($spaceFragment)tenants/all?api-key=$OctopusApiKey" 18 | return Invoke-RestMethod $url 19 | } 20 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-Thumbprint.ps1: -------------------------------------------------------------------------------- 1 | function Get-Thumbprint { 2 | [CmdletBinding()] 3 | [OutputType([string])] 4 | param ( 5 | [Parameter()] 6 | [string] 7 | $InstanceName 8 | ) 9 | 10 | $thumbprint = & "c:\program files\Octopus Deploy\Tentacle\Tentacle.exe" show-thumbprint --console --nologo --instance $InstanceName 11 | $thumbprint = $thumbprint -replace '==== ShowThumbprintCommand starting ====', '' 12 | $thumbprint = $thumbprint -replace 'The thumbprint of this Tentacle is: ', '' 13 | $thumbprint = $thumbprint -replace '==== ShowThumbprintCommand completed ====', '' 14 | $thumbprint = $thumbprint -replace '==== ShowThumbprintCommand ====', '' 15 | return $thumbprint.Trim() 16 | } 17 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-WorkerPoolViaApi.ps1: -------------------------------------------------------------------------------- 1 | function Get-WorkerPoolViaApi { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $WorkerPoolName, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $url = "$OctopusServerUrl/api/$($spaceFragment)workerpools/all?api-key=$OctopusApiKey" 21 | $response = Invoke-RestMethod $url 22 | $workerPool = $response | Where-Object { $_.Name -eq $WorkerPoolName } 23 | 24 | return $workerPool 25 | } 26 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Get-WorkerViaApi.ps1: -------------------------------------------------------------------------------- 1 | function Get-WorkerViaApi { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $thumbprint, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $url = "$OctopusServerUrl/api/$($spaceFragment)workers/all?api-key=$OctopusApiKey" 21 | $response = Invoke-RestMethod $url 22 | $worker = $response | Where-Object { $_.Thumbprint -eq $thumbprint } 23 | 24 | return $worker 25 | } 26 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Invoke-PollUntilMachineHasCompletedHealthCheck.ps1: -------------------------------------------------------------------------------- 1 | function Invoke-PollUntilMachineHasCompletedHealthCheck { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $thumbprint, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $counter = 1 21 | 22 | do 23 | { 24 | $machine = Get-MachineViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -thumbprint $thumbprint -SpaceFragment $spaceFragment 25 | if ($null -eq $machine) { break } 26 | if ($counter -gt 10) { break } 27 | if ($machine.StatusSummary -ne "This machine was recently added. Please perform a health check.") { break } 28 | Write-Information "Machine health check for $($machine.Name) has not yet completed. Waiting 5 seconds to try again." 29 | $counter++ 30 | Start-Sleep -seconds 5 31 | } while ($true) 32 | 33 | return $machine 34 | } 35 | 36 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Invoke-PollUntilWorkerHasCompletedHealthCheck copy.ps1: -------------------------------------------------------------------------------- 1 | function Invoke-PollUntilWorkerHasCompletedHealthCheck { 2 | [CmdletBinding()] 3 | [OutputType([PSCustomObject])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $thumbprint, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $counter = 1 21 | 22 | do 23 | { 24 | $worker = Get-WorkerViaApi -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -thumbprint $thumbprint -SpaceFragment $spaceFragment 25 | if ($null -eq $worker) { break } 26 | if ($counter -gt 10) { break } 27 | if ($worker.StatusSummary -ne "This machine was recently added. Please perform a health check.") { break } 28 | Write-Information "Machine health check for $($worker.Name) has not yet completed. Waiting 5 seconds to try again." 29 | $counter++ 30 | Start-Sleep -seconds 5 31 | } while ($true) 32 | 33 | return $worker 34 | } 35 | 36 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Test-IsTentacleOnline.ps1: -------------------------------------------------------------------------------- 1 | function Test-IsTentacleOnline { 2 | [CmdletBinding()] 3 | [OutputType([boolean])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $thumbprint, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $machine = Invoke-PollUntilMachineHasCompletedHealthCheck -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -thumbprint $thumbprint -spaceFragment $spaceFragment 21 | $status = $machine.Status 22 | if ("$status" -eq "") { 23 | $status = $machine.HealthStatus 24 | return $status -eq "Healthy" -or $status -eq "HasWarnings" 25 | } else { 26 | return $status -eq "Online" -or $status -eq "CalamariNeedsUpgrade" -or $status -eq "NeedsUpgrade" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Test-IsWorkerOnline.ps1: -------------------------------------------------------------------------------- 1 | function Test-IsWorkerOnline { 2 | [CmdletBinding()] 3 | [OutputType([boolean])] 4 | param ( 5 | [Parameter(Mandatory=$true)] 6 | [string] 7 | $OctopusServerUrl, 8 | [Parameter(Mandatory=$true)] 9 | [string] 10 | $OctopusApiKey, 11 | [Parameter(Mandatory=$true)] 12 | [string] 13 | $thumbprint, 14 | [Parameter(Mandatory=$true)] 15 | [AllowEmptyString()] 16 | [string] 17 | $spaceFragment 18 | ) 19 | 20 | $worker = Invoke-PollUntilWorkerHasCompletedHealthCheck -OctopusServerUrl $OctopusServerUrl -OctopusApiKey $OctopusApiKey -thumbprint $thumbprint -spaceFragment $spaceFragment 21 | $status = $worker.Status 22 | if ("$status" -eq "") { 23 | $status = $worker.HealthStatus 24 | return $status -eq "Healthy" -or $status -eq "HasWarnings" 25 | } else { 26 | return $status -eq "Online" -or $status -eq "CalamariNeedsUpgrade" -or $status -eq "NeedsUpgrade" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /E2ETests/Spec/TestHelpers/Private/Test-ServerSupportsSpaces.ps1: -------------------------------------------------------------------------------- 1 | function Test-ServerSupportsSpaces { 2 | [CmdletBinding()] 3 | [OutputType([boolean])] 4 | param ( 5 | [Parameter()] 6 | [string] 7 | $OctopusServerUrl 8 | ) 9 | 10 | $response = Invoke-RestMethod "$OctopusServerUrl/api/" 11 | 12 | return [System.Version]::Parse($response.version) -gt [System.Version]::Parse('2019.0.0') 13 | } 14 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_03_remove.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_03_remove { 2 | #we deliberately dont cleanup the octopus directory, as it contains logs & config 3 | it "should have left c:/Octopus alone" { 4 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 5 | } 6 | 7 | it "should have left the executable there" { 8 | # as there is another instance still on the box - we shouldn't have removed the binaries 9 | Test-Path 'C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe' -PathType Leaf | should -be $true 10 | } 11 | 12 | it "should have uninstalled the service" { 13 | (Get-Service 'OctopusDeploy' -ErrorAction SilentlyContinue) | should -be $null 14 | } 15 | 16 | it "should be able to get dsc configuration" { 17 | $ProgressPreference = "SilentlyContinue" 18 | $state = "" 19 | do { 20 | $state = (Get-DscLocalConfigurationManager).LCMState 21 | write-verbose "LCM state is $state" 22 | Start-Sleep -Seconds 2 23 | } while ($state -ne "Idle") 24 | 25 | Get-DSCConfiguration -ErrorAction Stop 26 | } 27 | 28 | it "should get true back from Test-DSCConfiguraiton" { 29 | $ProgressPreference = "SilentlyContinue" 30 | $state = "" 31 | do { 32 | $state = (Get-DscLocalConfigurationManager).LCMState 33 | write-verbose "LCM state is $state" 34 | Start-Sleep -Seconds 2 35 | } while ($state -ne "Idle") 36 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 37 | } 38 | 39 | Describe "Get-DSCConfigurationStatus" { 40 | BeforeDiscovery { 41 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 42 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 43 | } 44 | 45 | It "should have succeeded" { 46 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 47 | $status.Status | Should -be "Success" 48 | } 49 | 50 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 51 | $_.InDesiredState | should -be $true 52 | } 53 | 54 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 55 | $_.Error | should -be $null 56 | } 57 | } 58 | 59 | it "should not be listening on port 10943" { 60 | (Get-NetTCPConnection -LocalPort 10943 -ErrorAction SilentlyContinue).State | should -be $null 61 | } 62 | 63 | it "should not be listening on port 81" { 64 | (Get-NetTCPConnection -LocalPort 81 -ErrorAction SilentlyContinue).State | should -be $null 65 | } 66 | 67 | it "should not be listening on port 443" { 68 | (Get-NetTCPConnection -LocalPort 443 -ErrorAction SilentlyContinue).State | should -be $null 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_04_remove_second_node.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_04_remove_second_node { 2 | 3 | #we deliberately dont cleanup the octopus directory, as it contains logs & config 4 | it "should have left c:/Octopus alone" { 5 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 6 | } 7 | 8 | it "should have removed C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" { 9 | Test-Path 'C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe' | should -be $false 10 | } 11 | 12 | it "should have uninstalled the service" { 13 | Get-Service 'OctopusDeploy: HANode' -ErrorAction SilentlyContinue | should -be $null 14 | } 15 | 16 | it "should be able to get dsc configuration" { 17 | $ProgressPreference = "SilentlyContinue" 18 | $state = "" 19 | do { 20 | $state = (Get-DscLocalConfigurationManager).LCMState 21 | write-verbose "LCM state is $state" 22 | Start-Sleep -Seconds 2 23 | } while ($state -ne "Idle") 24 | 25 | Get-DSCConfiguration -ErrorAction Stop 26 | } 27 | 28 | it "should get true back from Test-DSCConfiguraiton" { 29 | $ProgressPreference = "SilentlyContinue" 30 | $state = "" 31 | do { 32 | $state = (Get-DscLocalConfigurationManager).LCMState 33 | write-verbose "LCM state is $state" 34 | Start-Sleep -Seconds 2 35 | } while ($state -ne "Idle") 36 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 37 | } 38 | 39 | Describe "Get-DSCConfigurationStatus" { 40 | BeforeDiscovery { 41 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 42 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 43 | } 44 | 45 | It "should have succeeded" { 46 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 47 | $status.Status | Should -be "Success" 48 | } 49 | 50 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 51 | $_.InDesiredState | should -be $true 52 | } 53 | 54 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 55 | $_.Error | should -be $null 56 | } 57 | } 58 | 59 | it "should not be listening on port 10943" { 60 | (Get-NetTCPConnection -LocalPort 10943 -ErrorAction SilentlyContinue).State | should -be $null 61 | } 62 | 63 | it "should not be listening on port 81" { 64 | (Get-NetTCPConnection -LocalPort 81 -ErrorAction SilentlyContinue).State | should -be $null 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_06_remove_custom_instance.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_06_remove_custom_instance { 2 | 3 | #we deliberately dont cleanup the octopus directory, as it contains logs & config 4 | it "should have left c:/Octopus alone" { 5 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 6 | } 7 | 8 | it "should have removed C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" { 9 | Test-Path 'C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe' | should -be $false 10 | } 11 | 12 | it "should have uninstalled the service" { 13 | Get-Service 'OctopusDeploy: MyOctopusServer' -ErrorAction SilentlyContinue | should -be $null 14 | } 15 | 16 | it "should be able to get dsc configuration" { 17 | $ProgressPreference = "SilentlyContinue" 18 | $state = "" 19 | do { 20 | $state = (Get-DscLocalConfigurationManager).LCMState 21 | write-verbose "LCM state is $state" 22 | Start-Sleep -Seconds 2 23 | } while ($state -ne "Idle") 24 | 25 | Get-DSCConfiguration -ErrorAction Stop 26 | } 27 | 28 | it "should get true back from Test-DSCConfiguraiton" { 29 | $ProgressPreference = "SilentlyContinue" 30 | $state = "" 31 | do { 32 | $state = (Get-DscLocalConfigurationManager).LCMState 33 | write-verbose "LCM state is $state" 34 | Start-Sleep -Seconds 2 35 | } while ($state -ne "Idle") 36 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 37 | } 38 | 39 | Describe "Get-DSCConfigurationStatus" { 40 | BeforeDiscovery { 41 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 42 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 43 | } 44 | 45 | It "should have succeeded" { 46 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 47 | $status.Status | Should -be "Success" 48 | } 49 | 50 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 51 | $_.InDesiredState | should -be $true 52 | } 53 | 54 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 55 | $_.Error | should -be $null 56 | } 57 | } 58 | 59 | it "should not be listening on port 10943" { 60 | (Get-NetTCPConnection -LocalPort 10943 -ErrorAction SilentlyContinue).State | should -be $null 61 | } 62 | 63 | it "should not be listening on port 81" { 64 | (Get-NetTCPConnection -LocalPort 81 -ErrorAction SilentlyContinue).State | should -be $null 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_09_watchdog_create.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_09_watchdog_create { 2 | 3 | it "should have installed the watchdog" { 4 | $ProgressPreference = "SilentlyContinue" 5 | $response = (& "C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" show-configuration --format json-hierarchical | out-string | ConvertFrom-Json) 6 | $LASTEXITCODE | Should -be 0 7 | $response.Octopus.Watchdog.Enabled | should -be "True" 8 | $response.Octopus.Watchdog.Interval | should -be "10" 9 | $response.Octopus.Watchdog.Instances | should -be "*" 10 | } 11 | 12 | it "should be able to get dsc configuration" { 13 | $ProgressPreference = "SilentlyContinue" 14 | $state = "" 15 | do { 16 | $state = (Get-DscLocalConfigurationManager).LCMState 17 | write-verbose "LCM state is $state" 18 | Start-Sleep -Seconds 2 19 | } while ($state -ne "Idle") 20 | 21 | Get-DSCConfiguration -ErrorAction Stop 22 | } 23 | 24 | it "should get true back from Test-DSCConfiguraiton" { 25 | $ProgressPreference = "SilentlyContinue" 26 | $state = "" 27 | do { 28 | $state = (Get-DscLocalConfigurationManager).LCMState 29 | write-verbose "LCM state is $state" 30 | Start-Sleep -Seconds 2 31 | } while ($state -ne "Idle") 32 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 33 | } 34 | 35 | Describe "Get-DSCConfigurationStatus" { 36 | BeforeDiscovery { 37 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 38 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 39 | } 40 | 41 | It "should have succeeded" { 42 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 43 | $status.Status | Should -be "Success" 44 | } 45 | 46 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 47 | $_.InDesiredState | should -be $true 48 | } 49 | 50 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 51 | $_.Error | should -be $null 52 | } 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_10_watchdog_delete.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_10_watchdog_delete { 2 | 3 | it "should have disabled the watchdog" { 4 | $ProgressPreference = "SilentlyContinue" 5 | $response = (& "C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" show-configuration --format json-hierarchical | out-string | ConvertFrom-Json) 6 | $LASTEXITCODE | Should -be 0 7 | $response.Octopus.Watchdog.Enabled | should -be "False" 8 | } 9 | 10 | it "should be able to get dsc configuration" { 11 | $ProgressPreference = "SilentlyContinue" 12 | $state = "" 13 | do { 14 | $state = (Get-DscLocalConfigurationManager).LCMState 15 | write-verbose "LCM state is $state" 16 | Start-Sleep -Seconds 2 17 | } while ($state -ne "Idle") 18 | 19 | Get-DSCConfiguration -ErrorAction Stop 20 | } 21 | 22 | it "should get true back from Test-DSCConfiguraiton" { 23 | $ProgressPreference = "SilentlyContinue" 24 | $state = "" 25 | do { 26 | $state = (Get-DscLocalConfigurationManager).LCMState 27 | write-verbose "LCM state is $state" 28 | Start-Sleep -Seconds 2 29 | } while ($state -ne "Idle") 30 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 31 | } 32 | 33 | Describe "Get-DSCConfigurationStatus" { 34 | BeforeDiscovery { 35 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 36 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 37 | } 38 | 39 | It "should have succeeded" { 40 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 41 | $status.Status | Should -be "Success" 42 | } 43 | 44 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 45 | $_.InDesiredState | should -be $true 46 | } 47 | 48 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 49 | $_.Error | should -be $null 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_11_remove.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_11_remove { 2 | 3 | #we deliberately dont cleanup the octopus directory, as it contains logs & config 4 | it "should have left c:/Octopus alone" { 5 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 6 | } 7 | 8 | it "should have removed C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" { 9 | Test-Path 'C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe' | should -be $false 10 | } 11 | 12 | it "should have uninstalled the service" { 13 | Get-Service 'OctopusDeploy' -ErrorAction SilentlyContinue | should -be $null 14 | } 15 | 16 | it "should be able to get dsc configuration" { 17 | $ProgressPreference = "SilentlyContinue" 18 | $state = "" 19 | do { 20 | $state = (Get-DscLocalConfigurationManager).LCMState 21 | write-verbose "LCM state is $state" 22 | Start-Sleep -Seconds 2 23 | } while ($state -ne "Idle") 24 | 25 | Get-DSCConfiguration -ErrorAction Stop 26 | } 27 | 28 | it "should get true back from Test-DSCConfiguraiton" { 29 | $ProgressPreference = "SilentlyContinue" 30 | $state = "" 31 | do { 32 | $state = (Get-DscLocalConfigurationManager).LCMState 33 | write-verbose "LCM state is $state" 34 | Start-Sleep -Seconds 2 35 | } while ($state -ne "Idle") 36 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 37 | } 38 | 39 | Describe "Get-DSCConfigurationStatus" { 40 | BeforeDiscovery { 41 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 42 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 43 | } 44 | 45 | It "should have succeeded" { 46 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 47 | $status.Status | Should -be "Success" 48 | } 49 | 50 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 51 | $_.InDesiredState | should -be $true 52 | } 53 | 54 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 55 | $_.Error | should -be $null 56 | } 57 | } 58 | 59 | it "should not be listening on port 10943" { 60 | (Get-NetTCPConnection -LocalPort 10943 -ErrorAction SilentlyContinue).State | should -be $null 61 | } 62 | 63 | it "should not be listening on port 81" { 64 | (Get-NetTCPConnection -LocalPort 81 -ErrorAction SilentlyContinue).State | should -be $null 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_13_remove.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_13_remove { 2 | 3 | #we deliberately dont cleanup the octopus directory, as it contains logs & config 4 | it "should have left c:/Octopus alone" { 5 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 6 | } 7 | 8 | it "should have removed C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" { 9 | Test-Path 'C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe' | should -be $false 10 | } 11 | 12 | it "should have uninstalled the service" { 13 | Get-Service 'OctopusDeploy' -ErrorAction SilentlyContinue | should -be $null 14 | } 15 | 16 | it "should be able to get dsc configuration" { 17 | $ProgressPreference = "SilentlyContinue" 18 | $state = "" 19 | do { 20 | $state = (Get-DscLocalConfigurationManager).LCMState 21 | write-verbose "LCM state is $state" 22 | Start-Sleep -Seconds 2 23 | } while ($state -ne "Idle") 24 | 25 | Get-DSCConfiguration -ErrorAction Stop 26 | } 27 | 28 | it "should get true back from Test-DSCConfiguraiton" { 29 | $ProgressPreference = "SilentlyContinue" 30 | $state = "" 31 | do { 32 | $state = (Get-DscLocalConfigurationManager).LCMState 33 | write-verbose "LCM state is $state" 34 | Start-Sleep -Seconds 2 35 | } while ($state -ne "Idle") 36 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 37 | } 38 | 39 | Describe "Get-DSCConfigurationStatus" { 40 | BeforeDiscovery { 41 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 42 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 43 | } 44 | 45 | It "should have succeeded" { 46 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 47 | $status.Status | Should -be "Success" 48 | } 49 | 50 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 51 | $_.InDesiredState | should -be $true 52 | } 53 | 54 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 55 | $_.Error | should -be $null 56 | } 57 | } 58 | 59 | it "should not be listening on port 10943" { 60 | (Get-NetTCPConnection -LocalPort 10943 -ErrorAction SilentlyContinue).State | should -be $null 61 | } 62 | 63 | it "should not be listening on port 81" { 64 | (Get-NetTCPConnection -LocalPort 81 -ErrorAction SilentlyContinue).State | should -be $null 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /E2ETests/Spec/server_scenario_14_install_without_configure.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe server_scenario_14_install_without_configure { 2 | 3 | # from previous install 4 | it "should have created c:/Octopus" { 5 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 6 | } 7 | 8 | it "should have created C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe" { 9 | Test-Path 'C:/Program Files/Octopus Deploy/Octopus/Octopus.Server.exe' -PathType Leaf | should -be $true 10 | } 11 | 12 | it "should have created instance registry entry" { 13 | Test-Path 'HKLM:\Software\Octopus\OctopusServer' | should -be $true 14 | } 15 | 16 | it "should have set the InstallLocation" { 17 | (Get-ItemProperty -Path 'HKLM:\Software\Octopus\OctopusServer' -Name "InstallLocation" -ErrorAction SilentlyContinue).InstallLocation | Should -be "C:\Program Files\Octopus Deploy\Octopus\" 18 | } 19 | 20 | it "should have removed C:/ProgramData/Octopus/OctopusServer/Instances/OctopusServer.config" { 21 | Test-Path 'C:/ProgramData/Octopus/OctopusServer/Instances/OctopusServer.config' | should -be $false 22 | } 23 | 24 | it "should have uninstalled the service" { 25 | Get-Service 'OctopusDeploy' -ErrorAction SilentlyContinue | should -be $null 26 | } 27 | 28 | it "should be able to get dsc configuration" { 29 | $ProgressPreference = "SilentlyContinue" 30 | $state = "" 31 | do { 32 | $state = (Get-DscLocalConfigurationManager).LCMState 33 | write-verbose "LCM state is $state" 34 | Start-Sleep -Seconds 2 35 | } while ($state -ne "Idle") 36 | 37 | Get-DSCConfiguration -ErrorAction Stop 38 | } 39 | 40 | it "should get true back from Test-DSCConfiguraiton" { 41 | $ProgressPreference = "SilentlyContinue" 42 | $state = "" 43 | do { 44 | $state = (Get-DscLocalConfigurationManager).LCMState 45 | write-verbose "LCM state is $state" 46 | Start-Sleep -Seconds 2 47 | } while ($state -ne "Idle") 48 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 49 | } 50 | 51 | Describe "Get-DSCConfigurationStatus" { 52 | BeforeDiscovery { 53 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 54 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 55 | } 56 | 57 | It "should have succeeded" { 58 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 59 | $status.Status | Should -be "Success" 60 | } 61 | 62 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 63 | $_.InDesiredState | should -be $true 64 | } 65 | 66 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 67 | $_.Error | should -be $null 68 | } 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /E2ETests/Spec/tentacle_scenario_05_watchdog_create.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe tentacle_scenario_05_watchdog_create { 2 | it "should have installed the watchdog" { 3 | $ProgressPreference = "SilentlyContinue" 4 | $response = (& "C:/Program Files/Octopus Deploy/Tentacle/Tentacle.exe" show-configuration | out-string | ConvertFrom-Json) 5 | $LASTEXITCODE | Should -be 0 6 | $response.Octopus.Watchdog.Enabled | should -be "True" 7 | $response.Octopus.Watchdog.Interval | should -be "10" 8 | $response.Octopus.Watchdog.Instances | should -be "*" 9 | } 10 | 11 | it "should be able to get dsc configuration" { 12 | $ProgressPreference = "SilentlyContinue" 13 | $state = "" 14 | do { 15 | $state = (Get-DscLocalConfigurationManager).LCMState 16 | write-verbose "LCM state is $state" 17 | Start-Sleep -Seconds 2 18 | } while ($state -ne "Idle") 19 | 20 | Get-DSCConfiguration -ErrorAction Stop 21 | } 22 | 23 | it "should get true back from Test-DSCConfiguraiton" { 24 | $ProgressPreference = "SilentlyContinue" 25 | $state = "" 26 | do { 27 | $state = (Get-DscLocalConfigurationManager).LCMState 28 | write-verbose "LCM state is $state" 29 | Start-Sleep -Seconds 2 30 | } while ($state -ne "Idle") 31 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 32 | } 33 | 34 | Describe "Get-DSCConfigurationStatus" { 35 | BeforeDiscovery { 36 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 37 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 38 | } 39 | 40 | It "should have succeeded" { 41 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 42 | $status.Status | Should -be "Success" 43 | } 44 | 45 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 46 | $_.InDesiredState | should -be $true 47 | } 48 | 49 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 50 | $_.Error | should -be $null 51 | } 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /E2ETests/Spec/tentacle_scenario_06_watchdog_delete.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe tentacle_scenario_06_watchdog_delete { 2 | it "should have disabled the watchdog" { 3 | $ProgressPreference = "SilentlyContinue" 4 | $response = (& "C:/Program Files/Octopus Deploy/Tentacle/Tentacle.exe" show-configuration | out-string | ConvertFrom-Json) 5 | $LASTEXITCODE | Should -be 0 6 | $response.Octopus.Watchdog.Enabled | should -be "False" 7 | } 8 | 9 | it "should be able to get dsc configuration" { 10 | $ProgressPreference = "SilentlyContinue" 11 | $state = "" 12 | do { 13 | $state = (Get-DscLocalConfigurationManager).LCMState 14 | write-verbose "LCM state is $state" 15 | Start-Sleep -Seconds 2 16 | } while ($state -ne "Idle") 17 | 18 | Get-DSCConfiguration -ErrorAction Stop 19 | } 20 | 21 | it "should get true back from Test-DSCConfiguraiton" { 22 | $ProgressPreference = "SilentlyContinue" 23 | $state = "" 24 | do { 25 | $state = (Get-DscLocalConfigurationManager).LCMState 26 | write-verbose "LCM state is $state" 27 | Start-Sleep -Seconds 2 28 | } while ($state -ne "Idle") 29 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 30 | } 31 | 32 | Describe "Get-DSCConfigurationStatus" { 33 | BeforeDiscovery { 34 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 35 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 36 | } 37 | 38 | It "should have succeeded" { 39 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 40 | $status.Status | Should -be "Success" 41 | } 42 | 43 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 44 | $_.InDesiredState | should -be $true 45 | } 46 | 47 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 48 | $_.Error | should -be $null 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /E2ETests/Spec/tentacle_scenario_07_remove.Tests.ps1: -------------------------------------------------------------------------------- 1 | describe tentacle_scenario_07_remove { 2 | 3 | it "should have kept c:/Octopus" { 4 | Test-Path 'c:/Octopus' -PathType Container | should -be $true 5 | } 6 | 7 | it "should have kept c:/Applications" { 8 | Test-Path 'c:/Applications' -PathType Container | should -be $true 9 | } 10 | 11 | it "should have removed C:/Program Files/Octopus Deploy/Tentacle/Tentacle.exe" { 12 | Test-Path 'C:/Program Files/Octopus Deploy/Tentacle/Tentacle.exe' | should -be $false 13 | } 14 | 15 | it "should have uninstalled the service" { 16 | Get-Service 'OctopusDeploy Tentacle' -ErrorAction SilentlyContinue | should -be $null 17 | } 18 | 19 | # should reg entry be deleted? 20 | # should instance file be deleted? 21 | 22 | it "should be able to get dsc configuration" { 23 | $ProgressPreference = "SilentlyContinue" 24 | $state = "" 25 | do 26 | { 27 | $state = (Get-DscLocalConfigurationManager).LCMState 28 | write-verbose "LCM state is $state" 29 | Start-Sleep -Seconds 2 30 | } while ($state -ne "Idle") 31 | 32 | Get-DSCConfiguration -ErrorAction Stop 33 | } 34 | 35 | it "should get true back from Test-DSCConfiguraiton" { 36 | $ProgressPreference = "SilentlyContinue" 37 | $state = "" 38 | do 39 | { 40 | $state = (Get-DscLocalConfigurationManager).LCMState 41 | write-verbose "LCM state is $state" 42 | Start-Sleep -Seconds 2 43 | } while ($state -ne "Idle") 44 | Test-DSCConfiguration -ErrorAction Stop | should -be $true 45 | } 46 | 47 | Describe "Get-DSCConfigurationStatus" { 48 | BeforeDiscovery { 49 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 50 | $resourceStates = @($status.ResourcesInDesiredState + $status.ResourcesNotInDesiredState) | where-object { $null -ne $_ } 51 | } 52 | 53 | It "should have succeeded" { 54 | $status = @(Get-DSCConfigurationStatus -ErrorAction Stop -All)[0] 55 | $status.Status | Should -be "Success" 56 | } 57 | 58 | It "should have applied <_.ResourceId> correctly" -ForEach $resourceStates { 59 | $_.InDesiredState | should -be $true 60 | } 61 | 62 | It "should have not received any errors from <_.ResourceId>" -ForEach $resourceStates { 63 | $_.Error | should -be $null 64 | } 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Octopus Deploy and contributors. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 4 | these files except in compliance with the License. You may obtain a copy of the 5 | License at 6 | 7 | https://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software distributed 10 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 | specific language governing permissions and limitations under the License. 13 | -------------------------------------------------------------------------------- /OctopusDSC/.gitattributes: -------------------------------------------------------------------------------- 1 | *.mof diff 2 | *.psd1 diff 3 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusEnvironment/cOctopusEnvironment.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusEnvironment")] 2 | class cOctopusEnvironment : OMI_BaseResource 3 | { 4 | [Required, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; 5 | [Key] string EnvironmentName; 6 | [Write, Required] string Url; 7 | [Write, EmbeddedInstance("MSFT_Credential")] string OctopusCredentials; 8 | [Write, EmbeddedInstance("MSFT_Credential")] string OctopusApiKey; 9 | }; 10 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusSeqLogger/cOctopusSeqLogger.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusSeqLogger")] 2 | class cOctopusSeqLogger : OMI_BaseResource 3 | { 4 | [Key, ValueMap{"OctopusServer", "Tentacle"},Values{"OctopusServer", "Tentacle"}] string InstanceType; 5 | [Required, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; 6 | [Write] string SeqServer; 7 | [Write, EmbeddedInstance("MSFT_Credential")] string SeqApiKey; 8 | [Write, EmbeddedInstance("MSFT_KeyValuePair")] string Properties[]; 9 | [Read] sint8 ConfigVersion; 10 | }; 11 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServer/cOctopusServer.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServer")] 2 | class cOctopusServer : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string Name; 5 | [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] string Ensure; 6 | [Write, ValueMap{"Started", "Stopped", "Installed"}, Values{"Started", "Stopped", "Installed"}] string State; 7 | [Write] string WebListenPrefix; 8 | [Write] string SqlDbConnectionString; 9 | [Write, EmbeddedInstance ("MSFT_Credential")] string OctopusAdminCredential; 10 | [Write] boolean AllowUpgradeCheck; 11 | [Write] boolean AllowCollectionOfUsageStatistics; 12 | [Write] string DownloadUrl; 13 | [Write] uint16 ListenPort; 14 | [Write] boolean ForceSSL; 15 | [Write] boolean HSTSEnabled; 16 | [Write] uint64 HSTSMaxAge; 17 | [Write, ValueMap{"UsernamePassword", "Domain", "Ignore"}, Values{"UsernamePassword", "Domain", "Ignore"}] string LegacyWebAuthenticationMode; 18 | [Write] boolean AutoLoginEnabled; 19 | [Write, EmbeddedInstance ("MSFT_Credential")] string OctopusServiceCredential; 20 | [Write] string HomeDirectory; 21 | [Write, EmbeddedInstance ("MSFT_Credential")] string OctopusMasterKey; 22 | [Write] string LicenseKey; 23 | [Write] boolean SkipLicenseCheck; 24 | [Write] boolean GrantDatabasePermissions; 25 | [Write, EmbeddedInstance ("MSFT_Credential")] string OctopusBuiltInWorkerCredential; 26 | [Write] string PackagesDirectory; 27 | [Write] string ArtifactsDirectory; 28 | [Write] string TaskLogsDirectory; 29 | [Write] boolean LogTaskMetrics; 30 | [Write] boolean LogRequestMetrics; 31 | [Write] uint64 TaskCap; 32 | }; 33 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerActiveDirectoryAuthentication/cOctopusServerActiveDirectoryAuthentication.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerActiveDirectoryAuthentication")] 2 | class cOctopusServerActiveDirectoryAuthentication : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required] boolean Enabled; 6 | [Write] boolean AllowFormsAuthenticationForDomainUsers; 7 | [Write] string ActiveDirectoryContainer; 8 | }; 9 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerAzureADAuthentication/cOctopusServerAzureADAuthentication.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerAzureADAuthentication")] 2 | class cOctopusServerAzureADAuthentication : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required] boolean Enabled; 6 | [Write] string Issuer; 7 | [Write] string ClientId; 8 | }; 9 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerGoogleAppsAuthentication/cOctopusServerGoogleAppsAuthentication.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerGoogleAppsAuthentication")] 2 | class cOctopusServerGoogleAppsAuthentication : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required] boolean Enabled; 6 | [Write] string ClientID; 7 | [Write] string HostedDomain; 8 | }; 9 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerGuestAuthentication/cOctopusServerGuestAuthentication.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerGuestAuthentication")] 2 | class cOctopusServerGuestAuthentication : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required] boolean Enabled; 6 | }; 7 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerOktaAuthentication/cOctopusServerOktaAuthentication.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerOktaAuthentication")] 2 | class cOctopusServerOktaAuthentication : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required] boolean Enabled; 6 | [Write] string Issuer; 7 | [Write] string ClientId; 8 | }; 9 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerSpace/cOctopusServerSpace.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerSpace")] 2 | class cOctopusServerSpace : OMI_BaseResource 3 | { 4 | [Required, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; 5 | [Key] string Name; 6 | [Write] string Description; 7 | [Write, Required] string Url; 8 | [Write] string SpaceManagersTeamMembers[]; 9 | [Write] string SpaceManagersTeams[]; 10 | [Write, EmbeddedInstance("MSFT_Credential")] string OctopusCredentials; 11 | [Write, EmbeddedInstance("MSFT_Credential")] string OctopusApiKey; 12 | }; 13 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerSslCertificate/cOctopusServerSslCertificate.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerSslCertificate")] 2 | class cOctopusServerSslCertificate : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required, Description("Thumbprint of the certificate")] string Thumbprint; 6 | [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] string Ensure; 7 | [Write, Required, ValueMap{"My", "WebHosting"}, Values{"My", "WebHosting"}] string StoreName; 8 | [Write] uint16 Port; 9 | }; -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerUsernamePasswordAuthentication/cOctopusServerUsernamePasswordAuthentication.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerUsernamePasswordAuthentication")] 2 | class cOctopusServerUsernamePasswordAuthentication : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required] boolean Enabled; 6 | }; 7 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusServerWatchdog/cOctopusServerWatchdog.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusServerWatchdog")] 2 | class cOctopusServerWatchdog : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required, Description("True to enable watchdog, false to disable")] boolean Enabled; 6 | [Write, Description("The interval in minutes. Defaults to checking every 15 minutes.")] UInt32 Interval; 7 | [Write, Description("Which instances to check. Use '*' to check all instances.")] string Instances; 8 | }; 9 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cOctopusWorkerPool/cOctopusWorkerPool.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cOctopusWorkerPool")] 2 | class cOctopusWorkerPool : OMI_BaseResource 3 | { 4 | [Required, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; 5 | [Key] string WorkerPoolName; 6 | [Write] string WorkerPoolDescription; 7 | [Write] string SpaceID; 8 | [Write, Required] string Url; 9 | [Write, EmbeddedInstance("MSFT_Credential")] string OctopusCredentials; 10 | [Write, EmbeddedInstance("MSFT_Credential")] string OctopusApiKey; 11 | }; 12 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cTentacleAgent/cTentacleAgent.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cTentacleAgent")] 2 | class cTentacleAgent : OMI_BaseResource 3 | { 4 | [Key] string Name; 5 | [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] string Ensure; 6 | [Write, ValueMap{"Started", "Stopped"}, Values{"Started", "Stopped"}] string State; 7 | 8 | [Write, ValueMap{"Listen", "Poll"}, Values{"Listen", "Poll"}] string CommunicationMode; 9 | [Write] string ApiKey; 10 | [Write] string OctopusServerUrl; 11 | [Write] string DisplayName; 12 | [Write] string Policy; 13 | [Write] string Environments[]; 14 | [Write] string Roles[]; 15 | [Write] string Tenants[]; 16 | [Write] string TenantTags[]; 17 | [Write] UInt32 ListenPort; 18 | [Write] UInt32 TentacleCommsPort; 19 | [Write] UInt32 ServerPort; 20 | [Write] string DefaultApplicationDirectory; 21 | [Write] string TentacleDownloadUrl; 22 | [Write] string TentacleDownloadUrl64; 23 | [Write, ValueMap{"PublicIp", "FQDN", "ComputerName", "Custom"}, Values{"PublicIp", "FQDN", "ComputerName", "Custom"}] string PublicHostNameConfiguration; 24 | [Write] string CustomPublicHostName; 25 | [Write] string TentacleHomeDirectory; 26 | [Write] Boolean RegisterWithServer; 27 | [Write] String OctopusServerThumbprint; 28 | [Write, EmbeddedInstance ("MSFT_Credential")] string TentacleServiceCredential; 29 | [Write] String WorkerPools[]; 30 | [Write, ValueMap{"Untenanted","TenantedOrUntenanted","Tenanted"}] String TenantedDeploymentParticipation; 31 | [Write] String Space; 32 | }; 33 | -------------------------------------------------------------------------------- /OctopusDSC/DSCResources/cTentacleWatchdog/cTentacleWatchdog.schema.mof: -------------------------------------------------------------------------------- 1 | [ClassVersion("1.0.0"), FriendlyName("cTentacleWatchdog")] 2 | class cTentacleWatchdog : OMI_BaseResource 3 | { 4 | [Key, Description("Name of the Octopus Server instance")] string InstanceName; 5 | [Write, Required, Description("True to enable watchdog, false to disable")] boolean Enabled; 6 | [Write, Description("The interval in minutes. Defaults to checking every 15 minutes.")] UInt32 Interval; 7 | [Write, Description("Which instances to check. Use '*' to check all instances.")] string Instances; 8 | }; 9 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/ExamplePassword.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OctopusDeploy/OctopusDSC/5e0ac67670ea4c38ded202fb16ab7076159e0813/OctopusDSC/Examples/ExamplePassword.txt -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusEnvironment.ps1: -------------------------------------------------------------------------------- 1 | # Creates an environment in an Octopus Server instance 2 | 3 | # deserialize a password from disk 4 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 5 | $creds = New-Object PSCredential "username", $password 6 | 7 | Configuration SampleConfig 8 | { 9 | Import-DscResource -Module OctopusDSC 10 | 11 | Node "localhost" 12 | { 13 | cOctopusEnvironment "Create 'Development' Environment" 14 | { 15 | Url = "https://octopus.example.com" 16 | Ensure = 'Present' 17 | EnvironmentName = 'Development' 18 | OctopusCredentials = $creds 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusSeqLogger.ps1: -------------------------------------------------------------------------------- 1 | # Configures an Octopus Server to send logs to Seq (https://getseq.net) 2 | 3 | # deserialize a password from disk 4 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 5 | $apiKeyCreds = New-Object PSCredential "ignored", $password 6 | 7 | Configuration SampleConfig 8 | { 9 | Import-DscResource -Module OctopusDSC 10 | 11 | Node "localhost" 12 | { 13 | cOctopusSeqLogger "Enable Logging to Seq for Octopus Server" 14 | { 15 | InstanceType = "OctopusServer" 16 | Ensure = 'Present' 17 | SeqServer = 'https://seq.example.com' 18 | SeqApiKey = $apiKeyCreds 19 | Properties = @{ Application = 'Octopus'; 'ApplicationSet' = 'BuildAndDeploy' } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServer.ps1: -------------------------------------------------------------------------------- 1 | # Installs an Octopus Server instance against a local database 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServer.md for all available options 3 | 4 | # deserialize a password from disk 5 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 6 | $AdminCred = New-Object PSCredential "Admin", $password 7 | 8 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 9 | $runOnServerCred = New-Object PSCredential "RunAsUserAccount", $password 10 | 11 | Configuration SampleConfig 12 | { 13 | Import-DscResource -Module OctopusDSC 14 | 15 | Node "localhost" 16 | { 17 | cOctopusServer OctopusServer 18 | { 19 | Ensure = "Present" 20 | State = "Started" 21 | 22 | # Server instance name. Leave it as 'OctopusServer' unless you have more 23 | # than one instance 24 | Name = "OctopusServer" 25 | 26 | # The url that Octopus will listen on 27 | WebListenPrefix = "http://localhost:81" 28 | 29 | SqlDbConnectionString = "Server=(local)\SQLEXPRESS;Database=Octopus;Trusted_Connection=True;" 30 | 31 | # The admin user to create 32 | OctopusAdminCredential = $AdminCred 33 | 34 | # optional parameters 35 | AllowUpgradeCheck = $true 36 | AllowCollectionOfUsageStatistics = $true 37 | ForceSSL = $false 38 | ListenPort = 10943 39 | DownloadUrl = "https://octopus.com/downloads/latest/WindowsX64/OctopusServer" 40 | 41 | # for pre 3.5, valid values are "UsernamePassword" or "Domain" 42 | # for 3.5 and above, only "Ignore" is valid (this is the default value) 43 | LegacyWebAuthenticationMode = "UsernamePassword" 44 | 45 | HomeDirectory = "C:\Octopus" 46 | TaskLogsDirectory = "E:\OctopusTaskLogs" # defaults to "$HomeDirectory\TaskLogs" 47 | PackagesDirectory = "E:\OctopusPackages" # defaults to "$HomeDirectory\Packages" 48 | ArtifactsDirectory = "E:\OctopusArtifacts" # defaults to "$HomeDirectory\Artifacts" 49 | 50 | LicenseKey = "Base64 encoded xml license key" 51 | SkipLicenseCheck = $false 52 | 53 | # the user account to use for run-on-server tasks (optional) 54 | OctopusBuiltInWorkerCredential = $runOnServerCred 55 | 56 | TaskCap = 10 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerActiveDirectoryAuthentication.ps1: -------------------------------------------------------------------------------- 1 | # Enables Active Directory authentication on the specified Octopus Server instance 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServerActiveDirectoryAuthentication.md 3 | # for all available options 4 | 5 | Configuration SampleConfig 6 | { 7 | Import-DscResource -Module OctopusDSC 8 | 9 | Node "localhost" 10 | { 11 | cOctopusServerActiveDirectoryAuthentication "Enable AD authentication" 12 | { 13 | InstanceName = "OctopusServer" 14 | Enabled = $true 15 | AllowFormsAuthenticationForDomainUsers = $false 16 | ActiveDirectoryContainer = "CN=Users,DC=GPN,DC=COM" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerAzureADAuthentication.ps1: -------------------------------------------------------------------------------- 1 | # Enables AzureAD authentication on the specified Octopus Server instance 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServerAzureADAuthentication.md 3 | # for all available options 4 | 5 | Configuration SampleConfig 6 | { 7 | Import-DscResource -Module OctopusDSC 8 | 9 | Node "localhost" 10 | { 11 | cOctopusServerAzureADAuthentication "Enable AzureAD authentication" 12 | { 13 | InstanceName = "OctopusServer" 14 | Enabled = $true 15 | Issuer = "https://login.microsoftonline.com/b91ebf6a-84be-4c6f-97f3-32a1d0a11c8a" 16 | ClientId = "0272262a-b31d-4acf-8891-56e96d302018" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerGoogleAppsAuthentication.ps1: -------------------------------------------------------------------------------- 1 | # Enables google apps authentication on the specified Octopus Server instance 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServerGoogleAppsAuthentication.md 3 | # for all available options 4 | 5 | Configuration SampleConfig 6 | { 7 | Import-DscResource -Module OctopusDSC 8 | 9 | Node "localhost" 10 | { 11 | cOctopusServerGoogleAppsAuthentication "Enable Google Apps authentication" 12 | { 13 | InstanceName = "OctopusServer" 14 | Enabled = $true 15 | ClientID = "5743519123-1232358520259-3634528" 16 | HostedDomain = "https://octopus.example.com" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerGuestAuthentication.ps1: -------------------------------------------------------------------------------- 1 | # Enables guest authentication on the specified Octopus Server instance 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServerGuestAuthentication.md 3 | # for all available options 4 | 5 | Configuration SampleConfig 6 | { 7 | Import-DscResource -Module OctopusDSC 8 | 9 | Node "localhost" 10 | { 11 | cOctopusServerGuestAuthentication "Enable Guest Authentication" 12 | { 13 | InstanceName = "OctopusServer" 14 | Enabled = $true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerOktaAuthentication.ps1: -------------------------------------------------------------------------------- 1 | # Enables okta authentication on the specified Octopus Server instance 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServerOktaAuthentication.md 3 | # for all available options 4 | 5 | Configuration SampleConfig 6 | { 7 | Import-DscResource -Module OctopusDSC 8 | 9 | Node "localhost" 10 | { 11 | cOctopusServerOktaAuthentication "Enable Okta authentication" 12 | { 13 | InstanceName = "OctopusServer" 14 | Enabled = $true 15 | Issuer = "https://dev-258250.oktapreview.com" 16 | ClientId = "752nx5basdskrsbqansE" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerSpace.ps1: -------------------------------------------------------------------------------- 1 | # Creates an environment in an Octopus Server instance 2 | 3 | # deserialize a password from disk 4 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 5 | $creds = New-Object PSCredential "username", $password 6 | 7 | Configuration SampleConfig 8 | { 9 | Import-DscResource -Module OctopusDSC 10 | 11 | Node "localhost" 12 | { 13 | cOctopusServerSpace "Ensure Integration Team Space exists" 14 | { 15 | Ensure = "Present" 16 | Name = "Integration Team" 17 | Description = "The top secret work of the Integration Team" 18 | SpaceManagersTeamMembers = @('admin') 19 | SpaceManagersTeams = @('Everyone') 20 | Url = "https://octopus.example.com" 21 | OctopusCredentials = $creds 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerSslCertificate.ps1: -------------------------------------------------------------------------------- 1 | # Binds an SSL certificate to the Octopus Server to allow Octopus to listen over https 2 | 3 | Configuration SampleConfig 4 | { 5 | Import-DscResource -Module OctopusDSC 6 | 7 | Node "localhost" 8 | { 9 | cOctopusServerSslCertificate "Bind SSL Certifiate" 10 | { 11 | InstanceName = "OctopusServer" 12 | Thumbprint = "c42a148bcd3959101f2e7a3d76edb924bff84b6b" 13 | Ensure = "Present" 14 | StoreName = "My" 15 | Port = 443 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerUsernamePasswordAuthentication.ps1: -------------------------------------------------------------------------------- 1 | # Enables username/password authentication on the specified Octopus Server instance 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cOctopusServerUsernamePasswordAuthentication.md 3 | # for all available options 4 | 5 | Configuration SampleConfig 6 | { 7 | Import-DscResource -Module OctopusDSC 8 | 9 | Node "localhost" 10 | { 11 | cOctopusServerUsernamePasswordAuthentication "Enable Username/Password Auth" 12 | { 13 | InstanceName = "OctopusServer" 14 | Enabled = $true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusServerWatchdog.ps1: -------------------------------------------------------------------------------- 1 | # Configures the Server watchdog to watch all instances 2 | 3 | Configuration SampleConfig 4 | { 5 | Import-DscResource -Module OctopusDSC 6 | 7 | Node "localhost" 8 | { 9 | cOctopusServerWatchdog "Enable Octopus Server Watchdog" 10 | { 11 | InstanceName = "OctopusServer" 12 | Enabled = $true 13 | Interval = 5 # minutes 14 | Instances = "*" # all instances 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cOctopusWorkerPool.ps1: -------------------------------------------------------------------------------- 1 | # Creates a Worker Pool in an Octopus Server instance 2 | 3 | # deserialize a password from disk 4 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 5 | $creds = New-Object PSCredential "username", $password 6 | 7 | Configuration SampleConfig 8 | { 9 | Import-DscResource -Module OctopusDSC 10 | 11 | Node "localhost" 12 | { 13 | cOctopusWorkerPool "Create 'Development' Environment" 14 | { 15 | Url = "https://octopus.example.com" 16 | Ensure = 'Present' 17 | WorkerPoolName = 'My Ops Worker Pool' 18 | WorkerPoolDescription = "A worker pool for operational tasks" 19 | SpaceID = "spaces-1" 20 | OctopusCredentials = $creds 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cTentacleAgent_ListeningTentacle.psm1: -------------------------------------------------------------------------------- 1 | # Configures a listening tentacle and automatically registers it with the specified server 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cTentacleAgent.md for all available options 3 | 4 | # use password from disk 5 | $password = Get-Content .\ExamplePassword.txt | ConvertTo-SecureString 6 | $ServiceCred = New-Object PSCredential "ServiceUser", $password 7 | 8 | Configuration SampleConfig 9 | { 10 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="ReviewUnusedParameter does not capture parameter usage within a scriptblock. See https://github.com/PowerShell/PSScriptAnalyzer/issues/1472")] 11 | param ([string]$ApiKey, [string]$OctopusServerUrl, [string[]]$Environments, [string[]]$Roles, [int]$ListenPort, [string]$Space) 12 | 13 | Import-DscResource -Module OctopusDSC 14 | 15 | Node "localhost" 16 | { 17 | cTentacleAgent OctopusTentacle 18 | { 19 | Ensure = "Present" 20 | State = "Started" 21 | 22 | # Tentacle instance name. Leave it as 'Tentacle' unless you have more 23 | # than one instance 24 | Name = "Tentacle" 25 | 26 | OctopusServerUrl = $OctopusServerUrl 27 | ApiKey = $ApiKey 28 | Environments = $Environments 29 | Roles = $Roles 30 | 31 | # Spaces are supported for Octopus Server 2019.1 and above. If null or not specified, it uses the default space 32 | Space = $Space 33 | 34 | # How Tentacle will communicate with the server 35 | CommunicationMode = "Listen" 36 | ListenPort = $ListenPort 37 | 38 | TentacleServiceCredential = $ServiceCred 39 | 40 | # Only required if the external port is different to the ListenPort. e.g the tentacle is behind a loadbalancer 41 | TentacleCommsPort = 10900 42 | 43 | # Where deployed applications will be installed by Octopus 44 | DefaultApplicationDirectory = "C:\Applications" 45 | 46 | # Where Octopus should store its working files, logs, packages etc 47 | TentacleHomeDirectory = "C:\Octopus" 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cTentacleAgent_PollingTentacle.psm1: -------------------------------------------------------------------------------- 1 | # Configures a polling tentacle and automatically registers it with the specified server 2 | # please see https://github.com/OctopusDeploy/OctopusDSC/blob/master/README-cTentacleAgent.md for all available options 3 | 4 | Configuration SampleConfig 5 | { 6 | [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSReviewUnusedParameter", "", Justification="ReviewUnusedParameter does not capture parameter usage within a scriptblock. See https://github.com/PowerShell/PSScriptAnalyzer/issues/1472")] 7 | param ([string]$ApiKey, [string]$OctopusServerUrl, [string[]]$Environments, [string[]]$Roles, [int]$ServerPort, [string]$Space) 8 | 9 | Import-DscResource -Module OctopusDSC 10 | 11 | Node "localhost" 12 | { 13 | cTentacleAgent OctopusTentacle 14 | { 15 | Ensure = "Present" 16 | State = "Started" 17 | 18 | # Tentacle instance name. Leave it as 'Tentacle' unless you have more 19 | # than one instance 20 | Name = "Tentacle" 21 | 22 | # Registration 23 | ApiKey = $ApiKey 24 | OctopusServerUrl = $OctopusServerUrl 25 | Environments = $Environments 26 | Roles = $Roles 27 | # Spaces are supported for Octopus Server 2019.1 and above. If null or not specified, it uses the default space 28 | Space = $Space 29 | 30 | # How Tentacle will communicate with the server 31 | CommunicationMode = "Poll" 32 | ServerPort = $ServerPort 33 | 34 | # Where deployed applications will be installed by Octopus 35 | DefaultApplicationDirectory = "C:\Applications" 36 | 37 | # Where Octopus should store its working files, logs, packages etc 38 | TentacleHomeDirectory = "C:\Octopus" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /OctopusDSC/Examples/cTentacleWatchdog.ps1: -------------------------------------------------------------------------------- 1 | # Configures the Tentacle watchdog to watch all Tentacle instances 2 | 3 | Configuration SampleConfig 4 | { 5 | Import-DscResource -Module OctopusDSC 6 | 7 | Node "localhost" 8 | { 9 | cTentacleWatchdog "Enable Tentacle Watchdog" 10 | { 11 | InstanceName = "Tentacle" 12 | Enabled = $true 13 | Interval = 5 # minutes 14 | Instances = "*" # all instances 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ChangeWebListenPrefix/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:82"; 12 | DownloadUrl = "https://octopus.com/downloads/latest/WindowsX64/OctopusServer"; 13 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 14 | OctopusAdminCredential = $cred; 15 | ListenPort = 10935; 16 | AllowCollectionOfUsageStatistics = $false; 17 | HomeDirectory = "C:\Octopus"; 18 | TaskLogsDirectory = "C:\Octopus\TaskLogs"; 19 | PackagesDirectory = "C:\Octopus\Packages"; 20 | ArtifactsDirectory = "C:\Octopus\Artifacts"; 21 | AutoLoginEnabled = $true 22 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 23 | } 24 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ChangeWebListenPrefix/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:83 --commsListenPort 10935 --home C:\Octopus --autoLoginEnabled True --hstsEnabled False --hstsMaxAge 3600", 3 | "service --stop --console --instance OctopusServer", 4 | "service --start --console --instance OctopusServer" 5 | ) 6 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ChangeWebListenPrefix/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:83"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | AutoLoginEnabled = $true 18 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ConfigureWhenMsiPreInstalled/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Present"; 6 | State = "Installed"; 7 | DownloadUrl = "https://octopus-testing.s3.amazonaws.com/server/Octopus.2018.2.7-x64.msi" 8 | } 9 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ConfigureWhenMsiPreInstalled/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --console --instance OctopusServer --config $($env:SystemDrive)\Octopus\OctopusServer-OctopusServer.config --home C:\Octopus", 3 | "database --instance OctopusServer --connectionstring Server=(local);Database=Octopus;Trusted_Connection=True; --create --grant NT AUTHORITY\SYSTEM", 4 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:82 --commsListenPort 10935 --autoLoginEnabled True --hstsEnabled False --hstsMaxAge 3600", 5 | "service --console --instance OctopusServer --stop", 6 | "admin --console --instance OctopusServer --username Admin --password S3cur3P4ssphraseHere!", 7 | "license --console --instance OctopusServer --free", 8 | "service --console --instance OctopusServer --install --reconfigure --stop", 9 | "service --start --console --instance OctopusServer" 10 | ) 11 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ConfigureWhenMsiPreInstalled/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:82"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | AutoLoginEnabled = $true 18 | DownloadUrl = "https://octopus-testing.s3.amazonaws.com/server/Octopus.2018.2.7-x64.msi" 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ConfigureWhenOlderMsiPreInstalled/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Present"; 6 | State = "Installed"; 7 | DownloadUrl = "https://octopus-testing.s3.amazonaws.com/server/Octopus.2018.2.7-x64.msi" 8 | } 9 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ConfigureWhenOlderMsiPreInstalled/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --console --instance OctopusServer --config $($env:SystemDrive)\Octopus\OctopusServer-OctopusServer.config --home C:\Octopus", 3 | "database --instance OctopusServer --connectionstring Server=(local);Database=Octopus;Trusted_Connection=True; --create --grant NT AUTHORITY\SYSTEM", 4 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:82 --commsListenPort 10935 --autoLoginEnabled True --hstsEnabled False --hstsMaxAge 3600", 5 | "service --console --instance OctopusServer --stop", 6 | "admin --console --instance OctopusServer --username Admin --password S3cur3P4ssphraseHere!", 7 | "license --console --instance OctopusServer --free", 8 | "service --console --instance OctopusServer --install --reconfigure --stop", 9 | "service --start --console --instance OctopusServer" 10 | ) 11 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/ConfigureWhenOlderMsiPreInstalled/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:82"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | AutoLoginEnabled = $true 18 | DownloadUrl = "https://octopus-testing.s3.amazonaws.com/server/Octopus.2018.2.8-x64.msi" 19 | } 20 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/EnableBuiltInWorkerOnExistingInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Present"; 3 | State = "Started"; 4 | DownloadUrl = "https://octopus.com/downloads/latest/WindowsX64/OctopusServer"; 5 | HomeDirectory = "C:\Octopus"; 6 | TaskLogsDirectory = "C:\Octopus\TaskLogs" 7 | LogTaskMetrics = $false; 8 | LogRequestMetrics = $false; 9 | ListenPort = 10935; 10 | WebListenPrefix = "http://localhost:82"; 11 | ForceSSL = $false 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusBuiltInWorkerCredential = [PSCredential]::Empty; 14 | OctopusMasterKey = [PSCredential]::Empty; 15 | } 16 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/EnableBuiltInWorkerOnExistingInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:82 --commsListenPort 10935 --home C:\Octopus --autoLoginEnabled True --hstsEnabled False --hstsMaxAge 3600", 3 | "path --console --instance OctopusServer --nugetRepository C:\Octopus\Packages --artifacts C:\Octopus\Artifacts" 4 | "admin --console --instance OctopusServer --username Admin --password S3cur3P4ssphraseHere!", 5 | "license --console --instance OctopusServer --free", 6 | "builtin-worker --instance OctopusServer --username runasuser --password S4cretPassword!", 7 | "service --stop --console --instance OctopusServer", 8 | "service --start --console --instance OctopusServer" 9 | ) 10 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/EnableBuiltInWorkerOnExistingInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | $pass = ConvertTo-SecureString "S4cretPassword!" -AsPlainText -Force 8 | $runAsCred = New-Object System.Management.Automation.PSCredential ("runasuser", $pass) 9 | 10 | return @{ 11 | Ensure = "Present"; 12 | State = "Started"; 13 | Name = "OctopusServer"; 14 | WebListenPrefix = "http://localhost:82"; 15 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 16 | OctopusAdminCredential = $cred; 17 | ListenPort = 10935; 18 | AllowCollectionOfUsageStatistics = $false; 19 | HomeDirectory = "C:\Octopus"; 20 | OctopusBuiltInWorkerCredential = $runAsCred 21 | AutoLoginEnabled = $true 22 | } 23 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/InstallOnly/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/InstallOnly/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @() 2 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/InstallOnly/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Present"; 6 | State = "Installed"; 7 | } 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/MasterKeySupplied/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/MasterKeySupplied/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --console --instance HANode --config $($env:SystemDrive)\Octopus\OctopusServer-HANode.config --home C:\ChezOctopusSecondNode", 3 | "database --instance HANode --connectionstring Server=(local);Database=Octopus;Trusted_Connection=True; --create --masterKey Nc91+1kfZszMpe7DMne8wg== --grant NT AUTHORITY\SYSTEM", 4 | "configure --console --instance HANode --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:82 --commsListenPort 10935 --hstsEnabled False --hstsMaxAge 3600", 5 | "service --stop --console --instance HANode", 6 | "admin --console --instance HANode --username Admin --password S3cur3P4ssphraseHere!", 7 | "license --console --instance HANode --free", 8 | "path --console --instance HANode --nugetRepository C:\ChezOctopusSecondNode\Packages --artifacts C:\ChezOctopusSecondNode\Artifacts --taskLogs C:\ChezOctopusSecondNode\TaskLogs", 9 | "service --console --instance HANode --install --reconfigure --stop", 10 | "service --start --console --instance HANode" 11 | ) 12 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/MasterKeySupplied/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $MasterKey = "Nc91+1kfZszMpe7DMne8wg==" 5 | $SecureMasterKey = ConvertTo-SecureString $MasterKey -AsPlainText -Force 6 | $MasterKeyCred = New-Object System.Management.Automation.PSCredential ("notused", $SecureMasterKey) 7 | 8 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 9 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 10 | 11 | return @{ 12 | Ensure = "Present"; 13 | State = "Started"; 14 | Name = "HANode"; 15 | WebListenPrefix = "http://localhost:82"; 16 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 17 | OctopusMasterKey = $MasterKeyCred; 18 | OctopusAdminCredential = $cred; 19 | ListenPort = 10935; 20 | AllowCollectionOfUsageStatistics = $false; 21 | HomeDirectory = "C:\ChezOctopusSecondNode"; 22 | } 23 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstallWithBuiltInWorker/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstallWithBuiltInWorker/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --console --instance OctopusServer --config $($env:SystemDrive)\Octopus\OctopusServer-OctopusServer.config --home C:\Octopus", 3 | "database --instance OctopusServer --connectionstring Server=(local);Database=Octopus;Trusted_Connection=True; --create --grant NT AUTHORITY\SYSTEM", 4 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:82 --commsListenPort 10935 --autoLoginEnabled False --hstsEnabled False --hstsMaxAge 3600", 5 | "service --stop --console --instance OctopusServer", 6 | "admin --console --instance OctopusServer --username Admin --password S3cur3P4ssphraseHere!", 7 | "license --console --instance OctopusServer --free", 8 | "path --console --instance OctopusServer --nugetRepository C:\Octopus\Packages --artifacts C:\Octopus\Artifacts --taskLogs C:\Octopus\TaskLogs", 9 | "service --console --instance OctopusServer --install --reconfigure --stop", 10 | "builtin-worker --instance OctopusServer --username runasuser --password S4cretPassword!", 11 | "service --start --console --instance OctopusServer" 12 | ) 13 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstallWithBuiltInWorker/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | $pass = ConvertTo-SecureString "S4cretPassword!" -AsPlainText -Force 8 | $runAsCred = New-Object System.Management.Automation.PSCredential ("runasuser", $pass) 9 | 10 | return @{ 11 | Ensure = "Present"; 12 | State = "Started"; 13 | Name = "OctopusServer"; 14 | WebListenPrefix = "http://localhost:82"; 15 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 16 | OctopusAdminCredential = $cred; 17 | ListenPort = 10935; 18 | AllowCollectionOfUsageStatistics = $false; 19 | HomeDirectory = "C:\Octopus"; 20 | OctopusBuiltInWorkerCredential = $runAsCred 21 | AutoLoginEnabled = $false 22 | } -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --console --instance OctopusServer --config $($env:SystemDrive)\Octopus\OctopusServer-OctopusServer.config --home C:\Octopus", 3 | "database --instance OctopusServer --connectionstring Server=(local);Database=Octopus;Trusted_Connection=True; --create --grant NT AUTHORITY\SYSTEM", 4 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:81 --commsListenPort 10935 --hstsEnabled False --hstsMaxAge 3600", 5 | "service --stop --console --instance OctopusServer", 6 | "admin --console --instance OctopusServer --username Admin --password S3cur3P4ssphraseHere!", 7 | "license --console --instance OctopusServer --free", 8 | "path --console --instance OctopusServer --nugetRepository F:\Packages --artifacts G:\Artifacts --taskLogs E:\TaskLogs", 9 | "node --console --instance OctopusServer --taskCap 10", 10 | "service --console --instance OctopusServer --install --reconfigure --stop", 11 | "service --start --console --instance OctopusServer" 12 | ) 13 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:81"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | TaskLogsDirectory = "E:\TaskLogs"; 18 | PackagesDirectory = "F:\Packages"; 19 | ArtifactsDirectory = "G:\Artifacts"; 20 | TaskCap = 10; 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstanceWithMetrics/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstanceWithMetrics/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --console --instance OctopusServer --config $($env:SystemDrive)\Octopus\OctopusServer-OctopusServer.config --home C:\Octopus", 3 | "database --instance OctopusServer --connectionstring Server=(local);Database=Octopus;Trusted_Connection=True; --create --grant NT AUTHORITY\SYSTEM", 4 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:81 --commsListenPort 10935 --hstsEnabled False --hstsMaxAge 3600", 5 | "service --stop --console --instance OctopusServer", 6 | "admin --console --instance OctopusServer --username Admin --password S3cur3P4ssphraseHere!", 7 | "license --console --instance OctopusServer --free", 8 | "path --console --instance OctopusServer --nugetRepository C:\Octopus\Packages --artifacts C:\Octopus\Artifacts --taskLogs C:\Octopus\TaskLogs", 9 | "service --console --instance OctopusServer --install --reconfigure --stop", 10 | "service --start --console --instance OctopusServer" 11 | ) 12 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/NewInstanceWithMetrics/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:81"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | } 18 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UninstallingPreInstalledInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Present"; 6 | State = "Installed"; 7 | } 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UninstallingPreInstalledInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | ) 3 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UninstallingPreInstalledInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | Name = "Octopus" 4 | State = "Stopped"; 5 | } 6 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UninstallingRunningInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Octopus"; 11 | WebListenPrefix = "http://localhost:81"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | } 18 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UninstallingRunningInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "service --stop --console --instance Octopus", 3 | "service --stop --uninstall --console --instance Octopus", 4 | "delete-instance --console --instance Octopus" 5 | ) 6 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UninstallingRunningInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Absent"; 9 | Name = "Octopus" 10 | State = "Stopped"; 11 | WebListenPrefix = "http://localhost:81"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | } 15 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UpgradeExistingInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | DownloadUrl = "https://octopus-testing.s3.amazonaws.com/server/Octopus.2018.2.7-x64.msi" 11 | Name = "OctopusServer"; 12 | WebListenPrefix = "http://localhost:82"; 13 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 14 | OctopusAdminCredential = $cred; 15 | OctopusBuiltInWorkerCredential = [PSCredential]::Empty; 16 | OctopusMasterKey = [PSCredential]::Empty; 17 | ForceSSL = $false; 18 | ListenPort = 10935; 19 | AllowCollectionOfUsageStatistics = $false; 20 | HomeDirectory = "C:\Octopus"; 21 | TaskLogsDirectory = "C:\Octopus\TaskLogs"; 22 | PackagesDirectory = "C:\Octopus\Packages"; 23 | ArtifactsDirectory = "C:\Octopus\Artifacts"; 24 | AutoLoginEnabled = $true 25 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 26 | SkipLicenseCheck = $true; 27 | } 28 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UpgradeExistingInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "service --stop --console --instance OctopusServer", 3 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL False --webListenPrefixes http://localhost:82 --commsListenPort 10935 --home C:\Octopus --autoLoginEnabled True --hstsEnabled False --hstsMaxAge 3600", 4 | "node --console --instance OctopusServer --taskCap 10", 5 | "database --upgrade --instance OctopusServer --skipLicenseCheck", 6 | "service --start --console --instance OctopusServer" 7 | ) 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/UpgradeExistingInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "OctopusServer"; 11 | WebListenPrefix = "http://localhost:82"; 12 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 13 | OctopusAdminCredential = $cred; 14 | ListenPort = 10935; 15 | AllowCollectionOfUsageStatistics = $false; 16 | HomeDirectory = "C:\Octopus"; 17 | AutoLoginEnabled = $true 18 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 19 | SkipLicenseCheck = $true; 20 | TaskCap = 10; 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/WhenNothingChanges/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $octopusAdminCredential = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | $octopusBuiltInWorkerCredential = New-Object System.Management.Automation.PSCredential ("svcBuiltInWorker", $pass) 7 | 8 | $MasterKey = "Nc91+1kfZszMpe7DMne8wg==" 9 | $SecureMasterKey = ConvertTo-SecureString $MasterKey -AsPlainText -Force 10 | $MasterKeyCred = New-Object System.Management.Automation.PSCredential ("notused", $SecureMasterKey) 11 | 12 | return @{ 13 | Ensure = "Present"; 14 | State = "Started"; 15 | Name = "OctopusServer"; 16 | WebListenPrefix = "http://localhost:82"; 17 | DownloadUrl = "https://octopus.com/downloads/latest/WindowsX64/OctopusServer"; 18 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 19 | OctopusAdminCredential = $octopusAdminCredential; 20 | ListenPort = 10935; 21 | AllowCollectionOfUsageStatistics = $false; 22 | HomeDirectory = "C:\Octopus"; 23 | TaskLogsDirectory = "C:\Octopus\TaskLogs"; 24 | PackagesDirectory = "C:\Octopus\Packages"; 25 | ArtifactsDirectory = "C:\Octopus\Artifacts"; 26 | AutoLoginEnabled = $true 27 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 28 | OctopusMasterKey = $MasterKeyCred; 29 | ForceSSL = $true; 30 | OctopusBuiltInWorkerCredential = $octopusBuiltInWorkerCredential; 31 | } 32 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/WhenNothingChanges/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "configure --console --instance OctopusServer --upgradeCheck True --upgradeCheckWithStatistics False --webForceSSL True --webListenPrefixes http://localhost:82 --commsListenPort 10935 --home C:\Octopus --autoLoginEnabled True --hstsEnabled False --hstsMaxAge 3600" 3 | ) 4 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/OctopusServerExeInvocationFiles/WhenNothingChanges/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $octopusAdminCredential = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | $octopusBuiltInWorkerCredential = New-Object System.Management.Automation.PSCredential ("svcBuiltInWorker", $pass) 7 | 8 | $MasterKey = "Nc91+1kfZszMpe7DMne8wg==" 9 | $SecureMasterKey = ConvertTo-SecureString $MasterKey -AsPlainText -Force 10 | $MasterKeyCred = New-Object System.Management.Automation.PSCredential ("notused", $SecureMasterKey) 11 | 12 | return @{ 13 | Ensure = "Present"; 14 | State = "Started"; 15 | Name = "OctopusServer"; 16 | WebListenPrefix = "http://localhost:82"; 17 | SqlDbConnectionString = "Server=(local);Database=Octopus;Trusted_Connection=True;"; 18 | OctopusAdminCredential = $octopusAdminCredential; 19 | ListenPort = 10935; 20 | AllowCollectionOfUsageStatistics = $false; 21 | HomeDirectory = "C:\Octopus"; 22 | AutoLoginEnabled = $true 23 | LicenseKey = "PExpY2Vuc2UgU2lnbmF0dXJlPSJoUE5sNFJvYWx2T2wveXNUdC9Rak4xcC9PeVVQc0l6b0FJS282bk9VM1kzMUg4OHlqaUI2cDZGeFVDWEV4dEttdWhWV3hVSTR4S3dJcU9vMTMyVE1FUT09Ij4gICA8TGljZW5zZWRUbz5PY3RvVGVzdCBDb21wYW55PC9MaWNlbnNlZFRvPiAgIDxMaWNlbnNlS2V5PjI0NDE0LTQ4ODUyLTE1NDI3LTQxMDgyPC9MaWNlbnNlS2V5PiAgIDxWZXJzaW9uPjIuMDwhLS0gTGljZW5zZSBTY2hlbWEgVmVyc2lvbiAtLT48L1ZlcnNpb24+ICAgPFZhbGlkRnJvbT4yMDE3LTEyLTA4PC9WYWxpZEZyb20+ICAgPE1haW50ZW5hbmNlRXhwaXJlcz4yMDIzLTAxLTAxPC9NYWludGVuYW5jZUV4cGlyZXM+ICAgPFByb2plY3RMaW1pdD5VbmxpbWl0ZWQ8L1Byb2plY3RMaW1pdD4gICA8TWFjaGluZUxpbWl0PjE8L01hY2hpbmVMaW1pdD4gICA8VXNlckxpbWl0PlVubGltaXRlZDwvVXNlckxpbWl0PiA8L0xpY2Vuc2U+" 24 | OctopusMasterKey = $MasterKeyCred; 25 | ForceSSL = $true; 26 | OctopusBuiltInWorkerCredential = $octopusBuiltInWorkerCredential; 27 | } 28 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/SampleConfigs/octopus.server.exe-output-clean.json: -------------------------------------------------------------------------------- 1 | { 2 | "Octopus": { 3 | "Communications": { 4 | "ServicesPort": 10943, 5 | "WebSocketPrefix": null 6 | }, 7 | "Storage": { 8 | "ExternalDatabaseConnectionString": "Data Source=sqlserverinstance.doesnotexist.com;Initial Catalog=4ed0bf7f-c2cc-4fbe-b2dc-6630b60f9a66;User ID=4ed0bf7f-c2cc-4fbe-b2dc-6630b60f9a66;Password=SuperSecr3tP4ssword!!" 9 | }, 10 | "Server": { 11 | "NodeName": "EC2AMAZ-16C2OU9", 12 | "TaskCap": 5, 13 | "MaintenanceMode": false, 14 | "License": "THISISANOBFUSCATEDLICENCEKEY==" 15 | }, 16 | "Home": "C:\\Octopus", 17 | "Node": { 18 | "Cache": "C:\\Octopus\\OctopusServer" 19 | }, 20 | "PackageCache": { 21 | "DaysToCachePackages": 1 22 | }, 23 | "Tasks": { 24 | "MaxConcurrentTasks": 0, 25 | "RecordTaskMetrics": true 26 | }, 27 | "Upgrades": { 28 | "AllowChecking": false, 29 | "IncludeStatistics": false, 30 | "NotificationMode": "NeverShow" 31 | }, 32 | "Azure": { 33 | "PowerShellModule": null 34 | }, 35 | "Deployment": { 36 | "CustomBundledPackageDirectory": null 37 | }, 38 | "Watchdog": { 39 | "Enabled": false, 40 | "Interval": 0, 41 | "Instances": "*" 42 | }, 43 | "BuiltInWorker": { 44 | "CustomAccountUserName": "svcScriptRunner", 45 | "CustomAccountDomain": null 46 | }, 47 | "WebPortal": { 48 | "ListenPrefixes": "http://NONEXISTENTINSTANCE.octopus.app:80,https://NONEXISTENTINSTANCE.octopus.app:443", 49 | "ForceSSL": "True", 50 | "RequestLoggingEnabled": "False", 51 | "RequestMetricLoggingEnabled": "True", 52 | "CorsWhitelist": null, 53 | "XFrameOptionAllowFrom": null, 54 | "HttpStrictTransportSecurityEnabled": "True", 55 | "HttpStrictTransportSecurityMaxAge": "31536000", 56 | "ContentSecurityPolicyEnabled": "True", 57 | "ReferrerPolicy": "no-referrer", 58 | "TrustedRedirectUrls": null, 59 | "AutoLoginEnabled": "False" 60 | }, 61 | "Folders": { 62 | "LogDirectory": "E:\\Octopus\\TaskLogs", 63 | "ArtifactsDirectory": "E:\\Octopus\\Artifacts", 64 | "PackagesDirectory": "E:\\Octopus\\Packages" 65 | }, 66 | "Proxy": { 67 | "UseDefaultProxy": "False", 68 | "ProxyHost": null, 69 | "ProxyPort": null, 70 | "ProxyUsername": null, 71 | "ProxyPassword": null 72 | }, 73 | "AzureAD": { 74 | "IsEnabled": "False", 75 | "Issuer": null, 76 | "ClientId": null, 77 | "Scope": "openid%20profile%20email", 78 | "RedirectUri": "/api/users/authenticatedToken/AzureAD", 79 | "NameClaimType": "name", 80 | "AllowAutoUserCreation": "True", 81 | "RoleClaimType": "roles" 82 | }, 83 | "GoogleApps": { 84 | "IsEnabled": "False", 85 | "Issuer": "https://accounts.google.com", 86 | "ClientId": null, 87 | "Scope": "openid%20profile%20email", 88 | "RedirectUri": "/api/users/authenticatedToken/GoogleApps", 89 | "NameClaimType": "name", 90 | "AllowAutoUserCreation": "True", 91 | "HostedDomain": null 92 | }, 93 | "Okta": { 94 | "IsEnabled": "False", 95 | "Issuer": null, 96 | "ClientId": null, 97 | "Scope": "openid%20profile%20email%20groups", 98 | "RedirectUri": "/api/users/authenticatedToken/Okta", 99 | "NameClaimType": "name", 100 | "AllowAutoUserCreation": "True", 101 | "RoleClaimType": "groups", 102 | "UsernameClaimType": "preferred_username" 103 | }, 104 | "UsernamePassword": { 105 | "IsEnabled": "True" 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/SampleConfigs/octopus.server.exe.nlog-when-not-configured.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/SampleConfigs/octopus.server.exe.nlog-with-old-sync-configuration-with-api-key.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/SampleConfigs/octopus.server.exe.nlog-with-old-sync-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/SampleConfigs/octopus.server.exe.nlog-with-valid-configuration-with-api-key.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/SampleConfigs/octopus.server.exe.nlog-with-valid-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/InstallOnly/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/InstallOnly/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --instance Tentacle --config C:\Octopus\Tentacle\Tentacle.config --console", 3 | "new-certificate --instance Tentacle --console", 4 | "configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --port 10933", 5 | "service --install --instance Tentacle --console --reconfigure" 6 | ) 7 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/InstallOnly/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Present"; 6 | State = "Stopped"; 7 | Name = "Tentacle"; 8 | RegisterWithServer = $false; 9 | TentacleHomeDirectory = "C:\Octopus" 10 | DefaultApplicationDirectory = "C:\Applications" 11 | } 12 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --instance Tentacle --config C:\Octopus\Tentacle\Tentacle.config --console", 3 | "new-certificate --instance Tentacle --console", 4 | "configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --port 10935", 5 | "service --install --instance Tentacle --console --reconfigure --username Admin --password S3cur3P4ssphraseHere!", 6 | "register-with --instance Tentacle --server http://localhost:81 --name My Tentacle --apiKey API-1234 --force --console --comms-style TentaclePassive --publicHostName mytestserver.local --environment dev --environment prod --role web-server" 7 | ) 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | DisplayName = "My Tentacle"; 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Listen" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewInstanceInSpace/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewInstanceInSpace/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --instance Tentacle --config C:\Octopus\Tentacle\Tentacle.config --console", 3 | "new-certificate --instance Tentacle --console", 4 | "configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --port 10935", 5 | "service --install --instance Tentacle --console --reconfigure --username Admin --password S3cur3P4ssphraseHere!", 6 | "register-with --instance Tentacle --server http://localhost:81 --name My Tentacle --apiKey API-1234 --force --console --space My Space --comms-style TentaclePassive --publicHostName mytestserver.local --environment dev --environment prod --role web-server" 7 | ) 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewInstanceInSpace/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | DisplayName = "My Tentacle"; 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Listen" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | Space = "My Space" 22 | } 23 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewPollingTentacle/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewPollingTentacle/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --instance Tentacle --config C:\Octopus\Tentacle\Tentacle.config --console", 3 | "new-certificate --instance Tentacle --console", 4 | "configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --noListen True", 5 | "service --install --instance Tentacle --console --reconfigure --username Admin --password S3cur3P4ssphraseHere!", 6 | "register-with --instance Tentacle --server http://localhost:81 --name My Tentacle --apiKey API-1234 --force --console --comms-style TentacleActive --server-comms-port 10943 --environment dev --environment prod --role web-server" 7 | ) 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewPollingTentacle/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | DisplayName = "My Tentacle"; 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Poll" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewWorker/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewWorker/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --instance Tentacle --config C:\Octopus\Tentacle\Tentacle.config --console", 3 | "new-certificate --instance Tentacle --console", 4 | "configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --port 10935", 5 | "service --install --instance Tentacle --console --reconfigure --username Admin --password S3cur3P4ssphraseHere!", 6 | "register-worker --instance Tentacle --server http://localhost:81 --name My Worker --force --apiKey API-1234 --comms-style TentaclePassive --publicHostName mytestserver.local --policy My machine policy --workerpool NodeJSWorker" 7 | ) 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewWorker/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | DisplayName = "My Worker"; 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Listen" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | WorkerPools = @("NodeJSWorker") 22 | Policy = "My machine policy" 23 | } 24 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewWorkerInSpace/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | return @{ 2 | Ensure = "Absent"; 3 | State = "Stopped" 4 | } 5 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewWorkerInSpace/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "create-instance --instance Tentacle --config C:\Octopus\Tentacle\Tentacle.config --console", 3 | "new-certificate --instance Tentacle --console", 4 | "configure --instance Tentacle --home C:\Octopus --app C:\Applications --console --port 10935", 5 | "service --install --instance Tentacle --console --reconfigure --username Admin --password S3cur3P4ssphraseHere!", 6 | "register-worker --instance Tentacle --server http://localhost:81 --name My Worker --force --space My Space --apiKey API-1234 --comms-style TentaclePassive --publicHostName mytestserver.local --workerpool NodeJSWorker" 7 | ) 8 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/NewWorkerInSpace/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | DisplayName = "My Worker"; 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Listen" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | WorkerPools = @("NodeJSWorker") 22 | Space = "My Space" 23 | } 24 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UninstallingRunningInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | OctopusServerUrl = "http://localhost:81"; 12 | ApiKey = "API-1234"; 13 | Environments = @("dev", "prod"); 14 | Roles = "web-server"; 15 | CommunicationMode = "Listen" 16 | ListenPort = 10935; 17 | TentacleServiceCredential = $cred 18 | DefaultApplicationDirectory = "C:\Applications" 19 | TentacleHomeDirectory = "C:\Octopus" 20 | } 21 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UninstallingRunningInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "deregister-from --instance Tentacle --server http://localhost:81 --apiKey API-1234 --console" 3 | ) 4 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UninstallingRunningInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Absent"; 6 | Name = "Tentacle"; 7 | OctopusServerUrl = "http://localhost:81"; 8 | ApiKey = "API-1234"; 9 | } 10 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UninstallingRunningInstanceInSpace/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | OctopusServerUrl = "http://localhost:81"; 12 | ApiKey = "API-1234"; 13 | Environments = @("dev", "prod"); 14 | Roles = "web-server"; 15 | CommunicationMode = "Listen" 16 | ListenPort = 10935; 17 | TentacleServiceCredential = $cred 18 | DefaultApplicationDirectory = "C:\Applications" 19 | TentacleHomeDirectory = "C:\Octopus" 20 | } 21 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UninstallingRunningInstanceInSpace/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @( 2 | "deregister-from --instance Tentacle --server http://localhost:81 --apiKey API-1234 --console --space My Space" 3 | ) 4 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UninstallingRunningInstanceInSpace/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | return @{ 5 | Ensure = "Absent"; 6 | Name = "Tentacle"; 7 | OctopusServerUrl = "http://localhost:81"; 8 | ApiKey = "API-1234"; 9 | Space = "My Space" 10 | } 11 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UpgradeExistingInstance/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | TentacleDownloadUrl64 = "https://octopus-testing.s3.amazonaws.com/server/Tentacle.5.0.2-x64.msi" 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Listen" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UpgradeExistingInstance/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @() 2 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UpgradeExistingInstance/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | OctopusServerUrl = "http://localhost:81"; 12 | ApiKey = "API-1234"; 13 | Environments = @("dev", "prod"); 14 | Roles = "web-server"; 15 | CommunicationMode = "Listen" 16 | ListenPort = 10935; 17 | TentacleServiceCredential = $cred 18 | DefaultApplicationDirectory = "C:\Applications" 19 | TentacleHomeDirectory = "C:\Octopus" 20 | } 21 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UpgradeExistingInstanceInSpace/CurrentState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | TentacleDownloadUrl64 = "https://octopus-testing.s3.amazonaws.com/server/Tentacle.5.0.2-x64.msi" 12 | OctopusServerUrl = "http://localhost:81"; 13 | ApiKey = "API-1234"; 14 | Environments = @("dev", "prod"); 15 | Roles = "web-server"; 16 | CommunicationMode = "Listen" 17 | ListenPort = 10935; 18 | TentacleServiceCredential = $cred 19 | DefaultApplicationDirectory = "C:\Applications" 20 | TentacleHomeDirectory = "C:\Octopus" 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UpgradeExistingInstanceInSpace/ExpectedResult.ps1: -------------------------------------------------------------------------------- 1 | return @() 2 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/TentacleExeInvocationFiles/UpgradeExistingInstanceInSpace/RequestedState.ps1: -------------------------------------------------------------------------------- 1 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # these are tests, not anything that needs to be secure 2 | param() 3 | 4 | $pass = ConvertTo-SecureString "S3cur3P4ssphraseHere!" -AsPlainText -Force 5 | $cred = New-Object System.Management.Automation.PSCredential ("Admin", $pass) 6 | 7 | return @{ 8 | Ensure = "Present"; 9 | State = "Started"; 10 | Name = "Tentacle"; 11 | OctopusServerUrl = "http://localhost:81"; 12 | ApiKey = "API-1234"; 13 | Environments = @("dev", "prod"); 14 | Roles = "web-server"; 15 | CommunicationMode = "Listen" 16 | ListenPort = 10935; 17 | TentacleServiceCredential = $cred 18 | DefaultApplicationDirectory = "C:\Applications" 19 | TentacleHomeDirectory = "C:\Octopus" 20 | Space = "My Space" 21 | } 22 | -------------------------------------------------------------------------------- /OctopusDSC/Tests/cOctopusWorkerPool.tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OctopusDeploy/OctopusDSC/5e0ac67670ea4c38ded202fb16ab7076159e0813/OctopusDSC/Tests/cOctopusWorkerPool.tests.ps1 -------------------------------------------------------------------------------- /Octopus_blue_64px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OctopusDeploy/OctopusDSC/5e0ac67670ea4c38ded202fb16ab7076159e0813/Octopus_blue_64px.png -------------------------------------------------------------------------------- /README-cOctopusServerActiveDirectoryAuthentication.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerActiveDirectoryAuthentication 2 | 3 | ## Sample 4 | 5 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 6 | 7 | ```PowerShell 8 | Configuration SampleConfig 9 | { 10 | Import-DscResource -Module OctopusDSC 11 | 12 | Node "localhost" 13 | { 14 | cOctopusServerActiveDirectoryAuthentication "Enable AD authentication" 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $true 18 | AllowFormsAuthenticationForDomainUsers = $false 19 | ActiveDirectoryContainer = "CN=Users,DC=GPN,DC=COM" 20 | } 21 | } 22 | } 23 | 24 | SampleConfig 25 | 26 | Start-DscConfiguration .\SampleConfig -Verbose -wait 27 | 28 | Test-DscConfiguration 29 | ``` 30 | 31 | ## Properties 32 | 33 | | Property | Type | Default Value | Description | 34 | | ------------------------------------------| ------------ | -----------------| ------------| 35 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 36 | | `Enabled` | `boolean` | `$false` | Whether to enable Active Directory authentication. | 37 | | `AllowFormsAuthenticationForDomainUsers` | `boolean` | `$false` | Whether to allow users to manually enter a username and password. | 38 | | `ActiveDirectoryContainer` | `string` | | The active directory container (if user objects are stored in a non-standard location). | 39 | -------------------------------------------------------------------------------- /README-cOctopusServerAzureADAuthentication.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerAzureADAuthentication 2 | 3 | ## Sample 4 | 5 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 6 | 7 | ```PowerShell 8 | Configuration SampleConfig 9 | { 10 | Import-DscResource -Module OctopusDSC 11 | 12 | Node "localhost" 13 | { 14 | cOctopusServerAzureADAuthentication "Enable AzureAD authentication" 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $true 18 | Issuer = "https://login.microsoftonline.com/b91ebf6a-84be-4c6f-97f3-32a1d0a11c8a" 19 | ClientId = "0272262a-b31d-4acf-8891-56e96d302018" 20 | } 21 | } 22 | } 23 | 24 | SampleConfig 25 | 26 | Start-DscConfiguration .\SampleConfig -Verbose -wait 27 | 28 | Test-DscConfiguration 29 | ``` 30 | 31 | ## Properties 32 | 33 | | Property | Type | Default Value | Description | 34 | | --------------------| ------------ | -----------------| ------------| 35 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 36 | | `Enabled` | `boolean` | `$false` | Whether to enable AzureAD authentication. | 37 | | `Issuer` | `string` | | The `OAuth 2.0 Authorization Endpoint` from the Azure Portal, with the trailing `/oauth2/authorize` removed. | 38 | | `ClientId` | `string` | | The `Application ID` from the Azure Portal. | 39 | -------------------------------------------------------------------------------- /README-cOctopusServerGoogleAppsAuthentication.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerGoogleAppsAuthentication 2 | 3 | ## Sample 4 | 5 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 6 | 7 | ```PowerShell 8 | Configuration SampleConfig 9 | { 10 | Import-DscResource -Module OctopusDSC 11 | 12 | Node "localhost" 13 | { 14 | cOctopusServerGoogleAppsAuthentication "Enable Google Apps authentication" 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $true 18 | ClientID = "5743519123-1232358520259-3634528" 19 | HostedDomain = "https://octopus.example.com" 20 | } 21 | } 22 | } 23 | 24 | SampleConfig 25 | 26 | Start-DscConfiguration .\SampleConfig -Verbose -wait 27 | 28 | Test-DscConfiguration 29 | ``` 30 | 31 | ## Properties 32 | 33 | | Property | Type | Default Value | Description | 34 | | --------------------| ------------ | -----------------| ------------| 35 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 36 | | `Enabled` | `boolean` | `$false` | Whether to enable GoogleApps authentication. | 37 | | `ClientId` | `string` | | The `Client ID` from the Google Developer console. | 38 | | `HostedDomain` | `string` | | The url of your octopus server. | 39 | -------------------------------------------------------------------------------- /README-cOctopusServerGuestAuthentication.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerGuestAuthentication 2 | 3 | ## Sample 4 | 5 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 6 | 7 | ```PowerShell 8 | Configuration SampleConfig 9 | { 10 | Import-DscResource -Module OctopusDSC 11 | 12 | Node "localhost" 13 | { 14 | cOctopusServerGuestAuthentication "Enable guest account login" 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $true 18 | } 19 | } 20 | } 21 | 22 | SampleConfig 23 | 24 | Start-DscConfiguration .\SampleConfig -Verbose -wait 25 | 26 | Test-DscConfiguration 27 | ``` 28 | 29 | ## Properties 30 | 31 | | Property | Type | Default Value | Description | 32 | | --------------------| ------------ | -----------------| ------------| 33 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 34 | | `Enabled` | `boolean` | `$false` | Whether to enable the read-only guest account. | 35 | -------------------------------------------------------------------------------- /README-cOctopusServerOktaAuthentication.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerOktaAuthentication 2 | 3 | This resource is only supported for Octopus 3.16 and above. 4 | 5 | ## Sample 6 | 7 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 8 | 9 | ```PowerShell 10 | Configuration SampleConfig 11 | { 12 | Import-DscResource -Module OctopusDSC 13 | 14 | Node "localhost" 15 | { 16 | cOctopusServerOktaAuthentication "Enable Okta authentication" 17 | { 18 | InstanceName = "OctopusServer" 19 | Enabled = $true 20 | Issuer = "https://dev-258251.oktapreview.com" 21 | ClientId = "752nx5basdskrsbqansE" 22 | } 23 | } 24 | } 25 | 26 | SampleConfig 27 | 28 | Start-DscConfiguration .\SampleConfig -Verbose -wait 29 | 30 | Test-DscConfiguration 31 | ``` 32 | 33 | ## Properties 34 | 35 | | Property | Type | Default Value | Description | 36 | | --------------------| ------------ | -----------------| ------------| 37 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 38 | | `Enabled` | `boolean` | `$false` | Whether to enable Okta authentication. | 39 | | `Issuer` | `string` | | The 'Issuer' from the Application settings in the Okta portal. | 40 | | `ClientId` | `string` | | The 'Audience' from the Application settings in the Okta portal. | 41 | -------------------------------------------------------------------------------- /README-cOctopusServerSpace.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerSpace 2 | 3 | ## Sample 4 | 5 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 6 | 7 | ```PowerShell 8 | Configuration SampleConfig 9 | { 10 | Import-DscResource -Module OctopusDSC 11 | 12 | Node "localhost" 13 | { 14 | cOctopusServerSpace "Ensure Integration Team Space exists" 15 | { 16 | Ensure = "Present" 17 | Name = "Integration Team" 18 | Description = "The top secret work of the Integration Team" 19 | Url = "https://octopus.example.com" 20 | SpaceManagersTeamMembers = [ "bob.smith" ] 21 | SpaceManagersTeams = [ "Release Managers", "Integration Team Managers" ] 22 | OctopusApiKey = $creds 23 | } 24 | } 25 | } 26 | 27 | SampleConfig 28 | 29 | Start-DscConfiguration .\SampleConfig -Verbose -wait 30 | 31 | Test-DscConfiguration 32 | ``` 33 | 34 | ## Properties 35 | 36 | | Property | Type | Default Value | Description | 37 | | --------------------------- | ---------------------------------- | -----------------| ---------------------------------------------------------------------------------------------------------------------------- | 38 | | `Ensure` | `string` - `Present` or `Absent` | `Present` | The desired state of the Space - effectively whether to create or delete. | 39 | | `Name` | `string` | | The name of the space | 40 | | `Description` | `string` | | Description to use for the space | 41 | | `SpaceManagersTeamMembers` | `string` | | Usernames for users will get Space Manager rights to the space | 42 | | `SpaceManagersTeams` | `string` | | Teams that will get Space Manager rights to the space | 43 | | `Url` | `string` | | Description to use for the space | 44 | | `OctopusApiKey` | `PSCredential` | | A `PSCredential` object with an empty username & password set to the api key to use to authenticate with your Octopus Server | 45 | | `OctopusCredentials` | `PSCredential` | | A `PSCredential` object with the username & password to use to authenticate with your Octopus Server | 46 | -------------------------------------------------------------------------------- /README-cOctopusServerSslCertificate.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerSslCertificate 2 | 3 | This resource binds a SSL certificate to allow Octopus Server to listen over HTTPS. 4 | It binds the certificate stored in the Windows Certificate store identified by the `StoreName` and `Thumbprint` to the port that the sever will listen on. 5 | This port must match the https entry in the `WebListenPrefix` element of the cOctopusServer resource. 6 | 7 | ## Sample 8 | 9 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 10 | 11 | ```PowerShell 12 | Configuration SampleConfig 13 | { 14 | Import-DscResource -Module OctopusDSC 15 | 16 | Node "localhost" 17 | { 18 | cOctopusServerSslCertificate SSLCert 19 | { 20 | InstanceName = "OctopusServer" 21 | Thumbprint = "" 22 | Ensure = "Present" 23 | StoreName = "My" 24 | Port = 443 25 | } 26 | } 27 | } 28 | 29 | SampleConfig 30 | 31 | Start-DscConfiguration .\SampleConfig -Verbose -wait 32 | 33 | Test-DscConfiguration 34 | ``` 35 | 36 | ## Properties 37 | | Property | Type | Default Value | Description | 38 | | ------------------------------------------| ------------------------------- | -----------------| ------------------------------------------------------------------------------------------------------------------ | 39 | | `Ensure` | `string` - `Present` or `Absent`| `Present` | The desired state of the Octopus Server - effectively whether to install or uninstall. | 40 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 41 | | `Thumbprint` | `string` | | Thumbprint of the SSL certificate to use with Octopus Deploy, | 42 | | `StoreName` | `string` - `My` or `WebHosting` | | Which certificate store to look for the thumbprint in. | 43 | | `Port` | `int` | | The port to use SSL on. | 44 | -------------------------------------------------------------------------------- /README-cOctopusServerUsernamePasswordAuthentication.md: -------------------------------------------------------------------------------- 1 | # README-cOctopusServerUsernamePasswordAuthentication 2 | 3 | ## Sample 4 | 5 | First, ensure the OctopusDSC module is on your `$env:PSModulePath`. Then you can create and apply configuration like this. 6 | 7 | ```PowerShell 8 | Configuration SampleConfig 9 | { 10 | Import-DscResource -Module OctopusDSC 11 | 12 | Node "localhost" 13 | { 14 | cOctopusServerUsernamePasswordAuthentication "Enable Username/Password Auth" 15 | { 16 | InstanceName = "OctopusServer" 17 | Enabled = $true 18 | } 19 | } 20 | } 21 | 22 | SampleConfig 23 | 24 | Start-DscConfiguration .\SampleConfig -Verbose -wait 25 | 26 | Test-DscConfiguration 27 | ``` 28 | 29 | ## Properties 30 | 31 | | Property | Type | Default Value | Description | 32 | | --------------------| ------------ | -----------------| ------------| 33 | | `InstanceName` | `string` | | The name of the Octopus Server instance. Use `OctopusServer` by convention unless you have more than one instance. | 34 | | `Enabled` | `boolean` | `$false` | Whether to enable internal username/password authentication. | 35 | -------------------------------------------------------------------------------- /Tests/aws_user_data.ps1: -------------------------------------------------------------------------------- 1 | 2 | Set-PSDebug -Trace 1 3 | 4 | Write-Output "Bootstrapping machine" 5 | 6 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine 7 | 8 | Write-Output "Creating self signed cert" 9 | $Cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName "packer" 10 | 11 | Write-Output "Setting up WinRM" 12 | winrm quickconfig -q 13 | 14 | New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $Cert.Thumbprint -Force 15 | 16 | winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="2048"}' 17 | winrm set winrm/config '@{MaxTimeoutms="1800000"}' 18 | winrm set winrm/config/service '@{AllowUnencrypted="false"}' 19 | winrm set winrm/config/service/auth '@{Basic="true"}' 20 | winrm set "winrm/config/listener?Address=*+Transport=HTTPS" "@{Port=`"5986`";Hostname=`"packer`";CertificateThumbprint=`"$($Cert.Thumbprint)`"}" 21 | 22 | Write-Output "Setting up firewall" 23 | netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow 24 | netsh advfirewall firewall show rule name="WinRM 5986" 25 | 26 | Write-Output "Restarting WinRM" 27 | net stop winrm 28 | & c:\windows\system32\sc.exe config winrm start= auto 29 | net start winrm 30 | 31 | Write-Output "WinRM configuration complete." 32 | 33 | -------------------------------------------------------------------------------- /Tests/configure-dsc-local-configuration-manager.ps1: -------------------------------------------------------------------------------- 1 | 2 | $fileContent = @" 3 | [DSCLocalConfigurationManager()] 4 | configuration LCMConfig 5 | { 6 | Node localhost 7 | { 8 | Settings 9 | { 10 | ConfigurationMode = 'ApplyOnly' 11 | } 12 | } 13 | } 14 | "@ 15 | 16 | Set-Content -Path "c:\temp\lcmconfig.ps1" -Value $fileContent 17 | 18 | . "c:\temp\lcmconfig.ps1" 19 | 20 | cd "c:\temp" 21 | LCMConfig -OutputPath c:\temp 22 | 23 | Set-DscLocalConfigurationManager -Force -Verbose -Path c:\temp 24 | del c:\temp\localhost.meta.mof 25 | -------------------------------------------------------------------------------- /Tests/configure-module-for-prerelease-tests.ps1: -------------------------------------------------------------------------------- 1 | param($version) 2 | 3 | # check if the version exists in the octopus-testing bucket 4 | $resp = Invoke-WebRequest "https://s3-ap-southeast-1.amazonaws.com/octopus-testing/server/Octopus.$version-x64.msi" -Method HEAD -verbose -UseBasicParsing 5 | 6 | if($resp.statuscode -ne 200) 7 | { 8 | Write-Output "Could not find the requested pre-release version ($version) in the octopus-testing bucket" 9 | EXIT 1 10 | } 11 | 12 | # Replace out the $DownloadUrl parameter default in the OctopusDSC module psm1 file 13 | Write-Output "Running pre-release version tests" 14 | 15 | $ModulePath = Get-Module -ListAvailable OctopusDSC | Select-Object -expand Path 16 | $infile = Get-Content $ModulePath 17 | 18 | $outfile = $infile -replace "[string]$DownloadUrl = `"https://octopus.com/downloads/latest/WindowsX64/OctopusServer`",", 19 | "[string]$DownloadUrl = `"https://s3-ap-southeast-1.amazonaws.com/octopus-testing/server/Octopus.$version-x64.msi`"," 20 | 21 | $outfile | Out-File $ModulePath 22 | 23 | Write-Output "Module modified to use $version as 'latest'" 24 | 25 | Write-Output "Looking for CurrentState files in $pwd/OctopusDSC/Tests/OctopusServerExeInvocationFiles/" 26 | $currentstatefiles = Get-ChildItem -recurse "OctopusDSC/Tests/OctopusServerExeInvocationFiles/" -filter CurrentState.ps1 27 | 28 | $currentstatefiles | ForEach-Object { 29 | Write-Version "Modifying CurrentState file ${$_.FullName} to use $version as latest" 30 | 31 | $infile = Get-Content $_.FullName 32 | 33 | $outfile = $infile -replace "https://octopus.com/downloads/latest/WindowsX64/OctopusServer", 34 | "https://s3-ap-southeast-1.amazonaws.com/octopus-testing/server/Octopus.$version-x64.msi" 35 | 36 | $outfile | Out-File $_.FullName 37 | } 38 | -------------------------------------------------------------------------------- /Tests/register-polling-tentacle.ps1: -------------------------------------------------------------------------------- 1 | # If for whatever reason this doesn't work, check this file: 2 | Start-Transcript -path "C:\Octopus\Logs\register-polling-tentacle.txt" -append 3 | 4 | $OFS = "`r`n" 5 | $OctopusURI = "http://localhost:81" 6 | $octopusAdminUsername="OctoAdmin" 7 | $octopusAdminPassword="SuperS3cretPassw0rd!" 8 | 9 | # we have setup the tentacle via DSC, and given it a thumbprint, but have requested it to 10 | # not register with the server. (ie, simulating the situation where tentacles cannot see the server) 11 | # so, we need to register the tentacle outside of DSC 12 | 13 | try 14 | { 15 | Add-Type -Path "${env:ProgramFiles}\Octopus Deploy\Octopus\Newtonsoft.Json.dll" 16 | Add-Type -Path "${env:ProgramFiles}\Octopus Deploy\Octopus\Octopus.Client.dll" 17 | 18 | #connect 19 | $endpoint = new-object Octopus.Client.OctopusServerEndpoint $OctopusURI 20 | $repository = new-object Octopus.Client.OctopusRepository $endpoint 21 | 22 | #sign in 23 | $credentials = New-Object Octopus.Client.Model.LoginCommand 24 | $credentials.Username = $octopusAdminUsername 25 | $credentials.Password = $octopusAdminPassword 26 | $repository.Users.SignIn($credentials) | Out-Null 27 | 28 | $environment = $repository.Environments.FindByName("The-Env") 29 | 30 | $existingMachine = $repository.machines.findbyname("ListeningTentacleWithThumbprintWithoutAutoRegister") 31 | if ($null -ne $existingMachine) { 32 | $repository.machines.Delete($existingMachine) | Out-Null 33 | } 34 | 35 | $tentacleThumbprint = & "C:\Program Files\Octopus Deploy\Tentacle\Tentacle.exe" "show-thumbprint" "--instance=ListeningTentacleWithThumbprintWithoutAutoRegister" "--nologo" "--thumbprint-only" "--console" 36 | 37 | $environmentId = $environment.id 38 | $role = "Test-Tentacle" 39 | $machineName = "ListeningTentacleWithThumbprintWithoutAutoRegister" 40 | 41 | $tentacleEndpoint = New-Object Octopus.Client.Model.EndPoints.ListeningTentacleEndpointResource 42 | $tentacleEndpoint.Thumbprint = $tentacleThumbprint 43 | $tentacleEndpoint.Uri = "https://localhost:10935" 44 | 45 | $tentacle = New-Object Octopus.Client.Model.MachineResource 46 | $tentacle.Endpoint = $tentacleEndpoint 47 | $tentacle.EnvironmentIds.Add($environmentId) 48 | $tentacle.Roles.Add($role) 49 | $tentacle.Name = $machineName 50 | 51 | $repository.Machines.Create($tentacle) | Out-Null 52 | } 53 | catch 54 | { 55 | Write-Output $_ 56 | exit 1 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Tests/surface-logs.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "##teamcity[blockOpened name='LCM Configuration']" 2 | Get-DscLocalConfigurationManager 3 | Write-Host "##teamcity[blockClosed name='LCM Configuration']" 4 | -------------------------------------------------------------------------------- /Tests/trigger-and-wait-for-healthcheck.ps1: -------------------------------------------------------------------------------- 1 | # If for whatever reason this doesn't work, check this file: 2 | Start-Transcript -path "C:\Octopus\Logs\trigger-and-wait-for-healthcheck.txt" -append 3 | 4 | $OFS = "`r`n" 5 | 6 | $config = get-content "c:\temp\octopus-configured.marker" | ConvertFrom-Json 7 | $OctopusURI = $config.OctopusServerUrl 8 | $OctopusAPIKey = $config.OctopusApiKey 9 | 10 | try 11 | { 12 | Add-Type -Path "${env:ProgramFiles}\Octopus Deploy\Octopus\Newtonsoft.Json.dll" 13 | Add-Type -Path "${env:ProgramFiles}\Octopus Deploy\Octopus\Octopus.Client.dll" 14 | 15 | $endpoint = new-object Octopus.Client.OctopusServerEndpoint $OctopusURI, $OctopusAPIKey 16 | $repository = new-object Octopus.Client.OctopusRepository $endpoint 17 | $environments = $repository.Environments.FindAll() 18 | 19 | foreach($environment in $environments) 20 | { 21 | $header = @{ "X-Octopus-ApiKey" = $OctopusAPIKey } 22 | Write-Output "Creating healthcheck task for environment '$($environment.Name)'" 23 | $body = @{ 24 | Name = "Health" 25 | Description = "Checking health of all machines in environment '$($environment.Name)'" 26 | Arguments = @{ 27 | Timeout= "00:05:00" 28 | EnvironmentId = $environment.Id 29 | } 30 | } | ConvertTo-Json 31 | 32 | $result = Invoke-RestMethod $OctopusURI/api/tasks -Method Post -Body $body -Headers $header 33 | while (($result.State -ne "Success") -and ($result.State -ne "Failed") -and ($result.State -ne "Canceled") -and ($result.State -ne "TimedOut")) { 34 | Write-Output "Polling for healthcheck completion. Status is '$($result.State)'" 35 | Start-Sleep -Seconds 5 36 | $result = Invoke-RestMethod "$OctopusURI$($result.Links.Self)" -Headers $header 37 | } 38 | Write-Output "Healthcheck completed with status '$($result.State)'" 39 | } 40 | } 41 | catch 42 | { 43 | Write-Output $_ 44 | exit 1 45 | } 46 | 47 | -------------------------------------------------------------------------------- /build-aws.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/pwsh 2 | param( 3 | [switch]$offline, 4 | [switch]$SkipPester, 5 | [switch]$ServerOnly, 6 | [switch]$TentacleOnly, 7 | [string]$OctopusVersion, 8 | [switch]$retainondestroy, 9 | [switch]$debug 10 | ) 11 | 12 | . Tests/powershell-helpers.ps1 13 | 14 | Start-Transcript .\vagrant-aws.log 15 | 16 | Test-EnvVar AWS_ACCESS_KEY_ID 17 | Test-EnvVar AWS_SECRET_ACCESS_KEY 18 | Test-EnvVar AWS_SUBNET_ID 19 | Test-EnvVar AWS_SECURITY_GROUP_ID 20 | 21 | Set-OctopusDscEnvVars @PSBoundParameters 22 | 23 | if (-not (Test-AppExists "vagrant")) { 24 | Write-Output "Please install vagrant from vagrantup.com." 25 | exit 1 26 | } 27 | Write-Output "Vagrant installed - good." 28 | 29 | if (-not (Test-AppExists "aws")) { 30 | Write-Output "Please install aws-cli. See https://docs.aws.amazon.com/cli/latest/userguide/installing.html." 31 | exit 1 32 | } 33 | Write-Output "AWS CLI installed - good." 34 | 35 | Test-PluginInstalled "vagrant-gecko-aws" 36 | Test-PluginInstalled "vagrant-aws-winrm" 37 | Test-CustomVersionOfVagrantDscPluginIsInstalled 38 | Test-PluginInstalled "vagrant-winrm-syncedfolders" 39 | Test-PluginInstalled "vagrant-winrm-file-download" 40 | 41 | Remove-OldLogsBeforeNewRun 42 | 43 | if(-not $SkipPester) { 44 | Invoke-PesterTests 45 | } else { 46 | Write-Output "-SkipPester was specified, skipping pester tests" 47 | } 48 | 49 | $randomGuid=[guid]::NewGuid() 50 | $keyName = "vagrant_$randomGuid" 51 | 52 | [Environment]::SetEnvironmentVariable("KEY_NAME", $keyName) 53 | 54 | Write-Output "Creating new key-pair $keyName" 55 | $key = (& aws ec2 create-key-pair --key-name $keyName --query 'KeyMaterial' --output text --region ap-southeast-2) 56 | if ($LASTEXITCODE -ne 0) { 57 | Write-Output "Failed to create aws key-pair." 58 | Write-Output "##teamcity[buildStatus text='{build.status.text}. AWS setup failed.']" 59 | exit 1 60 | } 61 | Set-Content -Path "$keyName.pem" -Value $key 62 | 63 | if (Test-AppExists "chmod") { 64 | Write-Output "Setting permissions on pem file '$keyName.pem'" 65 | & chmod 400 "./$keyName.pem" 66 | } else { 67 | Write-Output "chmod not found, skipping setting permissions on pem file" 68 | } 69 | 70 | Write-Output "Adding vagrant box" 71 | vagrant box add OctopusDeploy/dsc-test-server-windows-server-2019 https://s3-ap-southeast-2.amazonaws.com/octopus-vagrant-boxes/vagrant/json/OctopusDeploy/amazon-ebs/dsc-test-server-windows-server-2019.json --force 72 | 73 | Write-Output "Ensuring vagrant box is latest" 74 | vagrant box update --box OctopusDeploy/dsc-test-server-windows-server-2019 --provider aws 75 | 76 | $splat = @{ 77 | provider="aws"; 78 | retainondestroy = $retainondestroy.IsPresent; 79 | debug = $debug.IsPresent; 80 | } 81 | 82 | Invoke-VagrantWithRetries @splat 83 | 84 | if ($LASTEXITCODE -ne 0) { 85 | Write-Output "Vagrant up failed with exit code $LASTEXITCODE" 86 | Write-Output "##teamcity[buildStatus text='{build.status.text}. Vagrant failed.']" 87 | exit $LASTEXITCODE 88 | } 89 | 90 | Write-Output "Don't forget to run 'cleanup-aws.ps1' when you have finished" 91 | -------------------------------------------------------------------------------- /build-azure.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/pwsh 2 | param( 3 | [switch]$offline, 4 | [switch]$SkipPester, 5 | [switch]$ServerOnly, 6 | [switch]$TentacleOnly, 7 | [string]$OctopusVersion, 8 | [switch]$retainondestroy, 9 | [switch]$debug 10 | ) 11 | 12 | . Tests/powershell-helpers.ps1 13 | 14 | Start-Transcript .\vagrant-azure.log 15 | 16 | Test-EnvVar AZURE_VM_PASSWORD 17 | Test-EnvVar AZURE_SUBSCRIPTION_ID 18 | Test-EnvVar AZURE_TENANT_ID 19 | Test-EnvVar AZURE_CLIENT_ID 20 | Test-EnvVar AZURE_CLIENT_SECRET 21 | 22 | Set-OctopusDscEnvVars @PSBoundParameters 23 | 24 | if (-not (Test-AppExists "vagrant")) { 25 | Write-Output "Please install vagrant from vagrantup.com." 26 | exit 1 27 | } 28 | Write-Output "Vagrant installed - good." 29 | 30 | if (-not (Test-AppExists "azure")) { 31 | Write-Output "Azure CLI not found. Please install from https://docs.microsoft.com/en-us/azure/xplat-cli-install." 32 | exit 1 33 | } 34 | Write-Output "Azure CLI installed - good." 35 | 36 | Test-CustomVersionOfVagrantDscPluginIsInstalled 37 | Test-PluginInstalled "vagrant-azure" "2.0.0.pre7" 38 | Test-PluginInstalled "vagrant-winrm-syncedfolders" 39 | Test-PluginInstalled "vagrant-winrm-file-download" 40 | 41 | Remove-OldLogsBeforeNewRun 42 | 43 | if(-not $SkipPester) { 44 | Invoke-PesterTests 45 | } else { 46 | Write-Output "-SkipPester was specified, skipping pester tests" 47 | } 48 | 49 | Write-Output "Running 'vagrant up --provider azure'" 50 | 51 | Invoke-VagrantWithRetries -provider azure 52 | 53 | Write-Output "'vagrant up' exited with exit code $LASTEXITCODE" 54 | 55 | if ($LASTEXITCODE -ne 0) { 56 | Write-Output "Vagrant up failed with exit code $LASTEXITCODE" 57 | Write-Output "##teamcity[buildStatus text='{build.status.text}. Vagrant failed.']" 58 | exit $LASTEXITCODE 59 | } 60 | 61 | Write-Output "Don't forget to run 'cleanup-azure.ps1' when you have finished" 62 | -------------------------------------------------------------------------------- /build-hyperv.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/pwsh 2 | #Requires -RunAsAdministrator 3 | param( 4 | [switch]$offline, 5 | [switch]$SkipPester, 6 | [switch]$ServerOnly, 7 | [switch]$TentacleOnly, 8 | [string]$OctopusVersion, 9 | [switch]$retainondestroy, 10 | [switch]$debug 11 | ) 12 | 13 | . Tests/powershell-helpers.ps1 14 | 15 | Start-Transcript .\vagrant-hyperv.log 16 | 17 | Set-OctopusDscEnvVars @PSBoundParameters 18 | 19 | # remove psreadline as it interferes with the SMB password prompt 20 | if(Get-Module PSReadLine) { 21 | Remove-Module PSReadLine 22 | } 23 | 24 | if (-not (Test-AppExists "vagrant")) { 25 | Write-Output "Please install vagrant from vagrantup.com." 26 | exit 1 27 | } 28 | Write-Output "Vagrant installed - good." 29 | 30 | if ((Get-CimInstance Win32_OperatingSystem).PRODUCTTYPE -eq 1) { 31 | # client OS detected 32 | if ((Get-WindowsOptionalFeature -Online -FeatureName 'Microsoft-Hyper-V').State -eq 'Disabled') { 33 | Write-Output 'Please install Hyper-V.' 34 | exit 1 35 | } 36 | } 37 | else { 38 | # server OS detected 39 | if ((Get-WindowsFeature 'Hyper-V').State -eq 'Disabled') { 40 | Write-Output 'Please install Hyper-V.' 41 | exit 1 42 | } 43 | } 44 | Write-Output "Hyper-V installed - good." 45 | 46 | if (-not (Get-VMSwitch -Name $env:OctopusDSCVMSwitch -ErrorAction SilentlyContinue)) { 47 | Write-Output "Could not find a Hyper-V switch called $($env:OctopusDSCVMSwitch)" 48 | exit 1 49 | } 50 | Write-Output (@("Hyper-V virtual switch '", $env:OctopusDSCVMSwitch, "' detected - good.") -join "") 51 | 52 | Test-CustomVersionOfVagrantDscPluginIsInstalled 53 | Test-PluginInstalled "vagrant-winrm-syncedfolders" 54 | Test-PluginInstalled "vagrant-winrm-file-download" 55 | 56 | Remove-OldLogsBeforeNewRun 57 | 58 | if(-not $SkipPester) { 59 | Invoke-PesterTests 60 | } else { 61 | Write-Output "-SkipPester was specified, skipping pester tests" 62 | } 63 | 64 | $splat = @{ 65 | provider="hyperv"; 66 | retainondestroy = $retainondestroy.IsPresent; # set to $true to override in this script 67 | debug = $debug.IsPresent; # set to $true to override in this script 68 | } 69 | 70 | Invoke-VagrantWithRetries @splat 71 | 72 | Write-Output "Don't forget to run 'vagrant destroy -f' when you have finished" 73 | 74 | stop-transcript 75 | -------------------------------------------------------------------------------- /build-virtualbox.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/pwsh 2 | param( 3 | [switch]$offline, 4 | [switch]$SkipPester, 5 | [switch]$ServerOnly, 6 | [switch]$TentacleOnly, 7 | [string]$OctopusVersion, 8 | [switch]$retainondestroy, 9 | [switch]$debug 10 | ) 11 | 12 | . Tests/powershell-helpers.ps1 13 | Start-Transcript .\vagrant-virtualbox.log 14 | 15 | Set-OctopusDscEnvVars @PSBoundParameters 16 | 17 | if (-not (Test-AppExists "vagrant")) { 18 | Write-Output "Please install vagrant from vagrantup.com." 19 | exit 1 20 | } 21 | Write-Output "Vagrant installed - good." 22 | 23 | if (-not (Test-AppExists "VBoxManage")) { 24 | Write-Output "Please install VirtualBox from virtualbox.org and ensure the installation path is added to the system environment path." 25 | exit 1 26 | } 27 | Write-Output "VirtualBox installed - good." 28 | 29 | Test-CustomVersionOfVagrantDscPluginIsInstalled 30 | Test-PluginInstalled "vagrant-winrm-syncedfolders" 31 | Test-PluginInstalled "vagrant-winrm-file-download" 32 | 33 | Remove-OldLogsBeforeNewRun 34 | 35 | if(-not $SkipPester) { 36 | Invoke-PesterTests 37 | } else { 38 | Write-Output "-SkipPester was specified, skipping pester tests" 39 | } 40 | 41 | $splat = @{ 42 | provider = 'virtualbox'; 43 | retainondestroy = $retainondestroy.IsPresent; 44 | debug = $debug.IsPresent; 45 | } 46 | 47 | Invoke-VagrantWithRetries @splat 48 | 49 | Write-Output "Don't forget to run 'vagrant destroy -f' when you have finished" 50 | 51 | stop-transcript 52 | -------------------------------------------------------------------------------- /cleanup-aws.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/pwsh 2 | 3 | . Tests/powershell-helpers.ps1 4 | 5 | Test-EnvVar AWS_ACCESS_KEY_ID 6 | Test-EnvVar AWS_SECRET_ACCESS_KEY 7 | Test-EnvVar AWS_SUBNET_ID 8 | Test-EnvVar AWS_SECURITY_GROUP_ID 9 | 10 | if (-not (Test-AppExists "vagrant")) { 11 | Write-Output "Please install vagrant from vagrantup.com." 12 | exit 1 13 | } 14 | Write-Output "Vagrant installed - good." 15 | 16 | if (-not (Test-AppExists "aws")) { 17 | Write-Output "Please install aws-cli. See https://docs.aws.amazon.com/cli/latest/userguide/installing.html." 18 | exit 1 19 | } 20 | 21 | Test-PluginInstalled "vagrant-gecko-aws" 22 | Test-PluginInstalled "vagrant-aws-winrm" 23 | Test-PluginInstalled "vagrant-dsc" 24 | Test-PluginInstalled "vagrant-winrm-syncedfolders" 25 | 26 | #get key name from file 27 | $files = @(Get-ChildItem -filter "vagrant_*.pem") 28 | 29 | if ($files.length -eq 0) { 30 | Write-Output "No key pair (vagrant_GUID.pem) found - unable to cleanup." 31 | exit 1 32 | } 33 | 34 | $keyName = $files[0].BaseName 35 | $env:KEY_NAME = $keyName 36 | Write-Output "Using key pair $keyName.pem" 37 | 38 | # this is a global action, so it doesn't get saved outside of the docker container when running 39 | Write-Output "Adding vagrant box" 40 | vagrant box add OctopusDeploy/dsc-test-server-windows-server-2019 https://s3-ap-southeast-2.amazonaws.com/octopus-vagrant-boxes/vagrant/json/OctopusDeploy/amazon-ebs/dsc-test-server-windows-server-2019.json --force 41 | Write-Output "Ensuring vagrant box is latest" 42 | vagrant box update --box OctopusDeploy/dsc-test-server-windows-server-2019 --provider aws 43 | 44 | #todo: check vagrant status and exit cleanly if not running 45 | 46 | Write-Output "Running 'vagrant destroy -f'" 47 | & vagrant destroy -f 48 | $VagrantDestroyExitCode=$LASTEXITCODE 49 | Write-Output "'vagrant destroy' exited with exit code $VagrantDestroyExitCode" 50 | 51 | Write-Output "Removing local key-pair" 52 | remove-item $files[0].Name -force 53 | 54 | Write-Output "Deleting aws key-pair" 55 | & aws ec2 delete-key-pair --key-name $keyName --region ap-southeast-2 56 | 57 | if ($VagrantDestroyExitCode -ne 0) { 58 | Write-Output "Vagrant destroy failed with exit code $VagrantDestroyExitCode" 59 | Write-Output "##teamcity[buildStatus text='{build.status.text}. Vagrant cleanup failed. Action required.']" 60 | 61 | exit $VagrantDestroyExitCode 62 | } 63 | -------------------------------------------------------------------------------- /cleanup-azure.ps1: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/pwsh 2 | 3 | . Tests/powershell-helpers.ps1 4 | 5 | Test-EnvVar AZURE_VM_PASSWORD 6 | Test-EnvVar AZURE_SUBSCRIPTION_ID 7 | Test-EnvVar AZURE_TENANT_ID 8 | Test-EnvVar AZURE_CLIENT_ID 9 | Test-EnvVar AZURE_CLIENT_SECRET 10 | 11 | if (-not (Test-AppExists "vagrant")) { 12 | Write-Output "Please install vagrant from vagrantup.com." 13 | exit 1 14 | } 15 | Write-Output "Vagrant installed - good." 16 | 17 | if (-not (Test-AppExists "azure")) { 18 | Write-Output "Azure CLI not found. Please install from https://docs.microsoft.com/en-us/azure/xplat-cli-install." 19 | exit 1 20 | } 21 | Write-Output "Azure CLI installed - good." 22 | 23 | Test-PluginInstalled "vagrant-dsc" 24 | Test-PluginInstalled "vagrant-azure" "2.0.0.pre7" 25 | Test-PluginInstalled "vagrant-winrm-syncedfolders" 26 | 27 | #todo: check vagrant status and exit cleanly if not running 28 | 29 | Write-Output "Running 'vagrant destroy -f'" 30 | & vagrant destroy -f 31 | $VagrantDestroyExitCode=$LASTEXITCODE 32 | Write-Output "'vagrant destroy' exited with exit code $VagrantDestroyExitCode" 33 | 34 | if ($VagrantDestroyExitCode -ne 0) { 35 | Write-Output "Vagrant destroy failed with exit code $VagrantDestroyExitCode" 36 | Write-Output "##teamcity[buildStatus text='{build.status.text}. Vagrant cleanup failed. Action required.']" 37 | exit $VagrantDestroyExitCode 38 | } 39 | 40 | # in some circumstances, vagrant doesn't think the vm exists, but the resource group does exist 41 | # this will mean that new runs will use the existing resource group, which is rarely what we want 42 | $json = & azure group list --json 43 | $groups = ("{`"items`": $json }" | ConvertFrom-Json) 44 | $group = $groups.items | where-object { $_.name -eq "OctopusDSCTesting" } 45 | if ($group) { 46 | & azure group delete --quiet OctopusDSCTesting 47 | } 48 | -------------------------------------------------------------------------------- /publish.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [string]$buildVersion, 3 | [string]$psGalleryApiKey, 4 | [string]$gitHubApiKey 5 | ) 6 | $ErrorActionPreference = 'Stop' 7 | 8 | function Publish-ToGitHub($versionNumber, $commitId, $preRelease, $artifact, $gitHubApiKey) 9 | { 10 | $data = @{ 11 | tag_name = [string]::Format("v{0}", $versionNumber); 12 | target_commitish = $commitId; 13 | name = [string]::Format("v{0}", $versionNumber); 14 | body = ''; 15 | prerelease = $preRelease; 16 | } 17 | 18 | $auth = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($gitHubApiKey + ":x-oauth-basic")); 19 | 20 | $releaseParams = @{ 21 | Uri = "https://api.github.com/repos/OctopusDeploy/OctopusDSC/releases"; 22 | Method = 'POST'; 23 | Headers = @{ Authorization = $auth; } 24 | ContentType = 'application/json'; 25 | Body = ($data | ConvertTo-Json -Compress) 26 | } 27 | 28 | $result = Invoke-RestMethod @releaseParams 29 | $uploadUri = $result | Select-Object -ExpandProperty upload_url 30 | $uploadUri = $uploadUri -creplace '\{\?name,label\}' 31 | $uploadUri = $uploadUri + ("?name=$artifact".Replace('.\', '')) 32 | 33 | $params = @{ 34 | Uri = $uploadUri; 35 | Method = 'POST'; 36 | Headers = @{ Authorization = $auth; } 37 | ContentType = 'application/zip'; 38 | InFile = $artifact 39 | } 40 | Invoke-RestMethod @params 41 | } 42 | 43 | try 44 | { 45 | Write-output "### Enabling TLS 1.2 support" 46 | [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12, [System.Net.SecurityProtocolType]::Tls11, [System.Net.SecurityProtocolType]::Tls 47 | 48 | Write-output "### Updating version number to $buildVersion" 49 | $content = (Get-Content OctopusDSC/OctopusDSC.psd1) 50 | $content = $content -replace "ModuleVersion = '[0-9\.]+'", "ModuleVersion = '$buildVersion'" 51 | Set-Content OctopusDSC/OctopusDSC.psd1 $content 52 | 53 | Write-output "### Ensuring nuget.exe is available" 54 | If (-not (Test-Path "C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe")) { 55 | Write-output "Downloading latest nuget to C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe" 56 | if (-not (Test-Path "C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet")) { 57 | New-Item -type Directory "C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet" | Out-Null 58 | } 59 | Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile "C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe" 60 | Write-Output "### Checking nuget.exe version" 61 | & C:\ProgramData\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe help | select -first 1 62 | } 63 | 64 | Write-Output "### Install-PackageProvider nuget -force" 65 | Install-PackageProvider nuget -force 66 | 67 | Write-output "### Import Modules" 68 | Import-Module "C:\Program Files\WindowsPowerShell\Modules\PackageManagement" 69 | Import-Module "C:\Program Files\WindowsPowerShell\Modules\PowerShellGet" 70 | 71 | Write-output "### Publish-Module -Path 'OctopusDSC'" 72 | Publish-Module -Path "OctopusDSC" -NuGetApiKey $psGalleryApiKey 73 | 74 | Write-Output "### Publishing to GitHub" 75 | 76 | Compress-Archive -Path .\OctopusDSC -DestinationPath ".\OctopusDSC.$buildVersion.zip" 77 | 78 | $commitId = git rev-parse HEAD 79 | Publish-ToGitHub -versionNumber $buildVersion ` 80 | -commitId $commitId ` 81 | -preRelease $false ` 82 | -artifact ".\OctopusDSC.$buildVersion.zip" ` 83 | -gitHubApiKey $gitHubApiKey 84 | } 85 | catch 86 | { 87 | Write-Output $_ 88 | exit 1 89 | } 90 | --------------------------------------------------------------------------------