D
D
Danil Gorev2021-11-11 16:05:23
Command line
Danil Gorev, 2021-11-11 16:05:23

How to export environment variables from Bitbucket Pipelines?

In Bitbucket, it is possible to add environment variables for pipelines, and inside the pipeline, these environment variables are available. From the pipeline, I run my docker containers, which use the .env file. At the moment, I am generating an env file using the command echo VARIABLE=$VARIABLE >> .env, but this approach greatly bloats the file with pipelines.
Is there any universal (correct) solution for dumping variables into an .env file, or for using them quickly in conjunction with docker-compose?

Thank you all in advance for your replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Karasik, 2021-11-12
@vitaly_il1

I form an env file using the echo VARIABLE=$VARIABLE >> .env command, but this approach greatly bloats the file with pipelines.

Perhaps there is something more elegant, but you can reduce your method to one line
env > .env

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question