Hi,
I need to know what steps use a certain variable from my project variable?
Hi Paul,
Thanks for getting in touch! I’m not sure if this addresses your specific requirement, but my colleague and I did some testing to write an API script to find all project variables and writing the step name in which they’re scoped to. This is using Octopus.Client , an open source .NET framework.
# You can this dll from your Octopus Server/Tentacle installation directory or from
# https://www.nuget.org/packages/Octopus.Client/
Add-Type -Path 'C:\MyScripts\Octopus.Client\Octopus.Client.dll'
$apikey = 'API-54321G2E2UJ2QRO5WIIPI12345' # Get this from your profile
$octopusURI = 'http://OctopusServer/' # Your Octopus Server address
$projectName = "TestProp" # Enter project you want to search
$endpoint = New-Object Octopus.Client.OctopusServerEndpoint $octopusURI, $apiKey
$repository = New-Object Octopus.Client.OctopusRepository $endpoint
$project = $repository.Projects.FindByName($projectName)
$projectVariables = $repository.VariableSets.Get($project.VariableSetId)
foreach ($variables in $projectVariables.Variables) # For each Variable in referenced project - Return Variable Name & Value
{
Write-Host "###########################"
Write-Host "Variable Name = ", $variables.Name
This file has been truncated. show original
I hope this helps! Let me know if I’ve misunderstood your goals here.
Best regards,
Kenny
system
(system)
Closed
December 23, 2018, 5:14am
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.