Problem Statement:
I have a Databricks Asset Bundles (DAB) project with the following requirement:
I need to create an all-purpose cluster whose configuration references:
- An init script stored at /Volumes/<catalog>/<schema>/<volume>/scripts/init_script.sh
- A requirements.txt file stored at /Volumes/<catalog>/<schema>/<volume>/libraries/requirements.txt
The init script itself refers to the requirements.txt file.
Therefore, the cluster can only be created successfully after the schema, volume, folders, and files have been created.
Required Dependency Sequence:
The desired deployment sequence is:
- Create the schema.
- Create the volume under the schema.
- Create the required folders in the volume.
- Copy the required files (init_script.sh, requirements.txt, etc.) into the volume.
- Create the all-purpose cluster referencing those volume paths.
DAB supports the creation of the schema and volume, but I don't see a native DAB mechanism to:
- Create folders/files inside a Unity Catalog volume as part of the bundle deployment.
- Execute an arbitrary shell script as a deployment step.
- Define the required dependency ordering between these operations and the cluster resource.
Current Workaround:
To handle this dependency, I have created a wrapper shell script that performs the deployment in multiple stages.
Step 1 – Disable cluster creation
Rename:
clusters.yml → clusters.yml.disabled
This prevents the cluster from being processed during the initial bundle deployment.
Step 2 – Deploy the DAB
Run databricks bundle deploy to create the schema and volume.
Step 3 – Populate the volume
Run a shell script that:
- Creates the required folders in the volume.
- Copies init_script.sh, requirements.txt, and other required files into the appropriate volume paths.
Step 4 – Re-enable cluster creation
Rename:
clusters.yml.disabled → clusters.yml
Step 5 – Deploy the DAB again
Run databricks bundle deploy again so that the cluster is created after all of its dependencies are available.
This approach works, but it requires maintaining a custom wrapper script and effectively performing two separate bundle deployments.
Question:
What is the recommended/best-practice approach in Databricks Asset Bundles for handling this type of dependency?
Specifically, is there a supported way to ensure that:
Schema → Volume → Volume files → Cluster
are provisioned in the correct order within a DAB deployment?
If DAB does not currently support this dependency/workflow natively, what would be the recommended architecture or deployment pattern for managing files that must exist in a Unity Catalog volume before a cluster is created?
Any guidance on the preferred approach would be appreciated.