Skip to content

Use specific values in BitBucket importer pullrequests call

Carla Drago requested to merge 417578-pass-reviewer-param into master

What does this MR do and why?

The standard response from the BitBucket /pullrequests endpoint does not include reviewers. This change uses the fields= parameter option to pass a comma separated list of values required from that endpoint, including reviewers.

The values included are:

comment_count
task_count
type
id
title
description
state
merge_commit
close_source_branch
closed_by
author
reason
created_on
updated_on
destination
source
links
summary
reviewers

Please note, each value is prefixed by values. in the GET request

See #417578 (comment 1949562155)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

reviewers-import

API Request

GET
https://api.bitbucket.org/2.0/repositories/kitchencoders/frogger/pullrequests?state=ALL&sort=created_on&fields=values.comment_count,values.task_count,values.type,values.id,values.title,values.description,values.state,values.merge_commit,values.close_source_branch,values.closed_by,values.author,values.reason,values.created_on,values.updated_on,values.destination,values.source,values.links,values.summary,values.reviewers

API Response

{
    "values": [
        {
            "id": 2,
            "title": "Update Readme",
            "description": "Update Readme",
            "state": "OPEN",
            "merge_commit": null,
            "author": {
                "display_name": "Carla Drago",
                "links": {
                    "self": {
                        "href": "https://api.bitbucket.org/2.0/users/%REDACTED"
                    },
                    "avatar": {
                        "href": "https://secure.gravatar.com/avatar/REDACTED?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCD-5.png"
                    },
                    "html": {
                        "href": "https://bitbucket.org/%7REDACTED/"
                    }
                },
                "type": "user",
                "uuid": "{REDACTED}",
                "account_id": "REDACTED",
                "nickname": "Carla Drago"
            },
            "created_on": "2024-06-14T10:43:57.045650+00:00",
            "updated_on": "2024-06-14T10:43:58.084390+00:00",
            "source": {
                "branch": {
                    "name": "Carla-Drago/update-readme-REDACTED"
                },
                "commit": {
                    "hash": "REDACTED",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/kitchencoders/frogger/commit/REDACTED"
                        },
                        "html": {
                            "href": "https://bitbucket.org/kitchencoders/frogger/commits/REDACTED"
                        }
                    },
                    "type": "commit"
                },
                "repository": {
                    "type": "repository",
                    "full_name": "kitchencoders/frogger",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/repositories/kitchencoders/frogger"
                        },
                        "html": {
                            "href": "https://bitbucket.org/kitchencoders/frogger"
                        },
                        "avatar": {
                            "href": "https://bytebucket.org/ravatar/REDACTED?ts=ruby"
                        }
                    },
                    "name": "frogger",
                    "uuid": "{REDACTED}"
                }
            },
            "reviewers": [
                {
                    "display_name": "Evgeny Rudinsky",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/REDACTED"
                        },
                        "avatar": {
                            "href": "https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:REDACTED"
                        },
                        "html": {
                            "href": "https://bitbucket.org/REDACTED/"
                        }
                    },
                    "type": "user",
                    "uuid": "{REDACTED}",
                    "account_id": "REDACTED",
                    "nickname": "evgeny_rudinsky"
                },
                {
                    "display_name": "Karina",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/REDACTED"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/REDACTED?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FK-3.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/REDACTED/"
                        }
                    },
                    "type": "user",
                    "uuid": "{REDACTED}",
                    "account_id": "REDACTED",
                    "nickname": "krudinskaia"
                },
                {
                    "display_name": "evgeny",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/REDACTED"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/REDACTED?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FE-6.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/REDACTED/"
                        }
                    },
                    "type": "user",
                    "uuid": "{REDACTED}",
                    "account_id": "REDACTED",
                    "nickname": "erudinsky1"
                },
                {
                    "display_name": "Evgeny",
                    "links": {
                        "self": {
                            "href": "https://api.bitbucket.org/2.0/users/REDACTED"
                        },
                        "avatar": {
                            "href": "https://secure.gravatar.com/avatar/REDACTED?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FE-4.png"
                        },
                        "html": {
                            "href": "https://bitbucket.org/REDACTED/"
                        }
                    },
                    "type": "user",
                    "uuid": "{REDACTED}",
                    "account_id": "REDACTED",
                    "nickname": "Evgeny"
                }
            ]
        }
    ]
}

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
before after

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Set up is complex as it needs

  • a bitbucket account with a workspace with users, a project, and pull requests with assigned reviewers
  • an oauth app set up on bitbucket and configured in the gdk
  • users set up on Gitlab with Identities linked to bitbucket uuids
  • a group on gdk with these users added as members

For simplicity I've included a video of the flow that shows the successful import of reviewers. Additionally @erudinsky and I QA-ed the changes with the set up on a sync call.

Related to #417578 (closed)

Edited by Carla Drago

Merge request reports