Bitbucket Support for Git Services - that great unknown


#1

Hi guys,

Dow anyone knows how to setup Bitbucket - on premise installation?
DF did not bother to write even a line of explanation in the documentation or the form.

@drewpearce or @Erik_Jacobsen
There is a broken link on the Community page (https://www.dreamfactory.com/community). If you click on Tutorials it will drive to the same page where Git Services documentation is located :slight_smile:

Thanks
Gabriel


#2

@Gabriel thanks for pointing out the broken link, we just migrated our blog a few days ago and missed a couple of links on the site :).

Here are some instructions to get up and running with BitBucket:

Create your BitBucket Account:
CloudApp

Add a project repo:
CloudApp

Make sure your permissions are set how you like:
CloudApp

Create your BitBucket service in the interface:
CloudApp
CloudApp

Test it out on API Docs:

CloudApp
CloudApp

BitBucket Tutorial for learning any more advanced features, etc.:
https://confluence.atlassian.com/bitbucket/tutorial-learn-bitbucket-with-git-759857287.html

Hope that helps!!


#3

@Erik_Jacobsen thank you for the quick reply!

I am using Bitbucket Server solution, so it’s hosted on my server.
At the second part of the step β€œCreate your BitBucket service in the interface:”, I am not sure what to write in the β€œAccount/Organization” field. I tried to use my server address, but it gives me the error below.

Can it be that this service is only working with the bitbucket.org server?
Thanks
Gabriel

{
β€œerror”: {
β€œcode”: 500,
β€œmessage”: β€œCan’t paginate an unsuccessful response.”,
β€œtrace”: [
β€œ0 /data/rest/vendor/dreamfactory/df-git/src/Components/BitbucketClient.php(100): Bitbucket\API\Http\Response\Pager->__construct(Object(Bitbucket\API\Http\Client), Object(Buzz\Message\Response))”,
β€œ1 /data/rest/vendor/dreamfactory/df-git/src/Resources/BaseResource.php(44): DreamFactory\Core\Git\Components\BitbucketClient->repoAll(1, 50)”,
β€œ2 [internal function]: DreamFactory\Core\Git\Resources\BaseResource->handleGET()”,
β€œ3 /data/rest/vendor/dreamfactory/df-core/src/Components/RestHandler.php(335): call_user_func(Array)”,
β€œ4 /data/rest/vendor/dreamfactory/df-core/src/Components/RestHandler.php(197): DreamFactory\Core\Components\RestHandler->processRequest()”,
β€œ5 /data/rest/vendor/dreamfactory/df-core/src/Components/RestHandler.php(254): DreamFactory\Core\Components\RestHandler->handleRequest(Object(DreamFactory\Core\Utility\ServiceRequest), β€˜β€™)”,
β€œ6 /data/rest/vendor/dreamfactory/df-core/src/Components/RestHandler.php(172): DreamFactory\Core\Components\RestHandler->handleResource(Array)”,
β€œ7 /data/rest/vendor/dreamfactory/df-core/src/Services/BaseRestService.php(146): DreamFactory\Core\Components\RestHandler->handleRequest(Object(DreamFactory\Core\Utility\ServiceRequest), β€˜_repo’)”,
β€œ8 /data/rest/vendor/dreamfactory/df-core/src/Services/ServiceManager.php(496): DreamFactory\Core\Services\BaseRestService->handleRequest(Object(DreamFactory\Core\Utility\ServiceRequest), β€˜_repo’)”,
β€œ9 /data/rest/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): DreamFactory\Core\Services\ServiceManager->handleServiceRequest(Object(DreamFactory\Core\Utility\ServiceRequest), β€˜amicido-vcs’, β€˜_repo’, false)”,
β€œ10 /data/rest/vendor/dreamfactory/df-core/src/Http/Controllers/RestController.php(159): Illuminate\Support\Facades\Facade::__callStatic(β€˜handleServiceRe…’, Array)”,
β€œ11 /data/rest/vendor/dreamfactory/df-core/src/Http/Controllers/RestController.php(118): DreamFactory\Core\Http\Controllers\RestController->handleServiceRequest(Object(DreamFactory\Core\Utility\ServiceRequest), β€˜amicido-vcs’, β€˜_repo’)”,
β€œ12 [internal function]: DreamFactory\Core\Http\Controllers\RestController->handleVersionedService(β€˜v2’, β€˜amicido-vcs’, β€˜_repo’)”,
β€œ13 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)”,
β€œ14 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(β€˜handleVersioned…’, Array)”,
β€œ15 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(DreamFactory\Core\Http\Controllers\RestController), β€˜handleVersioned…’)”,
β€œ16 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\Routing\Route->runController()”,
β€œ17 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Route->run()”,
β€œ18 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ19 /data/rest/vendor/dreamfactory/df-core/src/Http/Middleware/AccessCheck.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ20 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): DreamFactory\Core\Http\Middleware\AccessCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ21 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ22 /data/rest/vendor/dreamfactory/df-core/src/Http/Middleware/AuthCheck.php(232): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ23 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): DreamFactory\Core\Http\Middleware\AuthCheck->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ24 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ25 /data/rest/vendor/dreamfactory/df-core/src/Http/Middleware/VerbOverrides.php(42): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ26 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): DreamFactory\Core\Http\Middleware\VerbOverrides->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ27 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ28 /data/rest/vendor/barryvdh/laravel-cors/src/HandleCors.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ29 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Barryvdh\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ30 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ31 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ32 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(660): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
β€œ33 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))”,
β€œ34 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))”,
β€œ35 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(590): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))”,
β€œ36 /data/rest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))”,
β€œ37 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))”,
β€œ38 /data/rest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ39 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ40 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ41 /data/rest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ42 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ43 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ44 /data/rest/vendor/barryvdh/laravel-cors/src/HandlePreflight.php(34): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ45 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Barryvdh\Cors\HandlePreflight->handle(Object(Illuminate\Http\Request), Object(Closure))”,
β€œ46 /data/rest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))”,
β€œ47 /data/rest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))”,
β€œ48 /data/rest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))”,
β€œ49 /data/rest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))”,
β€œ50 /data/rest/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))”,
β€œ51 {main}”
]
}
}


