Global options
Global pipeline options for Bitbucket Pipelines
The bitbucket-pipelines.yml file configures automated builds, tests, and deployments. Configuration options organize into these top-level sections:
options: Global pipeline settings
clone: Git repository behavior
definitions: Cache and service containers
image: Docker image configuration
pipelines: Pipeline execution flow
parallel: Concurrent step execution
stage: Logical groupings of steps
step: Individual pipeline tasks
options)Contains settings applying to all pipelines in a repository.
Enable Docker command execution across all steps:
options:
docker: true
pipelines:
default:
- step:
script:
- docker version
- docker run hello-worldProperty: docker Data type: Boolean Default: false
Set maximum step runtime (in minutes):
options:
max-time: 30
pipelines:
default:
- step:
name: Sleeping step
script:
- sleep 120m # Timeout after 30 minutesProperty: max-time Data type: Integer Allowed values: 1–720 Default: 120 minutes
Allocate additional resources to steps or pipelines on Bitbucket Cloud or Linux Docker self-hosted runners:
Size | CPU | Memory | Volume |
|---|---|---|---|
1x | 2 | 4GB | 64GB |
2x | 4 | 8GB | 64GB |
4x | 8 | 16GB | 256GB |
8x | 16 | 32GB | 256GB |
16x | 32 | 64GB | 256GB |
24x | 48 | 96GB | 256GB |
32x | 64 | 128GB | 256GB |
options:
size: 2x
pipelines:
default:
- step:
script:
- echo "Double memory allocated"Property: size Default: 1x Note: Larger sizes consume proportionally more build minutes and require Standard/Premium plans.
Configure runtime behavior (architecture, IP ranges):
options:
runtime:
cloud:
atlassian-ip-ranges: true
arch: armProperty: runtime Required child: cloud
Controls how the Git repository is cloned at the start of each step.
Set a shallow clone depth to speed up cloning. The default depth is 50.
clone:
depth: 2Set to full for a complete history (useful for version calculations or changelogs):
clone:
depth: fullEnable or disable Git Large File Storage support:
clone:
lfs: trueDisable cloning entirely when the step does not need the repository source (for example, a pure deployment step):
clone:
enabled: falseProperty | Description | Default |
|---|---|---|
| Shallow clone depth. Use an integer or |
|
| Enable Git LFS |
|
| Whether to clone at all |
|
image: node:18
pipelines:
default:
- step:
name: Build and Test
script:
- npm install
- npm testpipelines:
branches:
main:
- step:
name: Deploy to Production
deployment: production
script:
- ./deploy.sh
develop:
- step:
name: Deploy to Staging
deployment: staging
script:
- ./deploy.sh stagingpipelines:
pull-requests:
'**':
- step:
name: Test PR
script:
- npm testpipelines:
tags:
'v*':
- step:
name: Release
script:
- ./release.shpipelines:
custom:
deploy-to-staging:
- step:
name: Manual Deploy
deployment: staging
script:
- ./deploy.shRun multiple steps simultaneously:
pipelines:
default:
- parallel:
- step:
name: Unit Tests
script:
- npm run test:unit
- step:
name: Integration Tests
script:
- npm run test:integration
- step:
name: Lint
script:
- npm run lintGroup steps for organized execution:
pipelines:
default:
- stage:
name: Build
steps:
- step:
name: Compile
script:
- npm run build
- stage:
name: Test
steps:
- step:
name: Run Tests
script:
- npm test
- stage:
name: Deploy
deployment: production
steps:
- step:
name: Deploy
script:
- ./deploy.sh- step:
name: Build Application
image: node:18
caches:
- node
services:
- redis
artifacts:
- dist/**
script:
- npm install
- npm run build- step:
name: Deploy
condition:
changesets:
includePaths:
- "src/**"
script:
- ./deploy.shDefine reusable resources:
definitions:
caches:
npm: ~/.npm
cypress: ~/.cache/Cypress
services:
redis:
image: redis:7
postgres:
image: postgres:15
variables:
POSTGRES_DB: testdb
POSTGRES_USER: testuser
POSTGRES_PASSWORD: $DB_PASSWORDimage: node:18
definitions:
caches:
npm: ~/.npm
services:
postgres:
image: postgres:15
variables:
POSTGRES_DB: myapp
POSTGRES_PASSWORD: $DB_PASSWORD
options:
max-time: 60
size: 2x
pipelines:
default:
- step:
name: Build and Test
caches:
- node
- npm
services:
- postgres
script:
- npm install
- npm run build
- npm test
artifacts:
- dist/**
branches:
main:
- step:
name: Build
caches:
- node
script:
- npm install
- npm run build
artifacts:
- dist/**
- step:
name: Deploy to Production
deployment: production
script:
- ./deploy.sh production
pull-requests:
'**':
- step:
name: PR Tests
caches:
- node
script:
- npm install
- npm test
- npm run lintPipeline: Top-level trigger definitions (default, branches, tags)
Step: Individual executable tasks with scripts and configuration
Parallel: Execute multiple steps simultaneously
Stage: Group steps for organized execution flow
Definitions: Reusable service and cache configurations
Configure Docker Images for your build environment
Set up Variables and Secrets
Add Caching to improve performance
Use Service Containers for testing
Global options
Global pipeline options for Bitbucket Pipelines
Git clone behavior
Options for controlling the Git clone behavior of Bitbucket Pipelines
Cache, service container, step config, and export pipelines definitions
Create dependency caches and service containers, such as database services
Docker image options
Use custom Docker images in your Bitbucket Pipeline
Pipeline start conditions
Set the start conditions or triggers for running your Bitbucket Pipelines
Parallel step options
Run multiple pipeline steps at the same time
Child pipeline step options
Define a step within a pipeline that triggers another pipeline by using a child pipeline.
Custom configuration files
Custom config files let you specify an alternate YAML file for a pipeline run, enabling multiple pipeline definitions in a single repository.
Enable and use Runtime v3
Enable and use Runtime v3 with your Docker services.
Stage options
Group steps into stages or create multi-step deployment stages
Step options
Define and customize your pipeline steps
Was this helpful?