Is it possible to use variables in the artifacts section of a step in the pipelines.yml file?

Steve Maxwell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 16, 2020

We have a custom pipeline with a "Project" variable defined.   Using the variable works fine in the script section, but doesn't appear to work in the artifacts section.

- step: build-test-apprevision
name: Build, Test, Create App Revision
script:
- bash ./gradlew :$Project:createAppRevision
artifacts:
- $Project/build/artifacts/$Project-apprevision

 

Am i doing something wrong or is this not possible?

5 answers

0 votes
Andrew Hill
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 11, 2024

bitbucket suggests, in a completely non-patronising way, the use of premium dynamic pipelines to solve this

BCLOUD-21666 

"We're extremely excited to announce the GA release of a really powerful feature in Bitbucket Pipelines called Dynamic Pipelines. ......

One of the MANY things Dynamic Pipelines solves is the ability to inject variables into things like artefacts etc."

 

0 votes
Ruggero Schirinzi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 8, 2023

following @Felipe Jaekel  issue, the only way I found to handle this behavior is to specify into the artifacts section something like "*.json" and then to recalculate the filename in each following steps. It is tricky and clunky but it could works.

0 votes
david_treblig
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 16, 2022

I just found this and we have the same issue. The env variables seem to be parsed in many other sections of the bitbucket-pipeline such as condition.changesets.includePaths, but not in artifacts...

Fotis Papadamis
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 17, 2023

Tried to work with repository variables in condition.changesets.includePaths and it does not seem to work. Same thing with artifacts, of course.

It's really sad...

0 votes
Felipe Jaekel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 7, 2022
0 votes
Marvin Kraner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 14, 2020

I encountered the same problem. I need to add a time-stamp to the artifacts name and it seems that variable references are not working in the "artifacts"-section. It would be good to know wether we are doing something wrong or if this feature will be added in near future. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events