We use cockroachdb serverless as our database. We can create new instances via their API and would like to have a new instance per pull request environment (or preview environment).
Is it possible to run a pre or post build script to create my instance and set environment variables for the new environment? It looks like there’s a post build shell script option within the render.yaml for preview envs, but not pull request. If there’s no way on render, then I’ll have to use github actions to integrate cockroach and trigger deployments on render.
It certainly is possible, there are a few ways of doing that. Using PR Environments and the render.yaml file, you can dynamically set the initialDeployHook [https://render.com/docs/preview-environments#preview-environment-initialization], which will run after the first successful deploy and before your service’s start command.