I am attempting to use the octopus.client library to determine if there is a release available for deployment on a specific channel within a project. For example, in the attached image, there is a release on this channel, but has not been deployed to test. It is available to be deployed to test, but since it has not, it is not available to production.
How do I use the client library to query octopus to get the results that will give me that information. I basically need:
For release 68.4.2xxx for test true
For release 68.4.2xxxx for prod false
Thanks for getting in touch. You want to use the progression api (
/api/progression/<projectId>). However I noticed that we have not provided for the explicitly in
Octopus.Client. The progression API is the one used for the project dashboard.
I have now added it and will be releasing it shortly with version
4.18.0. It will most likely be in NuGet by the time you read this.
The following will retrieve all the releases for the project that can be promoted, or are currently deployed for channel ID
Channels-1. The last line then filters that list to the ones that can be, but have not yet been deployed to the environment with ID
var project = repository.Projects.FindByName("MyProject");
var progressions = repository.Projects.GetProgression(project)
.Where(r => r.Channel.Id == "Channels-1");
var canPromoteToEnv2 = progressions.Where(r => r.NextDeployments.Contains("Environments-2"));
Hope that helps,
Thanks for this. I did manage to find a way to get the release progression from the channel release link information, but it did not include the NextDeployments information as the api did.
Thank you for the update. This makes a difference.