Hi,
I’m testing the new Output Variables feature, which should allow variables to be shared across subsequent steps.
The documentation example works fine:
pipelines:
default:
- step:
script:
- echo "VARIABLE_NAME=my-value" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
output-variables:
- VARIABLE_NAME
- step:
script:
- echo $VARIABLE_NAME
I can see the variable being exported and available in the step’s Build Setup logs:
VARIABLE_NAME: my-value<span>Pipeline variables:<br> </span>
However, when I define output variables from steps that are referenced through YAML anchors, no variables are exported.
Example pipeline:
definitions:
steps:
- step: &default
name: Common Steps Configuration
size: 2x
runs-on:
- 'self.hosted'
- 'linux'
- step: &init
<<: *default
name: Initialize
script:
- echo "VARIABLE_NAME=my-value" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
output-variables:
- VARIABLE_NAME
- step: &build
<<: *default
name: Build
script:
- echo $VARIABLE_NAME
pipelines:
default:
- step: *init
- step: *build
In this case, the second step does not print anything and the pipeline variable is not listed in the step's Build Setup logs.
Am I missing anything here?