Skip to content

[Bug][Bitbucket] Bitbucket fails to clone private repo via gitextractor #3312

@hezyin

Description

@hezyin

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

The Bitbucket plugin failed to clone a private repo via gitextractor.

What you expected to happen

The Bitbucket plugin successfully invokes gitextractor on a private repo.

How to reproduce

Version: v0.14.0-alpha1
Installation method: docker-compose

  1. First create a bitbucket connection with
curl --location --request POST 'http://localhost:8080/plugins/bitbucket/connections' \
--header 'Content-Type: application/json' \
--data-raw '{
    "endpoint": "https://api.bitbucket.org/2.0/",
    "username": "yinhezheng",
    "password": "<the app password I created for DevLake>",
    "name": "Bitbucket Cloud"
}'
  1. Then create a blueprint with
curl --location --request POST 'http://localhost:8080/blueprints' \
--header 'Content-Type: application/json' \
--data-raw '{
    "enabled": true,
    "mode": "NORMAL",
    "name": "My Bitbucket Blueprint",
    "cronConfig": "",
    "isManual": true,
    "plan": [[]],
    "settings": {
        "connections": [
            {
                "plugin": "bitbucket",
                "connectionId": <the id of the newly created connection>,
                "scope": [
                    {
                        "entities": [
                            "CODE",
                            "TICKET",
                            "CODEREVIEW",
                            "CROSS"
                        ],
                        "options": {
                            "owner": "yinhezheng",
                            "repo": "incubator-devlake"
                        }
                    }
                ]
            }
        ],
        "version": "1.0.0"
    }
}'

See the screenshot for the generated plan and the URL passed to gitextractor. This URL doesn't work for git clone <URL>.

Screen Shot 2022-10-07 at 5 25 47 PM

Screen Shot 2022-10-07 at 5 35 44 PM

However, I've verified that git clone https://yinhezheng:<my app password>@bitbucket.org/yinhezheng/incubator-devlake.git would work.

  1. Trigger the blueprint with API and see the following error message:

Screen Shot 2022-10-07 at 5 21 22 PM

Anything else

Relevant code: https://github.com/apache/incubator-devlake/blob/main/plugins/bitbucket/api/blueprint.go#L142

Version

main

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/highThis issue is very importanttype/bugThis issue is a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions