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.

Propertyoptions

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.

Propertydocker

Required — No

Data type — Boolean

Allowed valuestrue or false

Default valuefalse

Allowed parent propertiesoptions

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.

Propertymax-time

Required — No

Data type — Integer

Allowed values — A positive integer between 1 and 720

Default value120

Allowed parent propertiesoptions 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 options above 4x also grants additional CPU resources and disk space. A stepassigned 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

Propertysize

Required — No

Data type — String

Allowed values — Either:

4x and 8x pipelines size options are only available for builds running under a paid Bitbucket Cloud plan (Standard or Premium).

Default value1x

Allowed parent propertiesoptions 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.

Propertyruntime

Required — No

Data type — Block of new-line separated key-value pairs (YAML spec - Block Mapping)

Allowed parent propertiesoptions and step

Allowed child propertiescloud (required)

Example - using the runtime to enable atlassian-ip-ranges for all 4x, 8x steps

1 2 3 4 5 6 7 8 9 10 options: runtime: cloud: atlassian-ip-ranges: true pipelines: default: - step: size: 4x script: - echo "I use atlassian-ip-ranges"

Example - using the runtime to enable atlassian-ip-ranges for a particular step

1 2 3 4 5 6 7 8 9 pipelines: default: - step: size: 4x runtime: cloud: atlassian-ip-ranges: true script: - echo "I use atlassian-ip-ranges"

 

Cloud runtime configuration

The runtime configuration to be applied to cloud steps.

Propertycloud

Required — No

Data type — Block of new-line separated key-value pairs (YAML spec - Block Mapping)

Allowed parent propertiesruntime

Allowed child propertiesatlassian-ip-ranges (required)

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.

Propertyatlassian-ip-ranges

Required — Yes

Data type — Boolean

Allowed valuestrue or false

Default valuefalse

Allowed parent propertiescloud

Export - Bitbucket Premium only

Specify if you want to share pipeline definitions to other repositories within the same workspace.

Propertyexport

Required — No

Data type — Boolean

Allowed valuestrue or false

Default valuefalse

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

 

 

Still need help?

The Atlassian Community is here for you.