Forums

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

How to use bit bitbucket's variables in Angular environment in CI/CD?

jitendradp
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!
August 11, 2019

I am using angular 8 and want to use CI/CD. till now I am storing secret key in environment file. for development I have created environment.dev.ts and for production it will environment.prod.ts.

While I am using CI/CD so I am thinking that instead storing it in environment file store it in bitbucket variables. and while deploying the variable can be changed. 

 

I know if created variable SECRETKEY in bitbucket pipeline then I can use it like $SECRETKEY  in package.json.  can I use this in same way in any where in angular. like in environment.dev.ts or environment.prod.ts

2 answers

2 votes
Vimalkumar Bohara
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 12, 2020

let say if you want to read the BITBUCKET_BUILD_NUMBER from bit bucket in your angular application, it can be achieved in two simple steps.

1. Add the following line of code in your environment.prod.ts file

 appVersion: '$BITBUCKET_BUILD_NUMBER',

2. In your .yml file add the following line under the scripts

 - sed -i -e 's%$BITBUCKET_BUILD_NUMBER%'"$BITBUCKET_BUILD_NUMBER"'%g' ./src/environments/environment.dev.ts 
jjrobert
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!
October 8, 2024

Thanks for this, it was the piece I needed today.

-Jeff

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 12, 2019

Hi there!

Seems like your questions is geared towards Angular's usage and not towards any of our Atlassian products. I'm afraid in that case we won't be able to help you, as this Community is centered around Atlassian and the members here might not be familiar with Angular. I encourage you to post your question in a different forum dedicated to that technology.

If I misunderstood your question and you were indeed referring to one of our products, please let us know so we can continue helping you.

Cheers,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events