Webhook on milestone status changes

What does this MR do and why?

References

#14213 (closed)

The target of that Merge Request is to provide Webhooks for project milestones opening/closing/reopening/deleting events.

Didn't touch group milestones here - intentionally. That part should be done in a separate MR.

Screenshots or screen recordings

Updated Webhook settings:

image.png

In action:

milestone_webhooks.mp4

JSON from endpoint (caught on reopen-event):

{
  "object_kind": "milestone",
  "event_type": "milestone",
  "project": {
    "id": 3,
    "name": "Gitlab Shell",
    "description": "Nostrum quod corrupti ipsum sequi aliquid consectetur.",
    "web_url": "http://127.0.0.1:3000/gitlab-org/gitlab-shell",
    "avatar_url": null,
    "git_ssh_url": "ssh://git@127.0.0.1:2222/gitlab-org/gitlab-shell.git",
    "git_http_url": "http://127.0.0.1:3000/gitlab-org/gitlab-shell.git",
    "namespace": "Gitlab Org",
    "visibility_level": 10,
    "path_with_namespace": "gitlab-org/gitlab-shell",
    "default_branch": "main",
    "ci_config_path": null,
    "homepage": "http://127.0.0.1:3000/gitlab-org/gitlab-shell",
    "url": "ssh://git@127.0.0.1:2222/gitlab-org/gitlab-shell.git",
    "ssh_url": "ssh://git@127.0.0.1:2222/gitlab-org/gitlab-shell.git",
    "http_url": "http://127.0.0.1:3000/gitlab-org/gitlab-shell.git"
  },
  "object_attributes": {
    "id": 72,
    "iid": 16,
    "title": "v1.0.3",
    "description": "Lorem Ipsum",
    "state": "active",
    "created_at": "2025-06-17 08:21:54 UTC",
    "updated_at": "2025-06-17 08:22:21 UTC",
    "due_date": "2025-06-30",
    "start_date": "2025-06-20",
    "project_id": 3
  },
  "action": "reopen"
}

REST API:

Get data about about WebHook with selected "Milestone events".

image.png

Get the list of Webhook's events: image.png

Create a Webhook (with milestone-events):

image.png

How to set up and validate locally

  1. gdk start (or whatever you use for local development).
  2. Run migrations to add new column to web_hooks table. bundle exec rails db:migrate
  3. Go to some Project -> Settings -> Webhooks and set up new webhook for Milestone events. Set up some endpoint for webhook-listening service (I've used https://webhook.site/). Disable SSL Verification flag - if needed.
  4. Create milestone, close, reopen and delete it - webhook service should catch your requests.
  5. Curl REST API endpoints for creating/editing milestonish-webhook.

Related to #14213 (closed)

Edited by Alex Kozenko

Merge request reports

Loading