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

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

Passing password environment variable to docker container

We use docker container to run the build and publish the artifacts on remote agent. One of the problems we are facing is while passing the password environment variables to the container. We are using shell/batch commands to fetch all the environment variables(grep with bamboo) and pass it to the container while starting the docker run.  This works fine for all the variables except for passwords. For password variables when we read the environment variable all we get is ***** and that is what gets passed to the container.  

Is there any solution to pass the password variable to container correctly?

 

Thanks,

EndeJoli

1 answer

0 votes
Jeremy Owen Atlassian Team Jul 12, 2018

Hey EndeJoli,

I haven't had any luck reproducing this yet. The password masking (*****) should only be applied at a logging level for Bamboo. What actually gets passed to the underlying command should be the actual value.

For example, say I set a Bamboo plan variable of password = password123 and run the below Script task (I've used grep to be closer to your example, but you can also directly reference it with ${bamboo.password}):

password="$(env | grep "bamboo_password" | awk -F'=' '{print $2}')"
docker run -itd -e PASSWORD=${password} ubuntu:xenial

At any point, if password123 is output to the console -- it will show up in the build logs as ****** but the Docker container actually received the value password123.

I verified this on the host (outside of Bamboo) by attaching a shell to the container:

host$ docker exec -i -t container /bin/bash
container$ env
> PASSWORD=password123

Since Bamboo will mask any attempts to print that to the build log; have you tried verifying the value of the environment variable outside of a Bamboo build? 

Suggest an answer

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

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

638 views 1 6
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