The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Is it possible to use account variable values in the image name value for a bitbucket-pipelines.yml?

RH Becker
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 23, 2019

I'm using a private image hosted via AWS ECR.

As can be seen at that link, the syntax for doing so involves setting an `image.name` value in bitbucket-pipelines.yml ...

image:
  name: <aws_account_id>.dkr.ecr.<region>.amazonaws.com/openjdk:8
  aws: 
    access-key: $AWS_ACCESS_KEY
    secret-key: $AWS_SECRET_KEY

I would like to know whether it is possible to use an account variable value to define parts of the `image.name` URI. For example, it would be nice to be able to set $AWS_ACCOUNT_ID, such that someone forking my repo could set their own value, and use my config as-is.

I've tried doing so, but as soon as I push the commit, I get feedback indicating that my config is invalid.

I've tried both of the following using no quotes, single quotes, and double quotes:

${AWS_ACCOUNT_ID}.dkr.ecr.<region>.amazonaws.com/example:latest
$AWS_ACCOUNT_ID.dkr.ecr.<region>.amazonaws.com/example:latest

All of these variants show as valid using your online validation tool.

If this is not currently possible, would you consider making it so?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Peter Plewa
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 5, 2020

Hi @RH Becker 

Unfortunately it is not possible at the moment. There is a support request that you can vote on and follow https://jira.atlassian.com/browse/BCLOUD-13014 to get updates on this issue.

Thanks,
Peter

Elgiz Abbasov
November 9, 2021

Hey Peter, any news on this? People have been voting since 2016 still no updates whatsoever

1 vote
Caterina Curti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 30, 2024

Hi all,

You can find here an article and a video showing how you can use a variable as the image name.

This solution is based on Dynamic Pipelines and requires a Forge app.

The article shows how to replace an "IMAGE_TAG" value (image: node:$IMAGE_TAG) but can be used for any other variables in the image tag or even the entire name.

 

Hope this helps,
Caterina

TAGS
AUG Leaders

Atlassian Community Events