Defining variables
Variables enhance the functionality of your pipelines by allowing you to store values such as names, needed parameters, and sometimes secrets. There are two ways you can define variables, the first of which was referenced in Chapter 5. Let’s examine these methods.
How to do it...
As we saw in Chapter 5, we can define variables from the editor for bitbucket-pipelines.yml
. Let’s see how you can do that:
- When editing
bitbucket-pipelines.yml
, select the Add variables option.
Figure 6.23 – Expand Add variables
- You can add variables for the repository, as well as any deployment environments you have defined.
Figure 6.24 – Add variables
- To add a variable, give it a name, enter its value, and click Add. Make sure Secured is checked if you need a secured variable for storing passwords or secrets.
Figure 6.25 – Variable...