Integration with Bitbucket

  • 17 January 2023
  • 0 replies
  • 431 views

 

With our CI integration to Bitbucket you can upload your latest commits and pull requests to Debricked automatically, or whenever you run your pipeline.

 

Integrate a single repository

  1. Start by generating an access token. Copy the token so that you can use it in the next step.
  2. Configure your DEBRICKED_TOKEN by heading over to your repository -> Repository settings -> Repository variables
  3. Paste in the access token from the previous step. Make sure to secure the token, so that it does not show in the logs.
  4. Go to your repository and add the template to your bitbucket-pipelines.yml file (if the file doesn't exist, create one)
  5. Commit your changes to bitbucket-pipelines.yml and watch the CI run! 

 

Example output: 

For more information on Bitbucket Pipes, please visit https://bitbucket.org/product/features/pipelines. 

You can also take a look at our example repository which uses the Debricked pipe in the pipeline.

 

 

Integrate multiple repositories

 

Note that this functionality is only available on the Bitbucket Premium plan.

Integrating many repositories with one configuration using Bitbucket can greatly simplify the process of managing and deploying code across multiple projects.

You can set this up with shared pipeline configurations:

Step 1: Create a Workspace variable

To avoid having to add the DEBRICKED_TOKEN to every integrated repository, it is possible to share the Debricked token between repositories. In order to enable this, you need to create a Workspace variable. Note: This can only be done by administrators:

  1. Generate a Debricked access token
  2. Sign in to your organisation
  3. From your profile avatar, select a workspace
  4. Click the Settings cog on the top navigation bar
  5. Click on Workspace settings from the Settings dropdown menu
  6. In the menu on the left, go to Pipelines > Workspace variables
  7. Add your token from 1. to a secured variable called DEBRICKED_TOKEN

Step 2: Create a repository for the shared pipeline definition

Set up a repository within your workspace for the shared pipeline definition:

  1. Create a new repository in your workspace or enter an already existing one
  2. Create a bitbucket pipelines yaml file and paste the Debricked template contents. By default, the template sets up scanning in this repository as well. It is, however, possible to deactivate this, by removing or commenting out the bottom pipelines definition (rows 17-19)

Step 3: Set up a reference to shared pipeline definition in required repositories

The final step is to set up the reference template for all repositories you would like to integrate with Debricked.

  1. Create a bitbucket pipelines yaml file in the repository that will reference the shared pipeline definition and paste the contents below
  2. Adjust the references to point to the repository and branch containing the file created in step 2:
pipelines:
default:
running-debricked-scan:
import: <repository_name>:<branch_name>:debricked-scan

 


0 replies

Be the first to reply!

Reply