databricks-cli/internal/bundle/bundles
Andrew Nester 70fe0e36ef
Added `databricks bundle generate job` command (#1043)
## Changes
Now it's possible to generate bundle configuration for existing job.
For now it only supports jobs with notebook tasks.

It will download notebooks referenced in the job tasks and generate
bundle YAML config for this job which can be included in larger bundle.

## Tests
Running command manually

Example of generated config
```
resources:
  jobs:
    job_128737545467921:
      name: Notebook job
      format: MULTI_TASK
      tasks:
        - task_key: as_notebook
          existing_cluster_id: 0704-xxxxxx-yyyyyyy
          notebook_task:
            base_parameters:
              bundle_root: /Users/andrew.nester@databricks.com/.bundle/job_with_module_imports/development/files
            notebook_path: ./entry_notebook.py
            source: WORKSPACE
          run_if: ALL_SUCCESS
      max_concurrent_runs: 1
 ```

## Tests
Manual (on our last 100 jobs) + added end-to-end test

```
--- PASS: TestAccGenerateFromExistingJobAndDeploy (50.91s)
PASS
coverage: 61.5% of statements in ./...
ok github.com/databricks/cli/internal/bundle 51.209s coverage: 61.5% of
statements in ./...
```
2024-01-17 14:26:33 +00:00
..
basic Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
deploy_then_remove_resources Persist deployment metadata in WSFS (#845) 2023-10-27 12:55:43 +00:00
empty_bundle Make bundle deploy work if no resources are defined (#767) 2023-09-13 22:50:37 +00:00
job_metadata Persist deployment metadata in WSFS (#845) 2023-10-27 12:55:43 +00:00
python_wheel_task Make a notebook wrapper for Python wheel tasks optional (#797) 2023-09-26 14:32:20 +00:00
with_includes Added `databricks bundle generate job` command (#1043) 2024-01-17 14:26:33 +00:00