Skip to content

Stream audit event for merge request create action

What does this MR do and why?

Stream audit event for merge request create action.

How to set up and validate locally

  1. run rails console and execute below code to enter destination url
group = group.find 1 #replace with your group id here
destination_url = 'https://audit-event.requestcatcher.com/'
AuditEvents::ExternalAuditEventDestination.create(namespace_id: group.id, destination_url: destination_url)
  1. Run gdk start.
  2. Create a project's merge request under group.
  3. you can view audit event stream of approval action on https://audit-event.requestcatcher.com/

Example streaming json payload

{
  "id": 1,
  "author_id": 1,
  "entity_id": 24,
  "entity_type": "Project",
  "details": {
    "author_name": "example_user",
    "target_id": 132,
    "target_type": "MergeRequest",
    "target_details": "Update test.md",
    "custom_message": "Added merge request",
    "ip_address": "127.0.0.1",
    "entity_path": "example-group/example-project"
  },
  "ip_address": "127.0.0.1",
  "author_name": "Administrator",
  "entity_path": "example-group/example-project",
  "target_details": "Update test.md",
  "created_at": "2022-07-04T00:19:22.675Z",
  "target_type": "MergeRequest",
  "target_id": 132,
  "event_type": "merge_request_create"
}

/cc @daveliu

Edited by Linjie Zhang

Merge request reports