I am working on a
render.yaml
file with many similarly configured cron jobs, and it would be great to have a way to define variables or repeatable base configurations. Right now, I’m using YAML anchors in a kind of messy way, where the first cron job configuration also defines variables that get re-used in later configurations. That’s messy though, because later cron jobs need to override things from the first job that they might not otherwise set if they had a more clean “base” config.
I’d love to have something like what is described in this community forum post: https://community.render.com/t/freeform-area-to-set-up-yaml-anchors/2619
# This might be a special field name that people can
# use, or maybe extra top-level fields prefixed with
# `_` or something could be specially allowed.
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'
Alternatively, a system like CircleCI uses, where they have special command and environment variables you can create (rather than just YAML anchors/references) would work great, too: https://circleci.com/docs/2.0/reusing-config/