Hi, I’m trying to programmatically determine the latest SHA deployed to a Gitlab “environment”. I’m running into some trouble, though, and I’m wondering if anyone has any ideas.
- The environments API does not expose the latest SHA deployed to that environment, so it is to use the deployments API.
- Using the deployments API, you’d have to list all deployments, then parse out the latest deployment with environment.name = “your-environment” name, and extract the SHA. This is doable, however, it appears that the deployments list API (for example https://mygitlab.com/api/v4/projects/440/deployments) returns an incomplete set of deployments. I am only getting a list 17 deployments, starting with the oldest. My newest deployments are not listed. It appears there is a limit on the number of deployments that are returned… And the API doesn’t provide a way to filter or sort what gets returned.
So I am kind of stuff here… Thanks for any help here.
-Dan