Cannot create Push Rule via API (POST)
Summary
Cannot create a new push rule using the API/Curl.
Steps to reproduce
Reproduce error:
- Find/create project and ensure no current push rule exists.
- Send HTTP request:
curl --request POST --data "commit_message_regex='/JIRA\-\d+/'" --data "id:<project id>" --header "PRIVATE-TOKEN: <private token>" http://<hostname>/api/v4/projects/<project id>/push_rule
- Should return something like (with no error):
{"id":1,"project_id":5,"created_at":"2017-07-03T05:28:16.196Z","commit_message_regex":"'/JIRA\\-\\d /'","branch_name_regex":"","deny_delete_tag":false,"member_check":false,"prevent_secrets":false,"author_email_regex":"","file_name_regex":"","max_file_size":0}u
- Look for Push Rule in UI, does not exist.
- Search for Push Rule in Rails console, does not exist.
WORKING:
- Create push rule under Project > Repository > Push Rules
- Send a PUT instead of a POST (with different commit_message_regex):
curl --request PUT --data "commit_message_regex='/JIRA\-\d+/'" --data "id:<project id>" --header "PRIVATE-TOKEN: <private token>" http://<hostname>/api/v4/projects/<project id>/push_rule
- Check project UI or Rails console, Push rule updates as expected.
What is the current bug behavior?
Nothing happens
What is the expected correct behavior?
Should create new push rule to be seen from the UI settings.
Output of checks
Occurs in new Omnibus install
Results of GitLab environment info
Reproduced in 9.2.6 and 9.3.0 (EE)
Edited by Adam Mulvany