My build step includes different ENV variables for different environments. I can setup different variables using "deployment variables" but I am not able use them during build step. If I use repo variables I can not build for different env. Is there a way to specify different set of variables for builds? Thanks.
Hello rhegde,
you can access deployment variables in the same way you access other variables, with a dollar sign in front. However, deployment variables are only available if that step also has a deployment configured. Here is a sample pipeline that uses a deployment variable:
pipelines:
branches:
master:
- step:
deployment: test
script:
- echo $MY_VARIABLE
And then configure the deployment variable like this in the deployments settings:
For the purpose of this test make sure it is unsecured. Secured variables can not be echoed in the build logs, you should use that feature for access credentials and other secret information.
Ok got it, I just have to add "deployment: name" to that step where I want to use the variables.
On the same not, is it possible to use the deployment variables outside the yaml file just like the repo variable? e.g. in .env files.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.