Every secret Environment Variable (Env Var) is an Env Var but not every Env Var is a secret Env Var!
About Env Vars ⚓
In your Workflow Editor, you can set an Env Var with a key and a value in the Env Vars tab which is a collection of all the Env Vars registered for your app. Env vars can be referenced as many times as you wish in any of your Workflow Steps, unless you set them for a specific Workflow.
Check out our short youtube tutorial on how to insert variables in step inputs!
If you click the insert variable button next to any Step input field in your Workflow, you can select the suitable Env Var from the Insert variable pop-up window. This interactive list displays all the available Env Vars you have set in the Env Vars tab and those that have been already generated by previous Steps in the Workflow. As an example, if you click into an input of the third Step of your Workflow, the Insert variable list will include all the Env Vars (outputs) generated by the first and second steps, and the ones you have registered in Env Vars. The list will not show those which will be generated by the fourth, fifth, sixth Steps.
You can also replace the variable for a new one in Env Vars. Delete the old value and set the new one. If you toggle the Replace variables in inputs to the right, the new value will be used everywhere in your Workflow.
Setting an Env Var in Workflows ⚓
Under App Environmental Variables, you can set all the Env Vars you wish to use later on in all your Workflows.
You can set Env Vars for any of your Workflows separately as well. If you wish to set an Env Var with a variable which will be only used in a particular Workflow, then select the respective Workflow from the list and add the Env Var there. The list is comprised of the Workflows you named for your app. (In this example below, the app has a deploy, primary and dummy Workflow.)
About Secrets ⚓
Secret Env Vars are special type of Env Vars as they hide information in an encrypted format so that your private input is not exposed in the build logs/bitrise.yml. Secret Env Vars can be set by adding the Env Var key and the variable in the Secrets tab of the Workflow Editor.
Adding a secret Env Var ⚓
You can add a secret Env Var to your Workflow using our Secrets tab.
- Click Add new on the Secrets tab.
Set the key and value fields.
You can also add a secret Env Var directly in a Step’s
Editing a secret Env Var ⚓
Once you’ve added a new secret Env Var in the Secrets tab, you come back to it any time, modify its content or make it protected from curious eyes!
- Click Edit next to the value of your secret Env Var.
- Modify its content if needed.
- If you want to hide the value, click Make it protected. A lock is shown.
- Delete the secret Env Var if you do not need it any more. Please note if you hit this button, the whole row will get deleted.
You can show and hide the value of an Env Var with the eye icon. This feature is useful if you have a long list of secret env vars in Secrets and you wish to check the value of only one secret env var while leaving the other values hidden. If a value is hidden, it’s represented with the crossed out eye icon.
If you toggle the Replace variables in inputs to the right, the new value will be used everywhere in your Workflow.
The Expose for Pull Request toggle can be enabled if you want your secrets to be exposed in your build logs in pull requests.
To understand Bitrise in depth, there are a few key concepts that must be kept in mind. These are immutable and crucial to the way we do things.
Secrets can be accessed and used in a similar way as app Env Vars, the main difference is that secrets are not stored as part of the build configuration.
Environment Variables (Env Vars) consist of a key and a value, as well as optional attributes. They can be defined on the level of apps, Workflows or Steps.