Bitbucket Pipelines Generator

Generate production-ready `bitbucket-pipelines.yml` with branch pipelines, PR triggers, and docker services.

Bitbucket Pipeline

Clone Options

Pipeline Options

Default Pipeline (Runs on all unmapped branches)

Branch Pipelines

Steps

bitbucket-pipelines.yml
1

Understanding Bitbucket Pipelines configuration

What is bitbucket-pipelines.yml?

Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket. It allows you to automatically build, test, and deploy your code based on a configuration file in your repository named bitbucket-pipelines.yml.

Pipeline Types

Bitbucket Pipelines uses a rigid structure to define when specific steps run. You can configure multiple types of pipelines:

  • Default Pipeline (default): Runs on every push to the repository, unless a branch-specific pipeline is defined.
  • Branch Pipelines (branches): Specific pipelines that only run when changes are pushed to a matching branch (e.g., main, feature/*).
  • Pull Request Pipelines (pull-requests): Run only when a Pull Request is created or updated.
  • Custom Pipelines (custom): Can only be triggered manually through the Bitbucket UI or via the API. Useful for production deployments.
  • Key Concepts

    #

    Images

    Pipelines run inside Docker containers. You can define a global image at the top level of the file, or you can override it on a per-step basis.

  • Example: node:18 or python:3.10-alpine
  • #

    Steps

    A pipeline is composed of a list of steps. Each step runs in a separate Docker container, meaning they do not share state unless you explicitly configure artifacts and caches.

  • Caches: Used to speed up builds by caching directories like node_modules between runs.
  • Artifacts: Used to pass generated files (like compiled CSS/JS) from one step to the next.
  • #

    Services

    If your tests require a database or a cache (like PostgreSQL or Redis), you can define them as services. Bitbucket will spin them up alongside your build container.

  • Note: If you need to build Docker images inside your pipeline, you must enable the docker service.