This page contains instructions for creating a Bitbucket Server configuration so that users will have the option to select Bitbucket Server as the source code repository host for new algorithms they create.
Note that there are two types of Bitbucket Server providers you can use. With this “build-on-checkin via webhook” provider type, when algorithm source code is pushed to the repository’s master branch, the build is triggered automatically. To see what this workflow looks like on the side of the algorithm developer, see the docs for using the Bitbucket Server SCM. See the Bitbucket Server (build-via-API) page for details on how to set up a configuration with the other provider type.
Bitbucket Server setup
To create a Bitbucket Server SCM configuration on Algorithmia, you’ll first need to configure a project on the Bitbucket Server side, as described in this section.
Prerequisites
- Bitbucket Server version >= 5.6 is required.
- Bitbucket Server must be set up with a valid SSL certificate.
Configuring server access
- Log in to Bitbucket Server as an administrator and open the admin dashboard.
- Open the Server settings tab.
- Enter the base URL for the Bitbucket Server instance, including the
https://
part in the string. - Enable HTTPS and SSH access by checking the appropriate boxes. We recommend configuring SSH on a different port than the web interface.
Configuring access token authentication
Once you’ve completed the steps above, create an access token that’ll be used by Algorithmia to manage repositories on behalf of a user.
- Log in as a non-admin user.
- Click on the profile menu in the upper-right corner and click Manage account.
- Go to the Personal access tokens submenu.
- Create a new token with admin permissions for both projects and repositories.
Note that in practice we only require “read” project permissions and “write” repository permissions. However we’ve experienced permission errors when using tokens with lesser-than-admin permissions, so to make sure everything works as expected it’s best configure the token with admin/admin permissions.
Creating a new project
Once the server is set up correctly, you can create a new project where all Algorithmia-managed repositories will be hosted.
- Open the Projects view.
- Create a new project for containing new algorithm repositories and note the project key.
- Open project settings and go to the Project permissions tab.
- In User access select admin access for the user configured in the previous step.
Algorithmia setup
Once you’ve created an access token within Bitbucket Server as described above, log in to Algorithmia as a cluster admin and navigate to the Source Code Management page from the admin panel. Click the Add SCM Configuration button and select Bitbucket Server from the drop-down.
Enter the base website, API, and SSH endpoint URLs specific to your Bitbucket Server instance.
The Website URL is the URL of your Bitbucket Server instance. Note that each SCM configuration must have a unique (Website URL, project key) pair.
The API URL is the URL for your Bitbucket Server instances’s API.
The SSH URL is the URL from which we’ll attempt to pull source code from your Bitbucket instance; remember to specify port 8000 at the end of the URL.
Under the OAuth information section, enter the values from the token configuration above for project key and personal access token and click Create SCM Configuration.
Once you’ve created the configuration, it’ll show up in the list of SCM configurations on the Source Code Management page.