Drone 0.8 broken due to bitbucket V1 API being decommissioned

Hi Brad,

We are pretty early Drone ambassadors and have been heavily relying on it to build pipelines. Unfortunately it seems like as of today, Bitbucket completely decommissioned their API V1 which breaks the Drone webhooks (Deprecation notice - Bitbucket Cloud REST API version 1 is deprecated effective 30 June 2018)

Here is a log sample from the Drone Server:

time="2019-06-12T00:04:54Z" level=error msg="error: gumgum/drone-dummy: cannot find .drone.yml 
in refs/heads/master: Resource removed"
time="2019-06-12T00:04:54Z" level=error msg="Error #01: Resource removed\n" ip=10.202.213.86 
latency=10.060905424s method=POST path="/hook" status=404 time="2019-06-12T00:04:54Z" user- 
agent="Bitbucket-Webhooks/2.0"

We have a lot of pipelines running on 0.8 still and we are wondering if you have any thoughts on how to best deal with that ? Would you potentially consider fixing it in 0.8.X or giving us guidance on how to do so (we unfortunately do not have golang devs)…

Thanks for your time !
Florian,

1 Like

@Lowess I recommend spinning up and testing a Drone 1.x instance. Drone 1.x should be using all Bitbucket 2.0 endpoints and should therefore work without issue.

Drone 1.x is also capable of reading 0.8 yaml configuration files automatically, which can simplify the migration path. We also have a database migration utility which can help you migrate data over https://github.com/drone/drone-migrate

2 Likes

Thanks for the quick feedback Brad I really appreciate.

Is the old syntax still supported in 1.2 ? I have tried running some of our pipelines with this version but seems to not run with the legacy syntax. Is the compatibility kept between 0.8 and 1.0 only or 1.2 should also be backward compatible with the old syntax ?

We will follow your recommendation and let you know how that goes.

Thanks again,
Florian

Drone 1.0 shipped with basic conversion logic, which has improved with each release. So it should work for most repositories. The latest 1.2.1 release includes many improvements for one of our customers that is in the process of upgrading a few hundred repositories.

When automatic conversion does not work you can use drone convert to manually convert, and then manually adjust the yaml as needed.

Did you managed migration to 1.x? We stuck at drone/migrate update-repos step.
Error message: failed to get remote repository" error="Get https://api.bitbucket.org/2.0/repositories

Please fix 0.8 to use the new bitbucket api!! <3

Have been working 1 day to get 1.2 going now, still a mess to get everything working.

Feel free to fork https://github.com/drone/drone/tree/v0.8.10 and fix the bitbucket api issue.

We also face bitbucket api issue, we miragte to 1.x and it’s real pleasure. (more than 20 projects migrated).
Thanks for all the job done ! :star_struck:

Hey folks,

I made an attempt to fix this on my fork. This fork is something I maintain for my clients and it has a few additions compared to the vanilla Drone. See the release notes for these changes: https://github.com/laszlocph/drone-oss-08/releases

The fix in question is not merged yet, but released under the following tags.

laszlocloud/drone-oss-08-agent:0.8.95-bitbucket
laszlocloud/drone-oss-08-server:0.8.95-bitbucket

Just replace the image in your drone installation.

If you use it please let me know in DMs or on the Github issue: https://github.com/laszlocph/drone-oss-08/issues/34 Source code is also available from this issue.

Please keep the comments constructive and actionable. If you are having issues please post a detailed error message and steps to reproduce and we can try to help.

Protip if you are upgrading from 0.8 please do not choose the native Kubernetes runtime. There is a big warning sign in the documentation that states it is experimental and not production ready [1]. Do not ignore this warning.

[1] https://docs.drone.io/installation/github/kubernetes/

@GektorGrom lets start a separate thread to discuss migration. In the new thread, can you please provide your full logs for this command with debug enabled?

1 Like

Hi @GektorGrom, Yes indeed we faced exactly the same issues ! The drone migration utility states that you should perform a bunch of steps while the drone server is offline. Here is what we did to complete this step:

  • drone/migrate update-repos failing with failed to get remote repo... We also had issues related to Invalid Oauth credentials....

  • We run sql update queries directly in the database in order to change the repo_user_id of each repository to work around the Invalid Oauth credentials....

select repo_id, repo_user_id from repos limit 10;
+---------+--------------+
| repo_id | repo_user_id |
+---------+--------------+
| 119     | 1            |
| 190     | 1            |
| 232     | 1            |
| 236     | 1            |
| 237     | 1            |
| 239     | 1            |
| 558     | 1            |
| 1147    | 1            |
| 1441    | 1            |
| 1446    | 1            |
+---------+--------------+
  • We run sql update queries to become admin: update users set user_admin=1 where user_id=1
select user_id, user_login, user_admin from users limit 1;
+---------+------------+------------+
| user_id | user_login | user_admin |
+---------+------------+------------+
| 1       | Lowess     | 1          |
+---------+------------+------------+
1 row in set
Time: 0.105s
  • We started the Drone server and let it sync the repos.

  • Re-run drone/migrate update-repos with all the right settings (We successfully migrated from a previous sqlite storage with Drone 0.8.6).

  • We had to re-toggle the activate/deactivate button in order to ensure webhooks were properly setup

Hope that it can help !