Find variable usage across all projects and variable sets
When working with library variable sets used in many projects with many steps it is cumbersome to figure out where a given variable is used.
When updating a deployment process, certain tasks become very difficult, such as:
-Renaming or deleting a variable
-Checking validity of a newly-updated variable value across all usages
With a "find all" feature these tasks would be much simpler (plus I'm sure there would be wider-reaching benefits).

Happy to announce we’ve added a usage tab to the variable set page in 2019.5.4, where you can view which projects and releases are using a variable set. While this does not cover all suggestions below, we are confident that this goes a long way to solving the problem.
Finding the usages of individual variables is something that is a lot more complex than it sounds, and we are unlikely to implement. Many variables usages are embedded in strings, or even in files sourced from packages, meaning any results we displayed would be incomplete.
If you think we’ve misinterpreted this suggestion, please raise a new suggestion with a bit more detail about the use case, and let us know in the comments below.
-
Jakub Januszkiewicz commented
@Stephen Kaiser, can you upvote/comment on https://octopusdeploy.uservoice.com/forums/170787-general/suggestions/10237356-variable-references-and-safe-deletion-renaming-of? This one is marked as completed, while that one is not, so upvoting that one might draw Octopus team's attention more.
-
Stephen Kaiser commented
/bump
I am also doing this by hand. We aren't asking for a perfect feature with no edge cases unhandled. Just make the first 80% of my task take 1 minute instead of 6 weeks of finding hidden variables when root causing failures in projects we didn't know were related. -
Jakub Januszkiewicz commented
This is a small step forward, but it's not what was asked here. This request is specifically about variables, not variable sets, it even mentions sample use cases.
In my view, even if the usage report for a variable was incomplete, it would still be a killer feature.
Can you please support at least finding variable usage in the places that Octopus has control over, such as:
1. in any place where variable binding is supported, for example and especially:
- in default values of parameters in custom step templates,
- in parameter values when step templates are used in project process,
- in package references,
2. in scripts (e.g. for Powershell scripts I'd like it to find occurences of $OctopusParameters['My.Variable.Name']),
3. in other variables (e.g. when I have a variable Foo with value "Foo.#{Bar}" I would like the usage of variable Bar to show that it is used by variable Foo; I'm not sure if this is technically the same as 1).I understand you won't be able to find everything, but actually the only truly problematic thing I can think of is the example you gave: files sourced from packages. What other places are there that Octopus has no control over and cannot check? The "variables usages are embedded in strings" argument you give is not clear to me - do you mean the point #3 above? Why would that be a problem, it sounds like an easy thing to check.
You could put a big fat warning in the UI, so that everyone is aware that there are limitations of this feature, but I still think that the 3 points I listed above would cover a vast majority of use cases.
There is another similar suggestion already: https://octopusdeploy.uservoice.com/forums/170787-general/suggestions/10237356-variable-references-and-safe-deletion-renaming-of. I will post a copy of this comment there.
Everyone, let's vote on that one to show how much it is needed!
-
Piers Williams commented
"Finding the usages of individual variables is something that is a lot more complex than it sounds"
We know. We have to do so by hand. Don't tell me the computer can't do it better!
But yes, tracking variable *set* use will make life easier.
-
Mike Sigsworth commented
I needed this info yesterday. It's sad when such an old issue is still unimplemented.
For anyone looking for what I was looking for, using the Octopus REST API was a good means to an end. Here's a PowerShell script to get you started. It will return a list of unused Variable Sets$url = "YOUR_SERVER_ADDRESS/api"
$apikey = "ApiKey=YOUR_API_KEY"
$projects = Invoke-RestMethod "$url/projects?$apikey&take=1000"
$variableSets = Invoke-RestMethod "$url/libraryvariablesets?$apiKey&take=1000"$projectVariableSetIds = $projects.Items | Select-Object -ExpandProperty IncludedLibraryVariableSetIds | Sort-Object | Get-Unique
$allVariableSetIds = $variableSets.Items | Select-Object -ExpandProperty Id$unusedVariableSetIds = $allVariableSetIds | Where-Object { -not ($projectVariableSetIds -contains $_) }
$unusedVariableSets = $unusedVariableSetIds | ForEach-Object { Invoke-RestMethod "$url/libraryvariablesets/$_`?$apiKey" }Write-Host "Unused Variable Sets`n====================" -ForegroundColor Blue
$unusedVariableSets | ForEach-Object {
"ID: $($_.Id)`nName: $($_.Name)`n"
} -
casterlight commented
This would best be done using powershell to leverage the Octopus API. I have done this an it works great to see where my variables are being utilized including seeing what sets are active against each project.
Octopus Deploy could easily put this into the interface though as an internal feature vs having a step template etc... .
-
Anonymous commented
+1
4 years and still no respond?
/bump
-
Alex K commented
Hi I just don't get how this is was not addressed nearly 3 years after it was raised?
Before create a variable I need to check if it was created earlier. How do I search across all the sets? -
Jackie Weng commented
This would be very useful to retire unused variables
-
Piers Williams commented
A basic first step would be to at least show (on the Variable Set page) which projects 'import' that variable set