databricks-cli/bundle/tests
Lennart Kats (databricks) 57e75d3e22
Add development runs (#522)
This implements the "development run" functionality that we desire for DABs in the workspace / IDE.

## bundle.yml changes

In bundle.yml, there should be a "dev" environment that is marked as
`mode: debug`:
```
environments:
  dev:
    default: true
    mode: development # future accepted values might include pull_request, production
```

Setting `mode` to `development` indicates that this environment is used
just for running things for development. This results in several changes
to deployed assets:
* All assets will get '[dev]' in their name and will get a 'dev' tag
* All assets will be hidden from the list of assets (future work; e.g.
for jobs we would have a special job_type that hides it from the list)
* All deployed assets will be ephemeral (future work, we need some form
of garbage collection)
* Pipelines will be marked as 'development: true'
* Jobs can run on development compute through the `--compute` parameter
in the CLI
* Jobs get their schedule / triggers paused
* Jobs get concurrent runs (it's really annoying if your runs get
skipped because the last run was still in progress)

Other accepted values for `mode` are `default` (which does nothing) and
`pull-request` (which is reserved for future use).

## CLI changes

To run a single job called "shark_sighting" on existing compute, use the
following commands:
```
$ databricks bundle deploy --compute 0617-201942-9yd9g8ix
$ databricks bundle run shark_sighting
```

which would deploy and run a job called "[dev] shark_sightings" on the
compute provided. Note that `--compute` is not accepted in production
environments, so we show an error if `mode: development` is not used.

The `run --deploy` command offers a convenient shorthand for the common
combination of deploying & running:
```
$ export DATABRICKS_COMPUTE=0617-201942-9yd9g8ix
$ bundle run --deploy shark_sightings
```
The `--deploy` addition isn't really essential and I welcome feedback 🤔
I played with the idea of a "debug" or "dev" command but that seemed to
only make the option space even broader for users. The above could work
well with an IDE or workspace that automatically sets the target
compute.

One more thing I added is`run --no-wait` can now be used to run
something without waiting for it to be completed (useful for IDE-like
environments that can display progress themselves).
```
$ bundle run --deploy shark_sightings --no-wait
```
2023-07-12 08:51:54 +02:00
..
autoload_git Add git config block to bundle config (#356) 2023-04-26 16:54:36 +02:00
basic Move mutator interface to top level bundle package (#105) 2022-11-28 10:59:43 +01:00
conflicting_resource_ids Detect duplicate identifiers in bundle config (#332) 2023-04-17 12:21:21 +02:00
environment_empty Check for nil environment before accessing it (#453) 2023-06-08 20:55:49 +00:00
environment_overrides Move mutator interface to top level bundle package (#105) 2022-11-28 10:59:43 +01:00
include_default Revert "Rename jobs -> workflows" (#118) 2022-12-01 22:39:15 +01:00
include_invalid Fixed error reporting when included invalid files in include section (#543) 2023-07-07 10:22:58 +00:00
include_override Revert "Rename jobs -> workflows" (#118) 2022-12-01 22:39:15 +01:00
include_with_glob Fixed error reporting when included invalid files in include section (#543) 2023-07-07 10:22:58 +00:00
interpolation Add support for multiple level string variable interpolation (#342) 2023-04-20 01:13:33 +02:00
job_and_pipeline Add development runs (#522) 2023-07-12 08:51:54 +02:00
variables Add config environment support for variable overriding (#383) 2023-05-15 14:07:18 +02:00
yaml_anchors Revert "Rename jobs -> workflows" (#118) 2022-12-01 22:39:15 +01:00
README.md Move mutator interface to top level bundle package (#105) 2022-11-28 10:59:43 +01:00
autoload_git_test.go Fix tests for new repository name (#390) 2023-05-16 19:02:07 +02:00
basic_test.go Move mutator interface to top level bundle package (#105) 2022-11-28 10:59:43 +01:00
conflicting_resource_ids_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
environment_empty_test.go Check for nil environment before accessing it (#453) 2023-06-08 20:55:49 +00:00
environment_overrides_test.go Move mutator interface to top level bundle package (#105) 2022-11-28 10:59:43 +01:00
include_default_test.go Store relative path to configuration file for every resource (#322) 2023-04-12 16:17:13 +02:00
include_override_test.go Revert "Rename jobs -> workflows" (#118) 2022-12-01 22:39:15 +01:00
include_test.go Fixed error reporting when included invalid files in include section (#543) 2023-07-07 10:22:58 +00:00
interpolation_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
job_and_pipeline_test.go Add development runs (#522) 2023-07-12 08:51:54 +02:00
loader.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
variables_test.go Added support for bundle.Seq, simplified Mutator.Apply interface (#403) 2023-05-24 14:45:19 +02:00
yaml_anchors_test.go Revert "Rename jobs -> workflows" (#118) 2022-12-01 22:39:15 +01:00

README.md

Bundle configuration tests

Every test here uses an example bundle configuration. Each bundle configuration is located in a dedicated subdirectory.