Child pipeline step options

A child pipeline lets you define a step within a pipeline that triggers another pipeline, which can help to streamline more complex workflows into modular pieces and achieve greater parallelism within your pipeline. The following options are used to define a ‘pipeline within a pipeline step’. A child pipeline (or a pipeline within a pipeline) step uses type: pipeline.

The custom property

The custom option is used to define the custom pipeline that is executed when a child pipeline step is executed.

Propertystep

Required — Yes (when type: pipeline)

Data type — String (This should match the name of the custom pipeline.)

Allowed parent propertiesstep

Allowed child properties — none


The input variables property

The input-variables property is used to define variables that can be passed from the parent pipeline into the child pipeline. Once passed, these variables are considered pipeline variables for the child pipeline.

There is a limit of 20 input-variables for a pipeline step.

Propertyinput-variables

Required — No

Data type — Key-value pair (YAML spec - Block Mappings)

Allowed values — Valid variable names

  • Names can only contain ASCII letters, digits, and underscores

  • Names can't start with a digit

Allowed parent properties — step

Example: Using the input-variables option to define variables, which can be exposed to the child pipeline.

pipelines: custom: a-parent-pipeline: - variables: - name: parent_pipeline_variable default: "val1" allowed-values: - "val1" - "val2" - step: name: 'Child pipeline' type: pipeline custom: a-child-pipeline input-variables: var_1: $parent_pipeline_variable var_2: $repository_variable_name var_3: $workspace_variable_name var_4: "static-value-1" var_5: "static-value-2" a-child-pipeline: - step: name: 'Child Pipeline step' script: - echo "Parent Pipeline Step Variable -" $var_1 - echo "Parent Pipeline Step Variable -" $var_2

The artifacts property

The artifacts property is used to share uploaded artifacts from a parent pipeline into child pipelines, or from a child pipeline out to its parent. Artifacts shared into a child pipeline are available for download in all steps of the child pipeline, while artifacts shared out to the parent are available in all steps after the child pipeline step.

For details on using artifacts, see using artifacts in steps.

Example: Using the artifacts option to share a file in and out of a child pipeline:

pipelines: custom: parent-pipeline: - step: name: 'Message in a Bottle' script: - echo "Important Message!" > bottle.log artifacts: upload: - name: Bottle paths: - bottle.log - step: name: 'Child Pipeline Calling Step' type: pipeline custom: child-pipeline artifacts: upload: - Bottle download: - Bottle - step: name: 'Final Update' script: - echo "P.P.S. I'm serious, it's urgent!" >> bottle.log artifacts: upload: - name: Bottle paths: - bottle.log - step: name: 'Read Final Message' script: - cat bottle.log child-pipeline: - step: name: 'Step in Child Pipeline' script: - echo "P.S. It's time-sensitive as well." >> bottle.log artifacts: upload: - name: Bottle paths: - bottle.log

Propertyartifacts

Required — No

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

Allowed parent propertiesstep

Allowed child propertiesupload and download

Upload Artifacts

The artifact upload property is used to list the paths or names of artifacts to share from the parent pipeline into the child pipeline.

There is a limit of 20 upload artifacts in a child-pipeline step.

Propertyupload

Required — No

Data type — A list of strings (YAML spec - Sequence)

Allowed parent propertiesartifacts

Download Artifacts

The artifact download property is used to list the paths or names of artifacts to share from the child pipeline out to the parent pipeline.

There is a limit of 20 download artifacts in a child-pipeline step.

Propertydownload

Required — No

Data type — A list of strings (YAML spec - Sequence)

Allowed parent propertiesartifacts


The script property

The script property should not be included for child pipeline steps, as it will not be executed. The steps in the child pipeline that is referenced by the custom property will be executed instead.


Restricted properties

Child pipeline steps are just a trigger to execute a separate pipeline within a pipeline. For instance, defining the image on a child pipeline step is invalid, as it is not run directly in a step environment but triggers the execution of a seperate pipeline.

The following properties are not supported by pipeline steps and should not be included when using type: pipeline. The properties listed below should be used inside the child pipeline itself instead, with the exclusion of deployment, which is not supported in child pipelines,

  • deployment - not supported in pipeline or child pipeline steps

  • stage

  • size

  • runtime

  • output-variables

  • caches

  • runs-on

  • image

  • clone

  • oidc

  • services

Still need help?

The Atlassian Community is here for you.