Skip to content

API to create group push rule

Aishwarya Subramanian requested to merge create-group-push-rules into master

What does this MR do?

This MR adds an api to create push rules for groups.

The api is available for group owners and admins in GitLab starter/bronze and higher tiers.

Request api:

POST https://<gitlab-url>/api/v4/groups/<group-id>/push_rule

Sample request body:

{
    "author_email_regex": "^[A-Za-z0-9.]+@gitlab.com$",
    "commit_committer_check": true,
    "commit_message_negative_regex": "[x+]",
    "commit_message_regex": "[a-zA-Z]",
    "deny_delete_tag": false,
    "max_file_size": 100,
    "member_check": false,
    "prevent_secrets": true,
    "reject_unsigned_commits": true
}

Response:

{
    "id": 13,
    "created_at": "2020-08-20T20:34:21.415Z",
    "commit_message_regex": "[a-zA-Z]",
    "commit_message_negative_regex": "[x+]",
    "branch_name_regex": null,
    "deny_delete_tag": false,
    "member_check": false,
    "prevent_secrets": true,
    "author_email_regex": "^[A-Za-z0-9.]+@gitlab.com$",
    "file_name_regex": null,
    "max_file_size": 100
}

Mentions #224129 (closed)

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Aishwarya Subramanian

Merge request reports