Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Shared Pipelines Variables not exported when using YAML anchors

vlupia April 15, 2025

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?

 

 

1 answer

1 accepted

0 votes
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 27, 2025

Hi @vlupia

Welcome to the community.

I'd just like to inform you that I'm currently verifying this interanally.

I'll update you once I get more information.

Regards,
Mark C

vlupia May 13, 2025

Hi @Mark C , thanks!

Did you happen to get an update on this?

Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2025

Hi @vlupia

Apologies for the late response here.

What I found out is that the feature should work with YAML anchors.

I've also tested the same YAML configurations on my end but I was able to get the correct variable of "my-value".

I'm currently running on Linux Docker version "3.23.0".

Could you confirm if you're using the updated runners version?

If not, could you try updating it by running the command below?

docker pull docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner

Let me know how it goes.

Regards,
Mark C

vlupia May 23, 2025

Hi @Mark C  I can confirm that with the latest runner version it works.

 

Thanks for your support.

 

Regards

Vincenzo

Like Mark C likes this
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2025

Great, glad to know it works now.

Feel free to accept the answer when you can.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events