Page MenuHomePhabricator

Send updates about open MRs
Open, MediumPublicFeature

Description

In addition to open/merged/closed events for GitLab MRs, I would like to see:

  • Any reviews or comments added
  • Any new commits added / force-pushed to the source branch

Details

TitleReferenceAuthorSource BranchDest Branch
gitlab: Announce all merge_request actionstoolforge-repos/wikibugs2!39bd808work/bd808/report-mr-updatesmain
Customize query in GitLab

Event Timeline

bd808 triaged this task as Medium priority.May 10 2024, 3:47 PM
bd808 changed the subtype of this task from "Task" to "Feature Request".

Any new commits added / force-pushed to the source branch

I think we can do this one with the existing hooks.

$ grep 'toolforge-repos/wikibugs2/-/merge_requests/37' events.log | jq --compact-output '{"event_type": .event_type, "action": .object_attributes.action}'
{"event_type":"merge_request","action":"open"}
{"event_type":"merge_request","action":"update"}
{"event_type":"merge_request","action":"update"}
{"event_type":"merge_request","action":"update"}
{"event_type":"merge_request","action":"update"}
{"event_type":"merge_request","action":"update"}
{"event_type":"merge_request","action":"update"}
{"event_type":"merge_request","action":"merge"}

Those action: update events are me force pushing to the MR's backing branch.

An example event is:

{
  "object_kind": "merge_request",
  "event_type": "merge_request",
  "user": {
    "id": 14,
    "name": "BryanDavis",
    "username": "bd808",
    "avatar_url": "https://gitlab.wikimedia.org/uploads/-/system/user/avatar/14/avatar.png",
    "email": "bd808@wikimedia.org"
  },
  "project": {
    "id": 2058,
    "name": "wikibugs2",
    "description": "IRC announce bot for Phabricator and Gerrit events\r\n\r\nTool documentation: https://www.mediawiki.org/wiki/Wikibugs\r\n\r\nIssues: https://phabricator.wikimedia.org/tag/wikibugs/",
    "web_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2",
    "avatar_url": "https://gitlab.wikimedia.org/uploads/-/system/project/avatar/2058/wikibugs.png",
    "git_ssh_url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
    "git_http_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2.git",
    "namespace": "toolforge-repos",
    "visibility_level": 20,
    "path_with_namespace": "toolforge-repos/wikibugs2",
    "default_branch": "main",
    "ci_config_path": "",
    "homepage": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2",
    "url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
    "ssh_url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
    "http_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2.git"
  },
  "object_attributes": {
    "assignee_id": null,
    "author_id": 14,
    "created_at": "2024-05-10 00:19:58 UTC",
    "description": "Try some changes to see if we can make gitlab reporting more stable:\n\n* Add a health-check to the gitlab job that will trigger a restart if no SSE data is seen for 2 minutes\n* Move log writing to a background thread to avoid blocking the asyncio loop\n* Log and exit when an aiohttp.ClientError is seen by the SSE client\n\nBug: T364490",
    "draft": false,
    "head_pipeline_id": 52296,
    "id": 10422,
    "iid": 37,
    "last_edited_at": null,
    "last_edited_by_id": null,
    "merge_commit_sha": null,
    "merge_error": null,
    "merge_params": {
      "force_remove_source_branch": "1"
    },
    "merge_status": "unchecked",
    "merge_user_id": null,
    "merge_when_pipeline_succeeds": false,
    "milestone_id": null,
    "source_branch": "work/bd808/gitlab",
    "source_project_id": 2058,
    "state_id": 1,
    "target_branch": "main",
    "target_project_id": 2058,
    "time_estimate": 0,
    "title": "gitlab and concurrency fixes",
    "updated_at": "2024-05-10 03:08:37 UTC",
    "updated_by_id": null,
    "url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2/-/merge_requests/37",
    "source": {
      "id": 2058,
      "name": "wikibugs2",
      "description": "IRC announce bot for Phabricator and Gerrit events\r\n\r\nTool documentation: https://www.mediawiki.org/wiki/Wikibugs\r\n\r\nIssues: https://phabricator.wikimedia.org/tag/wikibugs/",
      "web_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2",
      "avatar_url": "https://gitlab.wikimedia.org/uploads/-/system/project/avatar/2058/wikibugs.png",
      "git_ssh_url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
      "git_http_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2.git",
      "namespace": "toolforge-repos",
      "visibility_level": 20,
      "path_with_namespace": "toolforge-repos/wikibugs2",
      "default_branch": "main",
      "ci_config_path": "",
      "homepage": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2",
      "url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
      "ssh_url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
      "http_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2.git"
    },
    "target": {
      "id": 2058,
      "name": "wikibugs2",
      "description": "IRC announce bot for Phabricator and Gerrit events\r\n\r\nTool documentation: https://www.mediawiki.org/wiki/Wikibugs\r\n\r\nIssues: https://phabricator.wikimedia.org/tag/wikibugs/",
      "web_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2",
      "avatar_url": "https://gitlab.wikimedia.org/uploads/-/system/project/avatar/2058/wikibugs.png",
      "git_ssh_url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
      "git_http_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2.git",
      "namespace": "toolforge-repos",
      "visibility_level": 20,
      "path_with_namespace": "toolforge-repos/wikibugs2",
      "default_branch": "main",
      "ci_config_path": "",
      "homepage": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2",
      "url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
      "ssh_url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
      "http_url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2.git"
    },
    "last_commit": {
      "id": "f0ba9c104a85fd4160b11f3f6f621e66422c5879",
      "message": "logging: Write logs to disk from a background thread\n\nAttempt to prevent logging from blocking the asyncio event loop by\nwriting out logs to disk from a background thread. The implementation\nuses the standard library's logging.handlers.QueueHandler and\nlogging.handlers.QueueListener with a small tweak of not pre-formatting\nmessages in QueueHandler. That step is unnecessary in our case because\nwe are only locally queuing messages,\n",
      "title": "logging: Write logs to disk from a background thread",
      "timestamp": "2024-05-09T21:07:52-06:00",
      "url": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2/-/commit/f0ba9c104a85fd4160b11f3f6f621e66422c5879",
      "author": {
        "name": "Bryan Davis",
        "email": "bd808@wikimedia.org"
      }
    },
    "work_in_progress": false,
    "total_time_spent": 0,
    "time_change": 0,
    "human_total_time_spent": null,
    "human_time_change": null,
    "human_time_estimate": null,
    "assignee_ids": [],
    "reviewer_ids": [],
    "labels": [],
    "state": "opened",
    "blocking_discussions_resolved": true,
    "first_contribution": false,
    "detailed_merge_status": "unchecked",
    "action": "update",
    "oldrev": "c521727a999d85936ca740222647cd90490e4aa8"
  },
  "labels": [],
  "changes": {},
  "repository": {
    "name": "wikibugs2",
    "url": "git@gitlab.wikimedia.org:toolforge-repos/wikibugs2.git",
    "description": "IRC announce bot for Phabricator and Gerrit events\r\n\r\nTool documentation: https://www.mediawiki.org/wiki/Wikibugs\r\n\r\nIssues: https://phabricator.wikimedia.org/tag/wikibugs/",
    "homepage": "https://gitlab.wikimedia.org/toolforge-repos/wikibugs2"
  }
}

