Skip to content

Problem on import a private repository from bitbucket #105

Open
@meigallodixital

Description

@meigallodixital

Mantis 1.2.17, Source Control Integration 0.18, BitBucket Integration 0.18 on a private GIT repository.

Config:
URL https://bitbucket.org/meigallodixital/myapp.com

array(5) {
["bit_basic_login"]=> string(8) "meigallodixital"
["bit_basic_pwd"]=> string(9) "password"
["bit_username"]=> string(8) "meigallodixital"
["bit_reponame"]=> string(9) "myapp.com"
["master_branch"]=> string(7) "master"
}

On import all:

SYSTEM WARNING: 'First parameter must either be an object or the name of an existing class' in '/home/desarrollo/sites/mantis.meigallodixital.com/web/plugins/SourceBitBucket/SourceBitBucket.php' line 255

SYSTEM WARNING: 'First parameter must either be an object or the name of an existing class' in '/home/desarrollo/sites/mantis.meigallodixital.com/web/plugins/SourceBitBucket/SourceBitBucket.php' line 260

Retrieving master ... failed.

Activity

sverhagen

sverhagen commented on Aug 2, 2015

@sverhagen

This particular problem seems to be caused by the URL being malformed, which is due to the parameters being wrong. I figured this out by putting the following on line 254:

error_log("my URL is: " . $t_url);

I could then see the URL in my php.log. That was helpful for me because it made me understand that it's talking to the Bitbucket API: "https://bitbucket.org/api/2.0/repositories/bit_username/bit_reponame/commits/master".

It turned out that I had used my repository name, instead of the repository slug. The name might by something like "My Repository", in which the case would be "my-repository". If you look at the normal Git "clone" URL, you'd find that it looks something like this: "https://bit_basic_login@bitbucket.org/bit_username/bit_reponame.git". And, of course, your problem may be different than mine. FYI, I end up leaving the URL empty for now.

sverhagen

sverhagen commented on Aug 2, 2015

@sverhagen

Another problem that I'm noticing, and this may be not so much a problem in production, but I have been heavily debugging this plugin, is that I'm hitting Bitbucket's rate limits:

Rate limit for this resource has been exceeded

The above message shows up in my PHP log when changing SourceBitBucket.php as follows:

    private function api_json_url( $p_repo, $p_url ) {
            $t_data = $this->url_get( $p_repo, $p_url );
// add this:
error_log($t_data, 0);
            $t_json = json_decode( utf8_encode( $t_data ) );
            return $t_json;
    }

Since the above message isn't JSON, like normal responses, it doesn't get parsed as such, and the script trips over that at the same line 255.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Problem on import a private repository from bitbucket · Issue #105 · mantisbt-plugins/source-integration