Don't allow nil value for allow_force_push

What does this MR do and why?

Contributes to #392871 (closed)

Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/25340

Problem

Protected Branch API allows to set null for allow_force_push parameter. It raises a database exception.

Solution

Use allow_blank: false to prevent allow_force_push to accept null.

How to set up and validate locally

curl --request PATCH --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/projects/2/protected_branches/feature-branch?allow_force_push="

Numbered steps to set up and validate the change are strongly suggested.

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 Vasilii Iakliushin

Merge request reports

Loading