Mentioned in SAL (#wikimedia-cloud) [2024-05-10T21:23:01Z] <wmbot~bd808@tools-bastion-12> Built new image from git hash b63637c0 (T364615).

Mentioned in SAL (#wikimedia-cloud) [2024-05-10T21:25:12Z] <wmbot~bd808@tools-bastion-12> Restarted gitlab job to pick up addition MR actions (T364615)

With rTWBTb63637c07007: gitlab: Announce all merge_request actions landed we will start seeing 3 more actions:

[21:20]  <  wb-test> (update) bd808: This is a test of the gitlab irc reporter [toolforge-repos/wikibugs2] - https://gitlab.wikimedia.org/toolforge-repos/wikibugs2/-/merge_requests/33
[21:20]  <  wb-test> (approved) bd808: This is a test of the gitlab irc reporter [toolforge-repos/wikibugs2] - https://gitlab.wikimedia.org/toolforge-repos/wikibugs2/-/merge_requests/33
[21:20]  <  wb-test> (unapproved) bd808: This is a test of the gitlab irc reporter [toolforge-repos/wikibugs2] - https://gitlab.wikimedia.org/toolforge-repos/wikibugs2/-/merge_requests/33

"Update" is for any change to the MR's backing branch. approved/unapproved are the optional workflow button response which I guess is roughly equivalent to a Gerrit "+1".

bd808 moved this task from Need discussion to Backlog on the Wikibugs board.