Connect your Bitbucket Pipeline to Humanitec

Overview

This how to guide explains how to push the Docker images for your Bitbucket repositories to Humanitec using Bitbucket Pipelines.

Set up pipelines for the repository

For each repository whose image you want to push to Humanitec, you must have Bitbucket Pipelines enabled. If you don’t have Pipelines set up, then follow the instructions in the Atlassian documentation.

Add Humanitec token and snippet

  1. Log in to Humanitec.
  2. Click the profile icon in the top right.
  3. Select Organization Settings.
  4. Select the Images tab.
  5. Click the Bitbucket Pipelines button.

Follow the instructions that appear in the modal. Humanitec will provide you with an access token for connecting to Humanitec’s registry and a code snippet to add to your pipeline configuration to push the image.

First, add the token as a repository variable:

  1. Go to the repository you want to connect.
  2. Go to Settings, and then go to Pipelines > Repository variables.
  3. Create a variable called HUMANITEC_TOKEN, and paste the token from the modal as the value.

Click Next to perform the second step:

  1. Copy the snippet from the modal and add it to the end of your bitbucket-pipelines.yml file.
  2. Commit the changes and initiate your pipeline. If the build is successful, your image will appear in the images list on Humanitec.

Lern more about the official Humanitec Pipe on Bitbucket: Build and push to Humanitec.