Global options
The options section of the bitbucket-pipelines.yml can set several global options for all of the repository’s pipelines, such as the maximum run time for steps and the resources allocated to a Pipelines Docker container. Other options can be set globally but have dedicated sections in the bitbucket-pipelines.yml, such as Git clone options, Docker image options, and Cache and Service container options.
Global options for pipelines
The following global options are configured with the options property:
Options
Contains global settings that apply to all your pipelines.
Property — options
Required — No
Data type — Block of new-line separated key-value pairs (YAML spec - Block Mapping)
Allowed parent properties — The YAML root (options can only be a top-level property)
Allowed child properties — Requires one or more of the max-time, docker, size, and runtime properties.
Example — using the options option to set global options for the pipeline
1
2
3
4
5
6
7
8
9
10
11
options:
max-time: 30
docker: true
size: 2x
pipelines:
default:
- step:
name: Hello world example
script:
- echo "Hello, World!"
Docker
The global docker option adds a Docker service to all steps in the pipeline. This Docker service can be used to run Docker commands within any pipeline step. For information on using Docker in a Bitbucket Pipeline see Run Docker commands in Bitbucket Pipelines.
Property — docker
Required — No
Data type — Boolean
Allowed values — true or false
Default value — false
Allowed parent properties — options
Example — using docker to enable Docker commands on all pipeline steps
1
2
3
4
5
6
7
8
9
10
options:
docker: true
pipelines:
default:
- step:
name: Hello world example
script:
- docker version
- docker run hello-world
Example — using services to enable Docker commands on a single step
1
2
3
4
5
6
7
8
pipelines:
default:
- step:
script:
- docker version
- docker run hello-world
services:
- docker
Max time
The max-time option sets the maximum length of time a step can run before timing out (in minutes). The max-time option can be set using both the global options property and on individual pipeline steps. The default maximum time for pipeline steps is 120 minutes.
Property — max-time
Required — No
Data type — Integer
Allowed values — A positive integer between 1 and 720
Default value — 120
Allowed parent properties — options and step
Example — using the max-time option to set the maximum time allowed for each step in a pipeline
1
2
3
4
5
6
7
8
9
options:
max-time: 30
pipelines:
default:
- step:
name: Sleeping step
script:
- sleep 120m # This step will timeout after 30 minutes
Example — using the max-time option to set the maximum time allowed for an individual step
1
2
3
4
5
6
7
8
9
10
11
12
13
options:
max-time: 60
pipelines:
default:
- step:
name: Sleeping step
script:
- sleep 120m # This step will timeout after 60 minutes
- step:
name: quick step
max-time: 5
script:
- sleep 120m # This step will timeout after 5 minutes
Size
The size option allocates additional resources to a step or a whole pipeline, when running on Bitbucket Cloud infrastructure or Linux Docker self-hosted runners.
This option has no effect on shell-based runners, such as Windows PowerShell, macOS shell, and Linux shell runners, which use all available resources on on the host machine.
By default, a step running on Bitbucket Cloud infrastructure or a Linux Docker self-hosted runner has access to 4GB of memory, 4 CPUs (which might be shared with other tasks), and 64 GB of disk space per step for mounting volumes.
By specifying a size of 2x, your step or pipeline will have double the memory available. Note that the memory allocated is shared by both the script in the step and any services on the step.
Choosing a size option above 4x also grants additional CPU resources and disk space. A step assigned a size of 4x or greater is guaranteed dedicated access to the relevant number of CPUs and more disk space for mounting volumes.
4x steps use four times the number of build minutes of 1x steps, 2x steps use twice the number of build minutes of 1x steps, and so on.
Resource allocation based on size
Size | CPU | Memory | Volume size |
---|---|---|---|
1x | 4 (shared) | 4 | 64GB |
2x | 4 (shared) | 8 | 64GB |
4x | 8 (dedicated) | 16 | 256GB |
8x | 16 (dedicated) | 32 | 256GB |
16x | 32 (dedicated) | 64 | 256GB |
Property — size
Required — No
Data type — String
Allowed values — Either:
1x, 2x, 4x, 8x or 16x for pipeline steps run on Bitbucket Cloud.
1x, 2x, 4x, 8x or 16x for pipeline steps run on a self-hosted pipeline runner.
4x, 8x and 16x pipelines size options are only available for builds running on a paid Bitbucket Cloud plan (Standard or Premium).
Default value — 1x
Allowed parent properties — options and step
Example — using the size option to increase the memory available to all pipeline steps
1
2
3
4
5
6
7
8
options:
size: 2x
pipelines:
default:
- step:
script:
- echo "2x memory is probably not needed for an echo command"
Example — using the size option to increase the memory available to a pipeline step
1
2
3
4
5
6
pipelines:
default:
- step:
size: 2x
script:
- echo "This step gets double the memory!"
Runtime
The runtime configuration to be applied to the step.
Property — runtime
Required — No
Data type — Block of new-line separated key-value pairs (YAML spec - Block Mapping)
Allowed parent properties — options and step
Allowed child properties — cloud (required)
Example - using the runtime to enable atlassian-ip-ranges for all 4x, 8x, 16x steps, and arm for all steps
1
2
3
4
5
6
7
8
9
10
11
options:
runtime:
cloud:
atlassian-ip-ranges: true
arch: arm
pipelines:
default:
- step:
size: 4x
script:
- echo "I use atlassian-ip-ranges"
Example - using the runtime to enable atlassian-ip-ranges and arm for a particular step
1
2
3
4
5
6
7
8
9
10
pipelines:
default:
- step:
size: 4x
runtime:
cloud:
atlassian-ip-ranges: true
arch: arm
script:
- echo "I use atlassian-ip-ranges"
Cloud runtime configuration
The runtime configuration to be applied to cloud steps.
Property — cloud
Required — No
Data type — Block of new-line separated key-value pairs (YAML spec - Block Mapping)
Allowed parent properties — runtime
Allowed child properties — atlassian-ip-ranges (optional), arch(optional)
Atlassian IP ranges for cloud runtime configuration
This option indicates whether to use the default aws-ip-ranges or the atlassian-ip-ranges when executing your step for ingress/egress traffic.
Property — atlassian-ip-ranges
Required — No
Data type — Boolean
Allowed values — true or false
Default value — false
Allowed parent properties — cloud
Architecture for cloud runtime configuration
This option controls what architecture to use when executing your step
Property — arch
Required — No
Data type — String
Allowed values — arm or x86
Default value — x86
Allowed parent properties — cloud
arm options are only available for builds running on a Standard or Premium Bitbucket Cloud plan.
Export - Bitbucket Premium only
Specify if you want to share pipeline definitions to other repositories within the same workspace.
Property — export
Required — No
Data type — Boolean
Allowed values — true or false
Default value — false
Allowed parent properties — The YAML root (export can only be a top-level property)
Example — using the export option to export pipelines under definitions section
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export: true
definitions:
caches:
services:
pipelines:
export-pipeline:
- step:
script:
- echo hello
pipelines
default:
- step:
script:
- echo hello
Was this helpful?