Question about Deployments - Client.API

We are working on a solution to get the latest release version deployed to a specific environment based upon Environment Name, and Project Name. Where the question comes is in how to retrieve a Deployment using Octopus.Client. Once we are able to get this value it will be passed to Octo.exe to automate our refresh and redeploy process for non-production environment. I am currently using the Octopus-Cmdlets solution from GitHub (https://github.com/Swoogan/Octopus-Cmdlets).

Thanks in advance for any guidance.

  • Scott

Hi Scott,

Thanks for getting in touch!
The following: var dashboard = Repository.Dashboards.GetDynamicDashboard(new[] {project.Id}, new[] {environment.Id}); will tell you the current release given a project and environment.
It’s actually used by octo.exe which you can see in the link below how it is used for the promote-release feature.
https://github.com/OctopusDeploy/Octopus-Tools/blob/master/source/OctopusTools/Commands/PromoteReleaseCommand.cs

The promote command in Octo.exe might also just be all you need: octo.exe promote --from UAT --to Production --project Projectname

Hope this helps!
Vanessa

Thanks. That gave me what I was looking for.