Protected branches API: support `deploy_key_id`
What does this MR do and why?
Contributes to #354657 (closed)
Problem
It's possible to modify deploy_key_id
via UI, but this functionality
is missing for REST API.
Solution
Allow to accept deploy_key_id
for Allowed to push
settings.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- Create a deploy key (see guide).
- Enable a deploy key for the project with write permissions
- Discover a deploy key id via API (example:
http://gdk.test:3000/api/v4/projects/<project_id>/deploy_keys
) - Create a protected branch with a deploy key
curl --request POST --header "PRIVATE-TOKEN: <private-token>" "http://gdk.test:3000/api/v4/projects/<project_id>/protected_branches?name=*-stable&allowed_to_push%5B%5D%5Bdeploy_key_id%5D=<deploy_key_id>"
- You should see a new protected branch record with a deploy key
Edited by Vasilii Iakliushin