Hello.
How can we get the lists of the server projects.
Example:
[Server Name] 1 : Project1, Project2 …
[Server Name] 2 : Project3, Project4 …
or
[Tentacle Agent] 1 : Project1, Project2 …
[Tentacle Agent] 2 : Project1, Project2 …
Hello.
How can we get the lists of the server projects.
Example:
[Server Name] 1 : Project1, Project2 …
[Server Name] 2 : Project3, Project4 …
or
[Tentacle Agent] 1 : Project1, Project2 …
[Tentacle Agent] 2 : Project1, Project2 …
You would need to interface with the API to tease that data out. Or you could manually go to the Infrastructure > Deployment Target section then click on the the server you are interested in. Then click Deployments and you will see a list of all projects that have been deployed to that target/server.
Hi,
Thanks for getting in touch! @BlueLion is correct that you would need to go via the API to get this info (thanks for your input!). You’ll have to get every project, their deployment processes and then the roles their steps are scoped to and also assigned to the machines. Unfortunately there aren’t any examples to accomplish this specifically in our sample script repo, but if you go this route we’d love for you to add it up there for others to benefit from.
Sorry it’s not the news you were after! Please don’t hesitate to reach out if you have any questions or concerns moving forward.
Best regards,
Kenny
I wrote a powershell script for this that uses a mix of octopus.client and octopus api, see below, I don’t have the ability to post this to github b/c of firewall reasons (don’t ask ) but feel free to post this as an example if you want. The script takes a text file with server names and generates a CSV with all the project deployments that have gone to each server. You could easily modify this with select -unique and some pattern matching to remove any unwanted text.
Add-Type -Path “C:\yourfoldername\Octopus.Client.dll”
$OctopusURL = ‘http://octopusdeploy.com’
$apikey = ‘API-HOLDTHEDOOR’
$Header = @{ “X-Octopus-ApiKey” = $apiKey }
$servs = Get-Content ‘C:\yourfoldername\serverList.txt’
$endpoint = new-object Octopus.Client.OctopusServerEndpoint $OctopusURI,$apikey
$repository = new-object Octopus.Client.OctopusRepository $endpoint
$obj = foreach ($s in $servs){
if ($machines = $repository.Machines.FindByName($s)){
$mID = $machines.Id
$TasksURL = “$OctopusURL/api/machines/$mID/tasks”
$Deployments = Invoke-WebRequest -Uri $TasksURL -Headers $Header | ConvertFrom-Json
$DeploymentList = $Deployments.Items.Description
New-Object PSObject -Property @{
ServerName = $s;
ServerID = $mID;
Deployments = $DeploymentList | Out-String;
};
}
}
$reportOut = “C:\yourfoldername\deploys.csv”
$Obj | select ServerName, Deployments | Export-Csv -Path $reportOut -Encoding ascii -NoTypeInformation
Hi,
Thanks for following up and taking the time to provide this script! I’m sure that will be helpful to others in the future (and I enjoyed the HOLDTHEDOOR
reference).
Don’t hesitate to reach out if you have any questions or concerns in the future!
Best regards,
Kenny
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.