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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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

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

0 votes
Ana Retamal Atlassian Team Aug 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

0 votes

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 

Suggest an answer

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

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,589 views 1 9
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