databricks-cli/cmd/bundle
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
..
generate Added `databricks bundle generate job` command (#1043) 2024-01-17 14:26:33 +00:00
bundle.go Added `databricks bundle generate job` command (#1043) 2024-01-17 14:26:33 +00:00
deploy.go Correct name for force acquire deploy flag (#656) 2023-08-15 19:03:43 +00:00
destroy.go Add validation for Git settings in bundles (#578) 2023-07-30 12:44:33 +00:00
generate.go Added `databricks bundle generate job` command (#1043) 2024-01-17 14:26:33 +00:00
init.go Improve experience for multiple builtin templates (#1052) 2023-12-27 12:03:08 +00:00
init_test.go Improve experience for multiple builtin templates (#1052) 2023-12-27 12:03:08 +00:00
launch.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
run.go Do not allow input prompts in Git Bash terminal (#1069) 2023-12-18 15:01:59 +00:00
schema.go Move bundle schema update to an internal module (#1012) 2023-12-06 10:45:18 +00:00
sync.go Make `file_path` and `artifact_path` fields consistent with json tag (#987) 2023-11-15 13:37:26 +00:00
test.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
validate.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
variables.go Renamed `environments` to `targets` in bundle configuration (#670) 2023-08-17 15:22:32 +00:00