Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a patch on Bugzilla creates a meaningless comment on Jira #984

Open
leplatrem opened this issue Apr 29, 2024 · 5 comments
Open

Adding a patch on Bugzilla creates a meaningless comment on Jira #984

leplatrem opened this issue Apr 29, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@leplatrem
Copy link
Contributor

On Bugzilla:
Screenshot 2024-04-29 at 13 14 48

On Jira:
Screenshot 2024-04-29 at 12 48 27

Event payload received from Bugzilla seems to be:

{
  "insertId": "g2bib0tfpq2yc5tk",
  "jsonPayload": {
    "Fields": {
      "responses_by_step": {},
      "rid": "8acaa3313a960584958f13264bfc3672",
      "current_step": "create_comment",
      "jira": {
        "labels": null,
        "issue": "XXXXX-4799",
        "project": "XXXXX"
      },
      "operation": "comment",
      "msg": "User comment added to Jira issue XXXXX-4799",
      "event": {
        "user": {
          "login": "[email protected]",
          "real_name": "Phabricator Automation",
          "id": 600971
        },
        "routing_key": "comment.create",
        "action": "create",
        "time": "datetime.datetime(2024, 4, 9, 15, 39, 56)",
        "changes": null,
        "target": "comment"
      },
      "extra": {},
      "action": {},
      "bug": {
        "cf_fx_points": "---",
        "see_also": [
          "https://mozilla-hub.atlassian.net/browse/XXXXX-4799"
        ],
        "comment": {
          "is_private": false,
          "number": 1,
          "creation_time": "datetime.datetime(2024, 4, 9, 15, 39, 54)",
          "id": 1655555555,
          "body": ""
        },
        "type": "task",
        "component": "Sidebar",
        "resolution": "",
        "product": "Firefox",
        "severity": "--",
        "assigned_to": "[email protected]",
        "priority": "--",
        "flags": [],
        "groups": [],
        "creator": "[email protected]",
        "is_private": null,
        "status": "NEW",
        "summary": "To X and Y",
        "id": 123456,
        "whiteboard": "[XXXXX-sidebar]",
        "keywords": []
      }
    },
  },
  "logName": "projects/moz-fx-jbi-prod-0397/logs/stdout",
  "receiveTimestamp": "2024-04-09T15:40:10.476080682Z"
}

See https://bugzilla-dev.allizom.org/page.cgi?id=webhooks.html

See #154 #249

@leplatrem leplatrem added the bug Something isn't working label Apr 29, 2024
@alexcottner
Copy link
Contributor

alexcottner commented Apr 29, 2024

Expanding this a bit more, in this scenario I think we want the workflow to be:

  1. JBI receives a comment from phab-bot that is empty
  2. JBI checks attachments on the bug
  3. If we find no patch attachment, do nothing
  4. If we do find a patch as an attachment, send a more meaningful comment to Jira

Possible comment format to Jira:

Attachment added to bugzilla ticket.
{attachment_file_name} - as a link to the attachment
{attachment_description}

Edited to remove part of step four based on comments below.

@leplatrem
Copy link
Contributor Author

and update ticket to in-review if it's in a status less than in-review

I would leave this part to Jira automation for now. We also have #249

@muffinresearch
Copy link
Contributor

and update ticket to in-review if it's in a status less than in-review

I would leave this part to Jira automation for now. We also have #249

Yep, I would agree that Jira automation should be easily able to take care of this with better data in the comment. That's also something that's very project/workflow specific so this would also allow teams to decide if this is something they want and how exactly to act on it as needed.

@muffinresearch
Copy link
Contributor

muffinresearch commented Jun 18, 2024

The change in #997 removed the only rudimentary way to put things in review via automation even though it wasn't ideal. Is there any ETA on being able to provide the details of Phabricator attachments?

@leplatrem
Copy link
Contributor Author

leplatrem commented Jun 19, 2024

We haven't really planned anything about this.

Since #997 seems to be a regression for you, I propose that we cover your use-case with a minimal code change.

I enabled attachment events on JBI non prod and could obtain:

event: {
    action: "create"
    changes: null
    routing_key: "attachment.create"
    target: "attachment"
    time: "datetime.datetime(2024, 6, 19, 13, 53, 29, tzinfo=TzInfo(UTC))"
    user: {
        id: 672219
        login: "[email protected]"
        real_name: "Phabricator Automation"
    }
}

We don't have enough information in the event to display the name of the attachment, but at least we could post a comment that could look like: [email protected] created attachment. This would be trivial and I will implement it now :) But for a better version that pulls attachments information from the bug to post a smarter comment, I can't tell you when it will be done

leplatrem added a commit that referenced this issue Jun 20, 2024
* Add attachment operation

* Call 'create_comment' by default on attachment events

* Add comment by default when an attachment is created

* Improve past verb in comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants