Determine last successful release of same project in same lane

I am writing a powershell script step, and I am trying to determine the best way to find the id of the last successful release in the same environment that the currently running release is in.

We used to be able to call:
/api/dashboard/dynamic?environments=Environments-1&projects=projects-11&includePrevious=true
and it would return the most recent successful release for the given environment and project. This doesn’t work any more since we upgraded to 3.0.

Any suggestions on what we should be doing differently?

Hi Michael,

Thanks for getting in touch!

You’re right, it does appear that the previous release is now the previous release regardless of state. In 2.6, the previous successful release was returned.

I’ve raised a GitHub issue so we can investigate further: https://github.com/OctopusDeploy/Issues/issues/1807. Please note, however that this may be intended behaviour.

In the meantime, you could use the api/deployments?projects=Projects-11&environments=Environments-1 call to return all recent deployments to that environment. When iterating through each result, if you follow the Task link, the State property should tell you whether it succeeded. It’s a little more work, but it should work.

Hope that helps!

Damo

Thanks,

We can use that method of finding the release, we just were surprised to find that it had changed.

Hi Michael,

I understand. It’s something we should have highlighted if it was a breaking change, so I’m sorry about that!

If you keep an eye on that issue, we’ll work out what it should be doing.

Thanks,
Damo

Hi Michael,
Thanks for reporting this issue. A fix for has now been made and will be included in the next 3.0.12 release in the next day or so. Keep an eye on the downloads page and it should soon be ready for you to update.
Thanks again,
Rob