Bitbucket is one of the industry-leading repository management solutions that allow developers to seamlessly implement open DevOps tasks.

Bitbucket offers a variety of services to developers, such as allowing teams to collaborate and create projects, as well as test and deploy code in a single platform. One such effective service of Bitbucket is pipelines, which allows developers to implement continuous integration and delivery operations, thereby empowering teams to build, test, and deploy codes within the Bitbucket environment.

In this article, you will learn about Bitbucket pipelines, and how to set up Bitbucket Pipelines.

Prerequisites

A fundamental understanding of creating data pipelines.

What are Bitbucket Pipelines?

bitbucket logo

Bitbucket Pipelines are a CI/CD service that is built into Bitbucket. It enables you to build, test, and even deploy your code automatically based on a configuration file in your existing repository. In addition, Bitbucket builds containers in the cloud where you can run commands inside these containers, just like you would on a local machine, but with all the benefits of a new system, customized and configured for your needs. Read how to trigger pipelines in bitbucket to automate your pipelines.

These pipelines also allow you to configure and execute specific actions on your repositories whenever you push code to the origin. You can run tests, builds, and even SSH into our production servers to move code or restart processes while being wired up with messaging hooks to remain updated while Pipelines handles everything.

Optimizing CI/CD Workflows using Hevo

Using manual scripts and custom code to move data into the warehouse is cumbersome. Hevo’s reliable data pipeline platform enables you to set up zero-code and zero-maintenance data pipelines that just work. Here’s why you should try Hevo:

  • Reliability at Scale: With Hevo, you get a world-class fault-tolerant architecture that scales with zero data loss and low latency. 
  • Monitoring and Observability: Bring real-time visibility into your ELT with alerts and activity logs 
  • Auto-Schema Management: Hevo automatically maps the source schema to the destination warehouse so that you don’t have to deal with schema errors.
  • 24×7 Customer Support: Discover peace with round-the-clock live chat within the platform.

Steps to set up Bitbucket Pipelines

Step 1: Enable Pipelines

  1. Log in to Bitbucket and navigate to your repository.
  2. Go to Repository Settings > Pipelines and enable it.

Step 2: Create bitbucket-pipelines.yml

  • Add a file named bitbucket-pipelines.yml to the root of your repository.
  • Use this template based on your project type:

Example 1: Node.js Project

pipelines:
  default:
    - step:
        name: Install Dependencies
        image: node:16
        script:
          - npm install
    - step:
        name: Run Tests
        script:
          - npm test

Example 2: Python Project

pipelines:
  default:
    - step:
        name: Run Tests
        image: python:3.9
        script:
          - pip install -r requirements.txt
          - pytest

Step 3: Commit and Push

Save the file, then run:

git add bitbucket-pipelines.yml
git commit -m "Add Bitbucket Pipelines configuration"
git push

Step 4: Monitor Pipeline Runs

  • Go to the ‘Pipeline’ section to view and debug runs.

How to Change Template in Pipelines?

You can change the template at any time to change the use case by opening the dropdown menu and selecting another template. Note: If you choose a new template, the existing content will be overwritten.

Bitbucket Pipelines: change template | Hevo Data

How to Add Pipes to Pipelines?

Bitbucket provides a variety of pre-built pipes to simplify tasks in your CI/CD workflows. Adding a pipe to your pipeline involves selecting the desired pipe, copying its configuration, and pasting it into your bitbucket-pipelines.yml file. Below are two methods to add pipes to your pipeline:

1. Using the Online Editor

  • Open the Bitbucket online editor and navigate to your bitbucket-pipelines.yml file.
  • Click ‘Explore More Pipes’ to view the available options.
  • Copy the pipe snippet and paste it into the script section of your step.
  • Add required values in single quotes and uncomment optional variables if needed.
Bitbucket Pipelines: add steps | Hevo Data

Once added, your pipeline is ready to execute with the selected pipe.

2. Editing the Configuration File Directly

  • Open your bitbucket-pipelines.yml in a text editor.
  • Visit the pipe’s repository, review the README.md, and copy the usage snippet.
  • Paste the snippet into the appropriate step and customize variables as needed.
Integrate JIRA to BigQuery
Integrate JIRA to Redshift
Integrate JIRA to Snowflake

Conclusion

In this article, you learned about Bitbucket pipelines, examples, and how to set up these pipelines. However, you can further explore and understand the step-by-step procedures to create pipes and customize the YAML configuration files to build more effective pipelines for different use cases.

Hevo can ETL your Jira Data to Amazon Redshift, Firebolt, Snowflake, Google BigQuery, PostgreSQL, Databricks, etc., with just a few simple clicks. Not only does Hevo export your data and load it to the destination, but it also transforms and enriches your data to make it analysis-ready. Sign up for Hevo’s 14-day free trial and experience seamless data migration.

FAQs

1. What is the difference between Bitbucket pipeline and Jenkins?

Bitbucket Pipelines is a cloud-based CI/CD service integrated with Bitbucket for seamless code deployment and automation. Jenkins is a widely used open-source CI/CD tool that can be self-hosted and offers extensive plugin support and flexibility. Jenkins requires more configuration, whereas Bitbucket Pipelines is easier to set up but less customizable.

2.  What is the function of Bitbucket pipeline?

These pipelines is a CI/CD (Continuous Integration/Continuous Deployment) tool integrated with Bitbucket. It automates software development projects’ build, test, and deploy phases directly from repositories hosted on Bitbucket.

3. How to run a Bitbucket pipeline?

Push changes to your repository with a configured bitbucket-pipelines.yml file to run a Bitbucket pipeline. The pipeline will trigger automatically. You can manually trigger it by navigating to the ‘Pipelines’ tab in Bitbucket, selecting the pipeline, and clicking ‘Run pipeline.’

Ishwarya M
Technical Content Writer, Hevo Data

Ishwarya is a skilled technical writer with over 5 years of experience. She has extensive experience working with B2B SaaS companies in the data industry, she channels her passion for data science into producing informative content that helps individuals understand the complexities of data integration and analysis.