Skip to content

Instantly share code, notes, and snippets.

@ErikHen
Last active July 16, 2020 08:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ErikHen/29bc840060afcad64320588edebcc51e to your computer and use it in GitHub Desktop.
Save ErikHen/29bc840060afcad64320588edebcc51e to your computer and use it in GitHub Desktop.
# DXC-S deploy from source environment to target environment. Step two, finish the deploy by swapping slots.
if (-not (Get-Module -Name EpiCloud -ListAvailable)) {
Install-Module EpiCloud -Scope CurrentUser -Force
Write-Host "Installed EpiCloud module."
}
Connect-EpiCloud -ClientKey $OctopusParameters["DXC-S API Key"] -ClientSecret $OctopusParameters["DXC-S API Secret"]
# Find a deployment that has the status "AwaitingVerification".
$deployments = Get-EpiDeployment -ProjectId $OctopusParameters["DXC-S Project Id"]
$ongoingdeployid = 0
Foreach ($deployment in $deployments) {
if ($deployment.parameters.targetEnvironment -eq $OctopusParameters["DXC-S Target environment"] ) {
if ($deployment.status -eq 'AwaitingVerification') {
$ongoingdeployid = $deployment.id
break
}
}
}
if ($ongoingdeployid -eq 0) {
Write-Error "No deployment with status 'AwaitingVerification' was found."
}
else {
Complete-EpiDeployment -ProjectId $OctopusParameters["DXC-S Project Id"] -Id $ongoingdeployid -Wait
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment