CSC
CSC

Reputation: 1245

How to set environment variables used by docker container using Bamboo

I am using Bamboo for building and deploying my docker container. My code uses environment variables. I am using a shell script to set values of those variables with those values being hardcoded in .sh file. Ideally, I would like the values for those environment variables to be passed through bamboo variables. One option is to generate a shell script during bamboo build plan and call that shell script from startup file. Is there any better option to set system environment variables using bamboo variables?

Upvotes: 2

Views: 4581

Answers (2)

renno
renno

Reputation: 2827

When adding the Docker task in the Plan configuration, you have the option to pass environment variables.

For example, if your Dockerfile has ENV variable test_db_pass you should pass in the Docker task field "Container environment variables" the following: test_db_pass=${bamboo.test_db_pass}

Upvotes: 1

Hakro
Hakro

Reputation: 2774

It is possible to define either plan or global variables in Bamboo. You can then use them in you build.

It's in the documentation : https://confluence.atlassian.com/bamboo/defining-plan-variables-289276859.html

Upvotes: 0

Related Questions