Remove-PackageVersionsNotUsedByOctopus replaces PurgeNugetFeeds
Remove-PackageVersionsNotUsedByOctopus.ps1 replaces PurgeNugetFeeds.ps1. It is safer with regard to your packages that are unrelated to Octopus deployments, because:
- It only considers those package IDs that are in use by your Octopus instance.
- It only considers package feeds you explicitly include via argument.
- It only runs if it can verify it is running with Octopus Deploy privileges sufficient to enumerate every package ID and version referenced by every Release across every Space.
- It does not rely on information from its previous run.
- It checks for packages used by runbook snapshots in addition to releases.
@harrisonmeister or @patrick-smergut-octopus - Could you review this PR when you are able? I see you have both worked on REST/PowerShell/Feeds/SyncPackages.ps1, the innards of which do some similar things. I contributed PurgeNugetFeeds.ps1 but now realize its design made it too easy for the user to remove packages they did not intend. As described above, this PR replaces it with the intrinsically much saferRemove-PackageVersionsNotUsedByOctopus.ps1.
Please review. The existing script is not safe