cli icon indicating copy to clipboard operation
cli copied to clipboard

Include overrides for targets

Open danricbede opened this issue 2 years ago • 2 comments

https://github.com/databricks/cli/pull/856 introduced target-level overrides for sync. It would also be useful to do the same for include, as this would make the databricks.yml much easier to read/manage and provide some level of reusability.

danricbede avatar Oct 11 '23 17:10 danricbede

Thanks for raising this. Can you elaborate on how you would want to factor your configuration to warrant different configuration files per target? Most (if not all) specialization should be doable per target already.

pietern avatar Oct 16 '23 10:10 pietern

An example would be a job that is unique to a given environment (e.g. a client-specific feature, or a test suite).

Given a baseline config:

# databricks.yml
bundle:
  name: example

include:
  - "jobs.yml"

targets:
  dev:
    workspace:
      host: abc

  prod:
    workspace:
      host: xyz

And baseline jobs, included by baseline config:

# jobs.yml
resources:
  jobs:
    data_load:
      name: Daily Load

    # etc.

The requirement is to add a job, specifically to the dev target. This can be done by inling the required job:

# databricks.yml
bundle:
  name: example

include:
  - "jobs.yml"

targets:
  dev:
    workspace:
      host: abc

    resources:
      jobs:
        dev_specific:
          name: Specific dev job

        # etc.

  prod:
    workspace:
      host: xyz

However, including it would be preferred, as this may grow larger over time or be shared in other specific envs:

# databricks.yml
bundle:
  name: example

include:
  - "jobs.yml"

targets:
  dev:
    workspace:
      host: abc

    include:
      - dev_jobs.yml

  prod:
    workspace:
      host: xyz
#dev_jobs.yml
resources:
  jobs:
    dev_specific:
      name: Specific dev job

    # etc.

The example here is using jobs, but it could be anything really.

danricbede avatar Oct 16 '23 16:10 danricbede

Duplicate of https://github.com/databricks/cli/issues/1456

andrewnester avatar Jul 29 '24 14:07 andrewnester