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

Using Workspace variables in deployment variables

Alan Wolman
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!
March 12, 2022

We have a number of keys that are used by all of our builds (but are different for each of our environments) and we would like to store these as workspace variables - but expose these in each of our deployments by referencing the workspace variables.


Workspace Variables


   - echo $KEY

Is there any way of having a deployment variable reference a workspace variable?

1 answer

0 votes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 13, 2022

Hey Alan!

I have just tested on my end and can confirm the exact configuration you have defined will work to reference workspace-level variables IF those workspace-level variables are unsecured, as you are able to reference both deployment/workspace variables when running a pipelines build.

For more information please refer to the following link:


- Ben (Bitbucket Cloud Support)

Ben Orgil July 11, 2022

The variables the user asked about were "KEYS" so they probably need to be secured.

Your saying this won't work for secured workspace variables?

Is there just a way to define environments at the workspace level?

Like Drew Heasman likes this
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 12, 2022

Hey Ben,

Yes, the idea behind "secured" variables is that they are secure and therefore echoing them will not reveal the values inside these.

There is some text when configuring workspace variables from within Workspace Settings > Pipelines > Workspace Variables that defines the above:

Environment variables added at the workspace level can be accessed from all repositories that are within that workspace. To access a variable, put the $ symbol in front of its name. For example, access AWS_SECRET by using $AWS_SECRET. 
Workspace variables can be overridden by variables added on the repository level.

If you want the variable to be stored unencrypted and shown in plain text in the logs, unsecure it by unchecking the checkbox.

Environments can only be defined at the repository level from within Repository Settings > Pipelines > Deployments.


- Ben (Bitbucket Cloud Support)

Like Douglas Carmo likes this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events