Project environment information in the Projects API
Problem to solve
We are trying to use Gitlab to track deployments of our services and to collect metrics about the deployments through the API. All services that are deployed are being deployed through gitlab pipelines and have their deploy jobs marked with the environment tag.
The question we are facing is how do we determine which project in gitlab we should care about and track deploys for. There's a lot of projects in gitlab which are personal projects or temporary projects / old projects or is just a project which is for something that doesn't get deployed.
Our solution to this is to track any projects that have an "environment" defined. If the project has an environment then we should care about it and track its deployments.
The issue we have is that to do this we have to make an API for every single project, as the environment information is only available on its own environments API endpoint. This results in a lot of repeated calls every X minutes when we scrape the API for new data.
Target audience
Personas I have selected are Software Developer and System administrator. Software Developer as it would simplify the code to collect this information and Systems Administrator as they would be interested in ways to reduce the usage of the Gitlab API.
Proposal
The solution that comes to mind is to have the projects Environments information provided with the project on the Project API. This way just a single query to retrieve all the projects would be all that's needed to know what projects have environments.
It does not need to be the full environment information. Just the environment name would be enough for our use case, but perhaps the name and ID is all that would be necessary?
What does success look like, and how can we measure that?
success metrics The number of API calls made to get all the environments for all the projects reduces from Total Number of Projects down to 1 (when not using paging on the projects API)