I’ve setup drone 0.7 (also 0.8 with the same result) on AWS ECS using bitbucket cloud as source control provider. I’m able to login with my user but I can’t activate any repo because it gives me 500. I have tested this with both versions and have the same result.
Bitbucket it’s an organization repo and I’m an user with admin permisions on that org. I have successfully setup the OAuth consumer as I’m able to login to drone using my bitbucket user.
Unfortunately Bitbucket error messages are a bit lacking, but below are some common reasons that activating a Bitbucket repository will fail. Note that you can also check your drone server logs, which may provide some more details.
1. Not enabling all of the following Bitbucket scopes when you registry the application:
Account:Email
Account:Read
Team Membership:Read
Repositories:Read
Webhooks:Read and Write
2. Not having admin access to the repository in Bitbucket. This is required in order to create the webhooks
3. Using Drone with a private URL or address. Bitbucket will error if you try to create a webhook at a URL that it cannot reach. This includes localhost.
I just created a repo under my user and got the same result (I can see the new repo, but can’t activate it) which makes me wonder, the oauth consumer at what level should be set?
I have set the oauth consumer at the org setting not the user setting (which makes sense to me since I won’t be the only one managing drone builds, but made me wonder if would be related
You mentioned that you get a 500 … can you check the HTTP message response? The error message should be included in the response body. If it does not surface the message in the UI you can check the chrome developer console / network monitor.
General
Request URL:http://drone.siplay.io:8000/api/repos/siplay/sipbot
Request Method:POST
Status Code:500 Internal Server Error
Remote Address:172.20.130.4:8000
Referrer Policy:no-referrer-when-downgrade
It looks like Bitbucket is rejecting the request. The only time I’ve seen this happen is why your server address is localhost / not publicly accessible by Bitbucket.
Note that when running Drone behind a load balancer or reverse proxy it will mask the real server address. When this happens drone will think that its address is localhost, and will therefore use localhost to construct the webhook URL. This can be solved by configuring your reverse proxy to set the appropriate X-Forwarded-For and X-Forwarded-Proto headers.
Also are you sure http://drone.siplay.io:8000 is publicly accessible so that Bitbucket can post webhooks to that address? I am unable to access the URL from my browser.
that’s not what this setting stand for: DRONE_HOST?
Bradry thanks for your help! yeah…what you found was that I was exposing the app through an internal Load balancer, and since I was testing inside my VPN didn’t realize that wasn’t public, I have changed that and I’m allowed to use it now. Another pair of eyes was really good!
yep, but the drone_host configuration parameter is brand new, and is being introduced into the codebase gradually. Eventually it should completely eliminate this class of problems