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
#Change dll path accordingly | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Newtonsoft.Json.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Platform.dll" | |
#Connection data | |
$apikey = "YOUR-API" | |
$OctopusURI = "http://YourOctopusURL" | |
$headers = @{"X-Octopus-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
<# | |
.Synopsis | |
Updates the Step Templates used on Deployment Processes to the latest versions | |
.DESCRIPTION | |
Step templates can be updated from the library on Octopus, but that doesnt mean that the Deployment processes using that template will start using the latest version right away. Normally, the user would have to update the step template on each deployment process manually. This script takes care of that. | |
.EXAMPLE | |
Update-StepTemplatesOnDeploymentProcesses -ActionTemplateID "ActionTemplates-3" -OctopusURI "http://localhost" -APIKey "API-RLMWLZBPMX5DRPLCRNZETFS4HA" | |
.EXAMPLE | |
Update-StepTemplatesOnDeploymentProcesses -AllActionTemplates -OctopusURI "http://Octopusdeploy.MyCompany.com" -APIKey "API-TSET42BPMX5DRPLCRNZETFS4HA" | |
.LINK |
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
#make sure this path is correct on your machine | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Newtonsoft.Json.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Client.dll" | |
Add-Type -Path "C:\Program Files\Octopus Deploy\Tentacle\Octopus.Platform.dll" | |
$OctopusURI = "" #i.e "Http://Octopus.MyAwesomeCompany.com" | |
$apikey = "" #i.e "API-7CH6XN0HHOU7DDEEUGKUFUR1K" | |
$endpoint = new-object Octopus.Client.OctopusServerEndpoint "$($OctopusURI)","$($apikey)" | |
$repository = new-object Octopus.Client.OctopusRepository $endpoint |
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
$Try = 0 | |
$MaxRetries = 5 | |
$SecsBeforeRetry = 5 | |
$PSEmailServer = "smtp.company.com" | |
$from = "[email protected]" | |
$to = "[email protected]" | |
$subject = "Amazing Subject" | |
$body = "Interesting stuff" | |
do{ |
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
Add-Type -Path "C:\Tools\Newtonsoft.Json.dll" | |
Add-Type -Path "C:\Tools\Octopus.Client.dll" #Make sure its version 2.6.x or higher. Otherwhise you'll get errors with the LifecycleId property | |
Add-Type -Path "C:\Tools\Octopus.Platform.dll" | |
$OctopusURI = "" #i.e "Http://Octopus.MyAwesomeCompany.com" | |
$apikey = "" #i.e "API-7CH6XN0HHOU7DDEEUGKUFUR1K" | |
$endpoint = new-object -TypeName Octopus.Client.OctopusClient(New-Object Octopus.Client.OctopusServerEndpoint($OctopusURI,$apikey)) | |
$repository = new-object Octopus.Client.OctopusRepository $endpoint |
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
var client = new OctopusClient(new OctopusServerEndpoint(octoUrl, apiKey)); | |
var repo = new OctopusRepository(client); | |
var project = repo.Projects.FindByName("MyOriginalProject"); | |
var newProject = new ProjectResource | |
{ | |
Name = "MyClonedProject", | |
Description = "Cloned copy", | |
ProjectGroupId = project.ProjectGroupId, |
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 = "Your API Key" | |
$OctopusURL = "Your Octopus URL" | |
$Header = @{ "X-Octopus-ApiKey" = $apiKey } | |
$ProjectName = "Your Project Name" | |
$EnvironmentName = "Your Environment Name" | |
#Getting Environment and Project By Name | |
$Project = Invoke-WebRequest -Uri "$OctopusURL/api/projects/$ProjectName" -Headers $Header| ConvertFrom-Json |
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 = "Your API Key" | |
$OctopusURL = "Your Octopus URL" | |
$Header = @{ "X-Octopus-ApiKey" = $apiKey } | |
#Release you want to block | |
$ReleaseID = "Your Release ID" #i.e. releases-2610 | |
$body = @{description="This is the description for the blocking"} | ConvertTo-Json |
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 = "Your API Key" | |
$OctopusURL = "Your Octopus URL" | |
$MaintenanceMode = "True" #Only accepts "True" or "False". Values must be strings | |
$Header = @{ "X-Octopus-ApiKey" = $apiKey } | |
$body = @{IsInMaintenanceMode=$MaintenanceMode} | ConvertTo-Json | |
Invoke-WebRequest -Uri "$OctopusURL/api/maintenanceconfiguration" -Method PUT -Headers $Header -Body $body |
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
$OctopusURI = "Your Octopus URI" | |
$OctopusAPIKey = "Your Octopus APIKey" | |
$TaskID = "Task ID" #Task ID to cancel asociated with the deployment. e.g "Servertasks-3567" | |
$Header = @{ "X-Octopus-ApiKey" = $OctopusAPIKey } | |
Invoke-WebRequest -Uri "$OctopusURI/api/tasks/$TaskID/cancel" -Method Post -Headers $Header |
OlderNewer