Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possile to use environment variables as image name for bitbucket pipelines?

Hello,

I was trying to set docker image name in `bitbucket-pipelines.yml` as a value of environment variable. Unfortunately, both ways I've tried failed:

step:
image: $IMAGE_NAME

 and 

step:
image:
name: $IMAGE_NAME

If I replace $IMAGE_NAME with actual value - everything works fine. 

Could you please tell me if there is a way to perform it?

Thank you,

5 answers

1 accepted

6 votes
Answer accepted

I have the same problem, seems like image name accepts only hardcoded values.

would be awesome. I just stumpled upon this issue. removed all hardcoded values from my pipeline definition and added them to team-variables so they can be changed easily without having to change bitbucket-pipeline.yml in all repositories. for everything else it works so far, just image cant be substituted.

Like Igor Bodnar likes this

I have the same issue.

It throws this error when using environment variables: There is a problem with the format of your docker image name at [image > name].

But if you goto the online validator it says it's syntactically valid with the environment variable.

My use case is that I'd like to define my AWS account id and region as environment variables so that the pipeline script is more portable between my local test BB account and the "real" repo.

The problem with the validator is that it only checks the YAML syntax. Seeing as an image name should be a string, and either `my-image:latest` or `$MY_IMAGE` is considered a string, the validator checks out. However as you already understand it doesn't interpolate variables on that specific location.

11 votes
Alex Tran Atlassian Team Jul 16, 2019

Would love to have this feature supported !

0 votes
Danyal Iqbal Community Leader Jun 01, 2018

Where did you set the variable?

I set it in team variables also tried local project variables.

I can confirm that this isn't supported. I've tried several ways of defining the variable but all failed. Repository specific or team wide account variables aren't supported in the image name.

I'd love to see support for this!

Like # people like this

"I'd love to see support for this!" yes, please :)

Like Igor Bodnar likes this

I would also like to see this feature. How else can you use an image that has been built with a tag based on the BITBUCKET_BUILD_NUMBER?

Like # people like this

This would be a great feature. Would love to get this support.

Like Igor Bodnar likes this

That would be very handy

Like Igor Bodnar likes this

+1. Without this feature, this is not possible to declare the google container registry path dynamically for example

Like Richie likes this

it would be very useful

I have the same issue with image name, but also with max-time. For the latter, it says that value should be integer and got string. 

Hoping to get this feature.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

473 views 5 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you