[go: up one dir, main page]

Skip to content

Setting a value on only_mirror_protected_branches via projects API during project creation doesn't work

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

If you attempt to set only_mirror_protected_branches to a true or false value when creating a project through the Projects API, it won't apply, and the value of the parameter will remain as null. However, it'll work fine if you try to change that parameter on an existing project via the Projects API.

Steps to reproduce

Create a project via the Projects API and attempt to set only_mirror_protected_branches to true.

curl --request POST \
 --data "name=<project-name>\
&namespace_id=<namespace_id>\
&mirror=true\
&mirror_trigger_builds=true\
&only_mirror_protected_branches=true\
&import_url=https://<username>:<private-token>@gitlab.com/<example-group>/<example-project>.git" --header "PRIVATE-TOKEN: <private-token>" "https://gitlab.com/api/v4/projects/" | jq -r

The result of this will be:

"mirror_overwrites_diverged_branches": null

If you then try to set only_mirror_protected_branches to true on the created project via the Projects API, the intended change will succeed.

curl -X PUT --header "Content-Type: application/json" --header "PRIVATE-TOKEN:${TOKEN}" \
   "https://gitlab.com/api/v4/projects/29081288?only_mirror_protected_branches=true&name=<project-name>" | jq -r

Note: The name parameter is included in this example API request, even though we only want to change the value of only_mirror_protected_branches - This is due to a separate open issue: #300101 (closed)

What is the current bug behavior?

The value defined for mirror_overwrites_diverged_branches in the API request when creating a project is never applied.

What is the expected correct behavior?

The value defined for mirror_overwrites_diverged_branches in the API request when creating a project should be applied to the project as expected.

Edited by 🤖 GitLab Bot 🤖