The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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

DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events