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

deployment variables not working

Hello,

 

i'm trying to use deployment variables as follows:

 image: node:8.12.0 

definitions:
steps:
- step: &build-stg-angular
caches:
- node
script: # Modify the commands below to build your repository.
- credentials="${server_username}@${server_ip}"
- npm install
- npm run build-stg -- -c ${client}



pipelines:
custom:
asim-stg:
- step: *build-stg-angular
- step:
name: Deploy to staging server.
deployment: asim-stg
script:
- echo "Deploying"

 

but it doesn't recognise the variables!

 

5 answers

1 accepted

3 votes
Answer accepted

I managed to get this working!
Just to be clear in the sample above the deployment variables refer to 

${server_username}@${server_ip}

If that is the case, which I suspect it is I have the answer. 

Here is a simple example..

Here I'm trying to reference MY_DEPLOYMENT_VARIABLE_1 and MY_DEPLOYMENT_VARIABLE_2 however only MY_DEPLOYMENT_VARIABLE_2 will be recognized from the deployment variables.
The reason for this is simple.


Deployment variables are only recognized in the deployment block i.e. the block where we specify "deployment:Development". WHAT!

Further to this remember "deployment:Development" can only be used once.

Took me days to realize this :-(

Remember to ^^ Up Vote if this helps ;-)


yml.JPG 

Thank you so much for this answer. After looking through 1001 tutorials and ALL of bitbucket pipelines sh*t documentation. This solved it.

I think this would be the right answer. I'll give you feedback in 5 mins.

You are totally right. The deployment variables are only used in deployment block.

But any ideas about how to set build variables not explicitly configured in yaml file and not every time to type in the run pipeline input?

I don't know why, but it reads Repository variables successfully!

but it doesn't recognize environments variables!!

image.png

I'm having the same issue.

It doesn't work for me either. Can someone check on this please?

Should the variable be just $server_ip instead of bamboo like ${server_ip} ?

Has anyone solved this??
We are facing the same issue and it's causing a fair bit of extra work.

Thanks

Suggest an answer

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

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,041 views 0 3
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