Build context with split testing

We’re using build context to set different env vars depending on the deploys.

It’s working well as we can set our staging environment variables for branch-deploy but when we then use the branch split testing the branch that isn’t set as our production branch in netlify isn’t getting our production env vars as it’s still a branch-deploy for it’s build context.

How can we give both branches in the split test the production env vars?

Hi, @tomfrew. Deploys at Netlify at immutable. They cannot be changed. This means you have set the environment variables as required at the time of the deploy.

If you didn’t set the environment variables as required during the deploy, you will need to make a new deploy with the required values.

If you want to use the same environment variables for the branch deploy you can set that in netlify.toml file:

You can change that file for just one deploy and then change it back again for later deploys if those environment variables are no longer required.

If there are other questions, please reply here anytime.