[go: up one dir, main page]

Skip to content

Cannot set deploy_key_id via API for protect branch / tag

In the docs (https://docs.gitlab.com/api/protected_branches/) it shows that allowed_to_push can include a deploy_key_id. I can do this from the user interface without trouble, its selectable and works.

In !166598 (merged) added support for "Protected branches API: support deploy_key_id"

And in #402238 (closed) it says "Add support for deploy_keys to ProtectedTags REST API"

Nonetheless, the deploy_key_id is set to null when setting it via REST. I can do this successfully in the user interface of 'protected branches', but I note it is not present in the new 'branch rules'

In my request body POST I said:

{ "name": "master", "merge_access_levels": [ { "access_level": 40, "access_level_description": "Maintainer" } ], "push_access_levels": [ { "access_level": 0 }, { "deploy_key_id": 215 } ], "allow_force_push": false }

The response was a 201 CREATED, with:

{ "id": 2436, "name": "master", "push_access_levels": [ { "id": 2467, "access_level": 40, "access_level_description": "Maintainers", "deploy_key_id": null } ], "merge_access_levels": [ { "id": 2442, "access_level": 40, "access_level_description": "Maintainers" } ], "allow_force_push": false }

the deploy_key_id has been nulled.

If i then set it in the front end and do a GET, it is returned, but, if i set it again from the API it is cleared.

Given I can do it from the UI I don't think it is a Tier issue, but the docs are ambiguous on this, I am on Free, Self-Managed.

Edited by 🤖 GitLab Bot 🤖