xo-energy / action-octopus-build-information

GitHub Action that generates build information for Octopus Deploy
ISC License
4 stars 4 forks source link

Octopus API Paged Endpoints Not Working #5

Closed blytheaw closed 4 years ago

blytheaw commented 4 years ago

Hello!

I have been experiencing an issue where some (but only a handful) project builds were returning No project named '${inputs.octopusProject}' was found when trying to fetch the Octopus project.

After replicating some of the API calls being made, I discovered the endpoint used for getting the projects is a paged endpoint, and it only returns up to 30 projects in one page. It also has the projects sorted in alphabetical order. I have 39 projects, so the 9 projects beyond the 30 in alphabetical order are not being found by the action.

This is for the Octopus endpoints /api/projects and api/{baseSpaceId}/projects.

One fix would be to implement paging for at least project resource requests, as I think those are the most likely to have many resources in an Octopus account. Alternatively, according to the Swagger API docs for Octopus, there are non-paged versions of these endpoints at /api/projects/all and api/{baseSpaceId}/projects/all. I tested these out and they provide more than 30 projects, but the JSON structure of the response is slightly different than the other endpoints.

The second option seems the least invasive and simpler of the two. I'm happy to contribute a pull for either of these or a different solution to this issue.

Thanks!

wjrogers commented 4 years ago

Good catch. I'd be happy to accept a PR because I probably won't have time to work on this soon.