Skip to content

Add commit check to GET api/v4/projects

Laura Montemayor requested to merge lm-fix-failure-get-api-projects-id-lint into master

What does this MR do and why?

Part 1/2 for this issue: #349972 (closed)

This fixes the most common failure for the endpoint in Sentry, which happens when using a project with a repository and no commits. It currently returns a 500.

How to set up and validate locally

Create a project with no commits:
curl --request POST --header "PRIVATE-TOKEN: <PRIVATE TOKEN>" 'http://localhost:3000/api/v4/projects' --data "name=PROJECTNAME"

Lint:
curl --header "Content-Type: application/json" --header "PRIVATE-TOKEN: <PRIVATE TOKEN>" "http://localhost:3000/api/v4/projects/:id/ci/lint"

You should get an error that is accurate: Please provide content of .gitlab-ci.yml.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Laura Montemayor

Merge request reports

Loading