This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetScriptDirectory | |
{ | |
Split-Path $script:MyInvocation.MyCommand.Path | |
} | |
function GetResultsPath | |
{ | |
$parent = join-path -path $(GetScriptDirectory) -childpath $OctopusReleaseNumber | |
return Join-Path -Path $parent -ChildPath "TestResult.html" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Id": "ActionTemplates-21", | |
"Name": "IIS AppPool - Stop", | |
"Description": "Stops an IIS Application Pool", | |
"ActionType": "Octopus.Script", | |
"Version": 2, | |
"Properties": { | |
"Octopus.Action.Script.ScriptBody": "# Load IIS module:\nImport-Module WebAdministration\n\n# Get AppPool Name\n$appPoolName = $OctopusParameters['appPoolName']\n# Get the number of retries\n$retries = $OctopusParameters['appPoolCheckRetries']\n# Get the number of attempts\n$delay = $OctopusParameters['appPoolCheckDelay']\n\n# Check if exists\nif(Test-Path IIS:\\AppPools\\$appPoolName) {\n\n # Stop App Pool if not already stopped\n if ((Get-WebAppPoolState $appPoolName).Value -ne \"Stopped\") {\n Write-Output \"Stopping IIS app pool $appPoolName\"\n Stop-WebAppPool $appPoolName\n \n $state = (Get-WebAppPoolState $appPoolName).Value\n $counter = 1\n \n # Wait for the app pool to the \"Stopped\" before proceeding\n do{ \n $state = (Get-WebAppPoolState $appPoolN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module WebAdministration | |
Write-Output "Running on $env:COMPUTERNAME" | |
Get-ChildItem IIS:\AppPools | |
$PoolName = "YOU_APP_POOL_NAME" <- UPDATE THIS | |
$pool = Get-Item "IIS:\AppPools\$PoolName" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ProjectName EnvironmentName ReleaseVersion packages | |
----------- --------------- -------------- -------- | |
ConfigFiles Development 0.0.16 {@{Name=TestConfig; Version=2.0.42}} | |
ConsoleApp Development 0.0.1 {@{Name=Testapp; Version=1.0.13}} | |
Powershell1 Development 0.0.6 {@{Name=Testapp; Version=1.0.15}} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Importing IIS module to make the IIS:\ Drive available | |
Import-Module WebAdministration -ErrorAction SilentlyContinue | |
#Make sure to put the name of your deploy step name inside the Brackets. | |
$appPool = "IIS:\\AppPools\" + $OctopusParameters['Octopus.Action[YOURDEPLOYSTEPNAME].IISWebSite.ApplicationPoolName'] | |
#Setting the .NET CLR Runtime of the app pool to "" which is the same as "No Managed Code" | |
Set-ItemProperty $appPool managedRuntimeVersion "" -verbose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ServiceConfigFileName = "ServiceConfiguration.Cloud.cscfg" | |
$CscfgFile = Get-Item $ServiceConfigFileName | |
If (Test-Path $CscfgFile){ | |
Write-Output "File $ServiceConfigFileName was found on $($cscfgfile.FullName)" | |
} | |
else{ | |
Write-Error "File $ServiceConfigFileName was not found" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$APIKey = "" <-#API Key to authenticate to your Octopus server. This is the only parameter you must fill manually. | |
function GetMachines([string]$APIKey){ | |
$OctopusURL = $OctopusParameters["Octopus.web.baseurl"] | |
$IDs = $OctopusParameters["Octopus.Deployment.Machines"] | |
$MachineIds = $IDS.Split(",") | |
function Get-FromOctopus([string]$relUrl) { | |
$uri = "$OctopusUrl$relUrl`?apiKey=$ApiKey" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$usernameToFind = "DOMAIN\USERNAME" | |
Add-Type -AssemblyName System.DirectoryServices.AccountManagement | |
$contextType = [System.DirectoryServices.AccountManagement.ContextType]::Domain | |
$context = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -argumentlist ($contextType) | |
$user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($context, $usernameToFind) | |
Write-Output $user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true,Position=1)] | |
[string]$OctopusUrl = "http://localhost:80", | |
[Parameter(Mandatory=$true,Position=2)] | |
[string]$ApiKey, | |
[Parameter(Mandatory=$false,Position=3)] | |
[switch]$Delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Id": "deploymentprocess-Projects-2", | |
"ProjectId": "Projects-2", | |
"Steps": [ | |
{ | |
"Id": "cfd737a4-ad3d-4702-b841-a88f9f2c5271", | |
"Name": "Script", | |
"RequiresPackagesToBeAcquired": false, | |
"Properties": { | |
"Octopus.Action.TargetRoles": "webserver" |