I have a series of several cron jobs with similar configurations that I’m trying to set up in render.yaml
. Since they’re so similar, it would be great to use YAML anchors & references to reduce the amount of boilerplate. For example, I’d love to do something like:
variables:
# This just sets up a re-usable dictionary, but doesn't configure an
# actual service. This way, each service can have a smaller definition.
base-cron-config: &base-cron-config
type: cron
env: node
plan: standard
autoDeploy: true
repo: https://github.com/my-org/my-repo.git
buildCommand: 'npm install'
envVars:
- fromGroup: env-var-group-name
services:
- <<: *base-cron-config
name: Job 1
schedule: '0 0/3 * * *'
startCommand: npm run some-script
- <<: *base-cron-config
name: Job 2
plan: starter plus # Different resource needs
schedule: '0/20 * * * *'
startCommand: 'npm run another-script'
However, when I try to add this as a blueprint, I get an error message about variables
being an unknown key.
Instead, I’ve done the following, but it makes the first cron job pretty messy. It also means I have to be careful to make sure every subsequent cron sets every option that the first one does (even if it’s just effectively resetting it to the default). I’d love to separate out the common parts entirely like above.
services:
- &base-cron-config
name: Job 1
schedule: '0 0/3 * * *'
startCommand: npm run some-script
type: cron
env: node
plan: standard
autoDeploy: true
repo: https://github.com/my-org/my-repo.git
buildCommand: 'npm install'
envVars:
- fromGroup: env-var-group-name
- <<: *base-cron-config
name: Job 2
plan: starter plus # Different resource needs
schedule: '0/20 * * * *'
startCommand: 'npm run another-script'
Is there any way I can do top version of this today (i.e. some “neutral” part of the YAML file I could define things in)?