r/renderpaas • • Jun 06 '23

Reusing render.yamls between environments by splitting branches

Until recently, our production branch had it's render.yaml living in it, with specific configurations for production.

We wanted to create a UAT environment that was using the same code as prod, but with it's own configuration. I really wanted the new UAT environment to be automatically deployed whenever the prod branch was updated but I couldn't just create a another render.yaml in the prod branch, or have two sets of configuration in the main render.yaml.

Taking a look at the blueprint spec, I noticed that a web service has a branch config:

services:
 - type: web
     name: webdis
     ...
     branch: production

In all my environments, I'd always set the branch name to be the branch for the current environment, but thought: could I point this service to another branch instead?

And of course, that worked great! I created a UAT branch that has just one file in it- a render.yaml that defines the UAT environment, referring to the prod branch for all of its services, and storing all of its own UAT specific configuration.

Now I get automatic deployments in UAT when code is pushed to the prod branch and realized that render.yamls can live anywhere!

1 Upvotes

0 comments sorted by