Skip to content

Instantly share code, notes, and snippets.

@Dalmirog-zz
Last active August 29, 2015 14:28
Show Gist options
  • Save Dalmirog-zz/48ca5fbe45908d1275f3 to your computer and use it in GitHub Desktop.
Save Dalmirog-zz/48ca5fbe45908d1275f3 to your computer and use it in GitHub Desktop.
Add phase to a lifecycle
#### Adding a phase to a lifecycle ####
$lifecycle = Get-OctopusLifeCycle -LifeCycleName "MyLifeCycle" -resourceonly
$phase = New-Object Octopus.Client.Model.PhaseResource
$phase.Name = "Staging"
$phase.OptionalDeploymentTargets.Add("Environments-20") #Adding optional Environment to phase
#$phase.AutomaticDeploymentTargets.Add("Environments-30") #Automatic Environment
$phase.MinimumEnvironmentsBeforePromotion = 0
$lifecycle.Phases.Add($phase)
Update-OctopusResource -Resource $lifecycle -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment