Is it possible, using YAML anchors, to define variables that you pass to the script

Etienne Noel October 2, 2020

I want to us YAML anchors but in the script of my anchor, I need to pass a variable of the version that I push to NPM. Is there a way to pass or define a variable that will be used in the YAML anchor?

Here's what I'm trying to achieve

definitions:
steps:
- step: &build
name: build
script:
- npm version $VERSION_NUMBER

pipelines:
branches:
master:
- step: *build
VERSION_NUMBER = 1.0.0 # I don't know how to do this
default:
- step: *build
VERSION_NUMBER = $BITBUCKET_BUILD_NUMBER-$BITBUCKET_BRANCH # I don't know how to do this

 

 

1 answer

0 votes
Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 16, 2020

@Etienne Noel variables are not shared through artifacts, but you can put this string to text file and user VERSION_NUMBER: $(cat  version.txt)

Regards, Galyna

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events