Background: I have a separate Databricks Workspace for each environment, and I am buidling an Azure DevOps pipeline to deploy a Databricks Asset Bundles to these environments.
Question The asset bundle is configured in a databricks.yml file. How do I pass parameters to this file so I can change variables depending on the environment?
For example, I want to be able to vary my scheduling such that it runs more often in Prod than in the lower level environments. In the code below I want to pass {cronExpression} to the file from the pipeline.
Example from databricks.yml:
bundle:
name: bundle_name
resources:
jobs:
job_name:
name: job_name
schedule:
quartz_cron_expression: {inputParameter}
tasks:
...
I have looked at Custom Variables, but it seems they need to be hard-coded in databricks.yml. https://learn.microsoft.com/en-us/azure/databricks/dev-tools/bundles/settings#--custom-variables
In DevOps pipeline, you can use
replacetokens@5to dynamically set the value in file.For example, have the databricks.yml below, notice the
#{inputParameter}#format as it will be evaluated in task.In DevOps, install extension Replace Tokens, add task as below:
I add the variable
inputParameteri want to use.I output the yml file for confirmation: