Octopus.Client - get all releases for a project?

Using Octopus.Client, what’s a more efficient way to get all releases of a particular project? Currently, we inefficiently retrieve all releases and apply downstream filtering to get what we need.

$octopusRelease = $repository.Releases.FindAll() | Where { $_.ProjectId -eq $octopusProject.Id }

What are our options?

Hi Michael,

Thanks for getting in touch! You can use the GetReleases method on the Projects repository:

$releaseRespose = $repository.Projects.GetReleases($octopusProject)

If you want to get more than the latest 30 releases, you will need to use the paginate funaction. In C# you would need to do this (sorry I’m not the best at powershell):

var releases = new List<ReleaseResource>();
repository.Client.Paginate<ReleaseResource>(project.Links["Releases"], page =>
	return true;

Hope that helps!

Robert W


This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.