"Change approval configuration" API not allowing to change "approvals_required".
here) FOR A MORE DETAILS REPRO
UPDATE: THIS BUG IS STILL VALID, BUT THE DESCRIPTION HERE DOESN'T PROPERLY REPRESENT THE BUG. SEE THE COMMENTS (#!/usr/bin/env bash
AUTH_TOKEN="use your own token"
echo "Getting approvals from: https://gitlab.com/api/v4/projects/12652198/merge_requests/1/approvals"
curl \
-H "Private-Token: ${AUTH_TOKEN}" \
https://gitlab.com/api/v4/projects/12652198/merge_requests/1/approvals | jq
echo "Updating approvals_required to \"2\": https://gitlab.com/api/v4/projects/12652198/merge_requests/1/approvals"
curl \
-H "Private-Token: ${AUTH_TOKEN}" \
--request POST \
-H "Content-Type: application/json" \
--data '{"approvals_required":2}' \
https://gitlab.com/api/v4/projects/12652198/merge_requests/1/approvals | jq
Summary
When trying to change approvals_required
via the API, I get 200 Ok
back, but the value doesn't change.
Steps to reproduce
Checkout this merge request: pauldotknopf/test-project!1
Run the script above.
What is the current bug behavior?
Here is the output from the above script.
Getting approvals from: https://gitlab.com/api/v4/projects/12652198/merge_requests/1/approvals
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 597 100 597 0 0 2776 0 --:--:-- --:--:-- --:--:-- 2776
{
"id": 30583307,
"iid": 1,
"project_id": 12652198,
"title": "Update test-file.txt",
"description": "",
"state": "opened",
"created_at": "2019-06-02T06:45:49.120Z",
"updated_at": "2019-06-02T06:50:07.665Z",
"merge_status": "can_be_merged",
"approved": false,
"approvals_required": 3,
"approvals_left": 3,
"approved_by": [],
"suggested_approvers": [],
"approvers": [],
"approver_groups": [],
"user_has_approved": false,
"user_can_approve": true,
"approval_rules_left": [
{
"id": "fallback-rule",
"name": "",
"rule_type": "fallback"
}
],
"has_approval_rules": false,
"merge_request_approvers_available": true,
"multiple_approval_rules_available": true
}
Updating approvals_required to "2": https://gitlab.com/api/v4/projects/12652198/merge_requests/1/approvals
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 621 100 597 100 24 1445 58 --:--:-- --:--:-- --:--:-- 1503
{
"id": 30583307,
"iid": 1,
"project_id": 12652198,
"title": "Update test-file.txt",
"description": "",
"state": "opened",
"created_at": "2019-06-02T06:45:49.120Z",
"updated_at": "2019-06-02T06:50:07.665Z",
"merge_status": "can_be_merged",
"approved": false,
"approvals_required": 3,
"approvals_left": 3,
"approved_by": [],
"suggested_approvers": [],
"approvers": [],
"approver_groups": [],
"user_has_approved": false,
"user_can_approve": true,
"approval_rules_left": [
{
"id": "fallback-rule",
"name": "",
"rule_type": "fallback"
}
],
"has_approval_rules": false,
"merge_request_approvers_available": true,
"multiple_approval_rules_available": true
}
What is the expected correct behavior?
approvals_required
should be changed to 2.
Notes
This worked on a previous version of GitLab. I use this API as a part of Bulwark.
I've upgraded multiple times, so I can be sure exactly at which version this broke, but it was working in 11.7.6
.
Edited by Paul Knopf