Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error configuring Bitbucket/github as external repo in Google Cloud Source Repositories: "Failed to connect repositories"

I've been trying to configure a repository I created on Bitbucket (BB) as an external repo on GCP with no success.

I get a new repo on BB, gave Admin permissions to the same user I used for GCP and log on with it on both sites using the same browser.

On GCP, "Connect external repository", I follow the steps in [1], I can see my BB account and the repos on GCP. I pick the right one, and as a final step, I press "Connect selected repository" and get "Connecting repository ..." for a while, but eventually "Failed to connect repositories". No further info

I read [2] but still no luck.

I suspect I might be missing something that must be done on BB side.

Any help? Thanks a lot

[1] https://cloud.google.com/source-repositories/docs/mirroring-a-bitbucket-repository

[2] Problems connecting to BitBucket with Cloud Build and Source Repositories

like image 494
Taka Avatar asked Sep 02 '19 11:09

Taka


2 Answers

Rather than waiting 3 days for the GCP console to catch up, you can head over to https://console.cloud.google.com/apis/api/sourcerepo.googleapis.com/overview and try to enable this API.

Once enabled, "Google Cloud Source" could connect to the repo straight away for me, and given the similar name / functionalities I would imagine it's just using "Source Repo" under the hood.

like image 164
Dre Westcook Avatar answered Nov 13 '22 09:11

Dre Westcook


After a few hours trying to find a solution, I just tried again 3 days later and it worked. I guess it takes a while to propagate newly created projects on GCP

BTW, after googling a lot for a solution, I found these pages pretty useful, but also bear in mind that you need to be logged on in both github/bitbucket and GCP for it to properly work (at least in my case):

https://fullstackgcp.com/developing-on-gcp-managing-source-codes-with-cloud-source-repositories-cjxhtj8b000251hs14zd58nil

https://cloud.google.com/source-repositories/docs/mirroring-a-github-repository

like image 22
Taka Avatar answered Nov 13 '22 09:11

Taka