Closed Bug 1797177 Opened 2 years ago Closed 2 years ago

Allow github linking API endpoint in BMO to also parse a ping event when someone first sets up the webhook

Categories

(bugzilla.mozilla.org :: API, enhancement)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: dkl, Assigned: dkl)

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
Details | Review

Currently BMO will return a 400 when GIthub sends a test ping to BMO when the webhook is first setup. The API should also accept the ping event and return 200 if everything checks out.

Header:

Request URL: https://bugzilla-dev.allizom.org/rest/github/pull_request
Request method: POST
Accept: */*
content-type: application/json
User-Agent: GitHub-Hookshot/abbd694
X-GitHub-Delivery: 
X-GitHub-Event: ping
X-GitHub-Hook-ID: 
X-GitHub-Hook-Installation-Target-ID: 
X-GitHub-Hook-Installation-Target-Type: repository
X-Hub-Signature: sha1=
X-Hub-Signature-256: sha256=

Sample ping payload:

{
  "zen": "Mind your words, they are important.",
  "hook_id": 383015217,
  "hook": {
    "type": "Repository",
    "id": 383015217,
    "name": "web",
    "active": true,
    "events": [
      "push"
    ],
    "config": {
      "content_type": "json",
      "insecure_ssl": "0",
      "secret": "********",
      "url": "https://bugzilla-dev.allizom.org/rest/github/pull_request"
    },
    "updated_at": "2022-10-05T18:46:39Z",
    "created_at": "2022-10-05T18:46:39Z",
    "url": "https://api.github.com/repos/mozilla-bteam/bmo/hooks/383015217",
    "test_url": "https://api.github.com/repos/mozilla-bteam/bmo/hooks/383015217/test",
    "ping_url": "https://api.github.com/repos/mozilla-bteam/bmo/hooks/383015217/pings",
    "deliveries_url": "https://api.github.com/repos/mozilla-bteam/bmo/hooks/383015217/deliveries",
    "last_response": {
      "code": null,
      "status": "unused",
      "message": null
    }
  },
  "repository": {
    "id": 17650869,
    "node_id": "MDEwOlJlcG9zaXRvcnkxNzY1MDg2OQ==",
    "name": "bmo",
    "full_name": "mozilla-bteam/bmo",
    "private": false,
    "owner": {
      "login": "mozilla-bteam",
      "id": 18560992,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE4NTYwOTky",
      "avatar_url": "https://avatars.githubusercontent.com/u/18560992?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/mozilla-bteam",
      "html_url": "https://github.com/mozilla-bteam",
      "followers_url": "https://api.github.com/users/mozilla-bteam/followers",
      "following_url": "https://api.github.com/users/mozilla-bteam/following{/other_user}",
      "gists_url": "https://api.github.com/users/mozilla-bteam/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/mozilla-bteam/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/mozilla-bteam/subscriptions",
      "organizations_url": "https://api.github.com/users/mozilla-bteam/orgs",
      "repos_url": "https://api.github.com/users/mozilla-bteam/repos",
      "events_url": "https://api.github.com/users/mozilla-bteam/events{/privacy}",
      "received_events_url": "https://api.github.com/users/mozilla-bteam/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "html_url": "https://github.com/mozilla-bteam/bmo",
    "description": "bugzilla.mozilla.org source - report issues here: https://bugzilla.mozilla.org/enter_bug.cgi?product=bugzilla.mozilla.org",
    "fork": false,
    "url": "https://api.github.com/repos/mozilla-bteam/bmo",
    "forks_url": "https://api.github.com/repos/mozilla-bteam/bmo/forks",
    "keys_url": "https://api.github.com/repos/mozilla-bteam/bmo/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/mozilla-bteam/bmo/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/mozilla-bteam/bmo/teams",
    "hooks_url": "https://api.github.com/repos/mozilla-bteam/bmo/hooks",
    "issue_events_url": "https://api.github.com/repos/mozilla-bteam/bmo/issues/events{/number}",
    "events_url": "https://api.github.com/repos/mozilla-bteam/bmo/events",
    "assignees_url": "https://api.github.com/repos/mozilla-bteam/bmo/assignees{/user}",
    "branches_url": "https://api.github.com/repos/mozilla-bteam/bmo/branches{/branch}",
    "tags_url": "https://api.github.com/repos/mozilla-bteam/bmo/tags",
    "blobs_url": "https://api.github.com/repos/mozilla-bteam/bmo/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/mozilla-bteam/bmo/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/mozilla-bteam/bmo/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/mozilla-bteam/bmo/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/mozilla-bteam/bmo/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/mozilla-bteam/bmo/languages",
    "stargazers_url": "https://api.github.com/repos/mozilla-bteam/bmo/stargazers",
    "contributors_url": "https://api.github.com/repos/mozilla-bteam/bmo/contributors",
    "subscribers_url": "https://api.github.com/repos/mozilla-bteam/bmo/subscribers",
    "subscription_url": "https://api.github.com/repos/mozilla-bteam/bmo/subscription",
    "commits_url": "https://api.github.com/repos/mozilla-bteam/bmo/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/mozilla-bteam/bmo/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/mozilla-bteam/bmo/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/mozilla-bteam/bmo/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/mozilla-bteam/bmo/contents/{+path}",
    "compare_url": "https://api.github.com/repos/mozilla-bteam/bmo/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/mozilla-bteam/bmo/merges",
    "archive_url": "https://api.github.com/repos/mozilla-bteam/bmo/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/mozilla-bteam/bmo/downloads",
    "issues_url": "https://api.github.com/repos/mozilla-bteam/bmo/issues{/number}",
    "pulls_url": "https://api.github.com/repos/mozilla-bteam/bmo/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/mozilla-bteam/bmo/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/mozilla-bteam/bmo/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/mozilla-bteam/bmo/labels{/name}",
    "releases_url": "https://api.github.com/repos/mozilla-bteam/bmo/releases{/id}",
    "deployments_url": "https://api.github.com/repos/mozilla-bteam/bmo/deployments",
    "created_at": "2014-03-12T01:03:55Z",
    "updated_at": "2022-09-13T00:44:16Z",
    "pushed_at": "2022-10-05T15:57:28Z",
    "git_url": "git://github.com/mozilla-bteam/bmo.git",
    "ssh_url": "git@github.com:mozilla-bteam/bmo.git",
    "clone_url": "https://github.com/mozilla-bteam/bmo.git",
    "svn_url": "https://github.com/mozilla-bteam/bmo",
    "homepage": "https://bugzilla.mozilla.org",
    "size": 58124,
    "stargazers_count": 128,
    "watchers_count": 128,
    "language": "Perl",
    "has_issues": false,
    "has_projects": false,
    "has_downloads": true,
    "has_wiki": false,
    "has_pages": false,
    "forks_count": 182,
    "mirror_url": null,
    "archived": false,
    "disabled": false,
    "open_issues_count": 13,
    "license": {
      "key": "mpl-2.0",
      "name": "Mozilla Public License 2.0",
      "spdx_id": "MPL-2.0",
      "url": "https://api.github.com/licenses/mpl-2.0",
      "node_id": "MDc6TGljZW5zZTE0"
    },
    "allow_forking": true,
    "is_template": false,
    "web_commit_signoff_required": false,
    "topics": [
      "perl"
    ],
    "visibility": "public",
    "forks": 182,
    "open_issues": 13,
    "watchers": 128,
    "default_branch": "master"
  },
  "sender": {
    "login": "dklawren",
    "id": 826315,
    "node_id": "MDQ6VXNlcjgyNjMxNQ==",
    "avatar_url": "https://avatars.githubusercontent.com/u/826315?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/dklawren",
    "html_url": "https://github.com/dklawren",
    "followers_url": "https://api.github.com/users/dklawren/followers",
    "following_url": "https://api.github.com/users/dklawren/following{/other_user}",
    "gists_url": "https://api.github.com/users/dklawren/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/dklawren/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/dklawren/subscriptions",
    "organizations_url": "https://api.github.com/users/dklawren/orgs",
    "repos_url": "https://api.github.com/users/dklawren/repos",
    "events_url": "https://api.github.com/users/dklawren/events{/privacy}",
    "received_events_url": "https://api.github.com/users/dklawren/received_events",
    "type": "User",
    "site_admin": false
  }
}
Attached file GitHub Pull Request
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: