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:
Pipeline variables:
VARIABLE_NAME: my-value
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?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.