Here are things I want to do with Bitbucket pipelines:
This is my scenario, now my question is that how can we set the env variable dynamically on each step without creating a new build?
Or is there any way to set the env variable in the Bitbucket site and access in code dynamically so I can manage through that.
Else create a new build for each environment is the last option for me.
I would suggest using deployment environment variables, which are intended for just this.
Deployment variables override both team and repository variables. Also variables with the same name can have different values for each deployment environment. For example, you could set a different $DEPLOYMENT_SECRET_KEY for each environment.
https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-monitor-deployments/
- step:
image: cibuilds/hugo
name: Build Site
script:
- echo $SOME_TOKEN # repo value for testing, etc
- step:
image: cibuilds/hugo
name: Staging Deployment
deployment: Staging
script:
- echo $SOME_TOKEN # statging specific value
- step:
image: cibuilds/hugo
name: Switch to Live Deployment
deployment: Production
trigger: manual
script:
- echo $SOME_TOKEN # different value
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.