Hi
For anyone who is interested, I have written a script that will check for other running deployments so you can pause another deployment execution if another project deployment is running. You need to download octo.exe and set up a user and API key to use it but thought it may be useful.
function CheckForRunningProjects{
param(
[Parameter(Mandatory=$True)] $currentproj = “”
)
Set-Alias Octo “C:\Octopus\OctopPack\Octo.exe”
$inproject = $false
$result = “”
$EXECUTING = $true
Write-Host “Checking for running projects other than $currentproj”
Do{
$result = “”
$var = octo list-latestdeployments --server=http://youroctopusURL/ --apiKey=API-YOURAPIKEY
foreach($line in $var) {
if($line -match "Project"){
$proj = $line.Replace("- Project: ","")
$inproject = $true
}
if($inproject -and $line -match "State" -and $line -match "Executing" -and $proj -notmatch $currentproj)
{
$result = "$proj is in progress, please wait..."
Write-Host $result
$EXECUTING = $true
}
if($line -eq "")
{
$proj = ""
$inproject = $false
}
if($result -eq "")
{
$EXECUTING = $false
}
else
{
$EXECUTING = $true
}
}
IF($EXECUTING)
{
start-sleep -Seconds 5
}
} while($EXECUTING)
Write-Host “No Other Projects Running”
}