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, and size 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 120

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 memory to a step, or to the whole pipeline. By specifying the size of 2x, you'll have double the memory available. 1x (default) steps are allocated 4 GB of memory, and 2x steps are allocated 8 GB memory. Note that the memory allocated is shared by both the script in the step and any services on the step.

This option is available for steps run on the Bitbucket Cloud infrastructure and a Linux Docker self-hosted runner. Shell-based runners, such as the Windows PowerShell, macOS shell, and Linux shell runners use all available memory on the host machine.

2x steps use twice the number of build minutes of a 1x step.

Propertysize

Required — No

Data type — String

Allowed values — Either:

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!"

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

 

 

Additional Help