Note: Environment variable support is currently a pilot feature and its current implementation and deployment behaviour may change over time.
Current limitations and requirements
Environment variable support currently only supports a Salesforce org as the target of the deployment.
You will first need to enable the environment variable feature via the pilot features tab in your Gearset Account page.
Environment variables are a solution for people who have information in their metadata that's specific to one org, and needs to kept that way during a deployment. For example, the email address
[email protected] might exist in a dev org, but it should be
[email protected] in a production org. Or one might want different IP address ranges in their metadata depending on whether the metadata is in a dev or production org. Previously this would have to be a manual change after the deployment, but environment variables allow the user to define where they want changes to be made, what value to find and what to replace it with. This feature applies to both manual deployments and continuous integration deployments.
To configure environment variables, go to the My Account section then find Environment variables on the left-hand side. There will be a dropdown to select the target org, along with tables of existing environment variables you have access to.
A concrete example of this could be replacing the Login IP Ranges in the Admin Profile Metadata. If the dev admin IP range was
100.100.100.100 and the prod admin IP range was
188.8.131.52, then an environment variable could be created with the prod org as a target. You must be the owner of an org connection to add or edit an environment variable with that connection as the target. We would set this up by doing the following:
Choose your target org connection from the dropdown menu and click "Add Salesforce Org". (Notice that two different users' connection to the same org are considered distinct org connections.)
Select the Metadata type "Profile" and Item "Admin" from the respective dropdown menus.
For each replacement you want to make, type in the value to find and the value to replace with, and click "Add Environment Variable".
Each variable will display in a list below the addition options. They can be deleted by clicking the red bin icon next to their entry. Note that you cannot create conflicting entries (variables which have the same target value to find in the same metadata type and item).
Once your environment variables are configured, they will automatically be used in any deployment (manual and CI) which has the chosen org as the target. Any user in the team who either owns or has delegated access to the connection to the target org can use its environment variables. For manual deployments, the environment variables that will be applied to a deployment can be viewed in the Problem Analysis and Environment Variables screen as shown below:
You can check the result of the replacement by downloading the deployment ZIP file at the deployment summary stage. Once you've confirmed these are the variables that should be applied, proceed as normal and the replacements will be made during the deployment.