Skip to content

Protected tags API: support `deploy_key_id`

What does this MR do and why?

Contributes to #402238 (closed)

Problem

Users can set a deploy key for protected tags via UI. But this functionality is missing for REST API.

Solution

Permit to accept deploy_key_id

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

  1. Create a deploy key (see guide).
  2. Enable a deploy key for the project with write permissions Screenshot_2024-09-23_at_14.31.43
  3. Discover a deploy key id via API (example: http://gdk.test:3000/api/v4/projects/<project_id>/deploy_keys)
  4. 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_tags?name=main&allowed_to_create%5B%5D%5Bdeploy_key_id%5D=<deploy_key_id>"
  5. You should see a new protected tag record with a deploy key

Screenshot_2024-09-23_at_14.41.21

Edited by Vasilii Iakliushin

Merge request reports

Loading