Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script to deploy release to specific tenant
- Loading branch information
1 parent
63819af
commit 4ccc3e2
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
Octopus.Client/PowerShell/Deployments/DeployReleaseToTenant.ps1
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# You can get this dll from your Octopus Server/Tentacle installation directory or from | ||
# https://www.nuget.org/packages/Octopus.Client/ | ||
Add-Type -Path 'Octopus.Client.dll' | ||
|
||
$apikey = 'API-xxx' # Get this from your profile | ||
$octopusURI = 'http://localhost' # Your Octopus Server address | ||
|
||
$releaseId = "Releases-1" # Get this from /api/releases | ||
$environmentId = "Environments-1" # Get this from /api/environments | ||
$tenantId = "Tenants-1" # Get this from /api/tenants | ||
|
||
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI,$apikey | ||
$repository = New-Object Octopus.Client.OctopusRepository $endpoint | ||
|
||
$release = $repository.Releases.Get($releaseId); | ||
$deployment = new-object Octopus.Client.Model.DeploymentResource | ||
$deployment.ReleaseId = $release.Id | ||
$deployment.ProjectId = $release.ProjectId | ||
$deployment.EnvironmentId = $environmentId | ||
$deployment.TenantId = $tenantId | ||
|
||
$repository.Deployments.Create($deployment) |