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

Passing value to YML file from .env file

kunjan giri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 27, 2024

I am trying to pass the variable value using cli from .env file to yml file, I tried using scripts but its not working. Its working fine when value are passed through GUI. Does anyone know if we can even pass value in bitbucket pipeline.yml file from seperate file? 

1 answer

1 vote
Swetha Boyapati
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 28, 2024

Hi @Kunjan Giri ,

Welcome to the community. 

In order to be able to pass environment variables via .env file, you'll follow the syntax as shown in the below example.



image: atlassian/default-image:4

pipelines:
default:
- step:
name: Build and test

script:
- source .env
- echo $var
{code}

### In the .env file


var=<variable value here>

Let me know how it goes.

Cheers,
Swetha Boyapati

kunjan giri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 2, 2024

I might have missed something earlier when I tried this. It's working now. thank you

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events