Reputation: 9459
I'm writing powershell scripts to query data from Octopus, sooner or later I need to have a reference to a project or environment in the script. Is it better to use the Name, Id or slug in these situations? Readability and maintainability / brittleness of the scripts are concerns.
Many relative ID's can be looked up from other queries (the release-ID for a given deployment for example) but eventually we need to refer to one specific project.
Upvotes: 3
Views: 1505
Reputation: 5558
In general, I would recommend using the ID as the name is not necessarily unique (variable names, for example) and the ID can't be changed.
When you say "is hard to read in the script as it has no semantic meaning" does that imply you are hard-coding the name/id into the script? Why not put a comment? For example,
$project-id = "Projects-123" # ID of "My Awesome Project"
Upvotes: 2