#4

@Gabriel It is the account name or the organization name of the BitBucket account.

Please see this screenshot of the exploded tooltip:

CloudApp


#5

@Erik_Jacobsen I’ve seen the tooltip, but what info should that contain and in what form for an on premise Bitbucket installation?

The instructions are very clear if the repository is on the bitbucket.org server, but what if my Bitbucket server is hosted at https://mybitbucket.mydomain.com/vcs?
I tried to input there the complete URI, but as I said the service does not work.


#6

@Gabriel It looks like that is correct.

I spun up a server instance on my local mac, and the only way to connect a standalone instance of Bitbucket would be as an RWS and build out your own swagger definition since the API endpoints are completely different between any of the Bitbucket.org accounts and the Bitbucket Server accounts. You can still access BitBucket Server as you would any other HTTP service, you just do not get any swagger docs to go with.

BitBucket Server API reference:
https://docs.atlassian.com/bitbucket-server/rest/4.11.1/bitbucket-rest.html

BitBucket Server example:
CloudApp

Pass your basic auth creds in the cURL options using the PHP cURL option CURLOPT_USERPWD which allows you to send the basic auth credentials as {username}:{password}

CloudApp

Using test_rest to get a result back:

CloudApp

Or Postman:
CloudApp

I will put in a feature request to see about getting support added for the standalone server instances.


#7

Thank you @Erik_Jacobsen!
It looks good, I will give it a try.


#8

@Gabriel Thanks for helping flesh out this issue! I will update once we have the integration set up. Have a great weekend!


#9

@Erik_Jacobsen Thank you Erik for the support.
Have a great weekend!