databricks-cli/cmd/workspace
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
..
alerts Always require path parameters as positional arguments (#1129) 2024-01-17 14:14:20 +00:00
apps Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
artifact-allowlists Always require path parameters as positional arguments (#1129) 2024-01-17 14:14:20 +00:00
catalogs Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
clean-rooms Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
cluster-policies Do not require positional arguments if they should be provided in JSON (#1125) 2024-01-17 10:53:50 +00:00
clusters Do not require positional arguments if they should be provided in JSON (#1125) 2024-01-17 10:53:50 +00:00
connections Always require path parameters as positional arguments (#1129) 2024-01-17 14:14:20 +00:00
credentials-manager Updated Go SDK to 0.22.0 (#831) 2023-10-03 11:46:16 +00:00
current-user Remove dependency on global state in generated commands (#595) 2023-07-25 20:19:07 +02:00
dashboard-widgets Always require path parameters as positional arguments (#1129) 2024-01-17 14:14:20 +00:00
dashboards Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
data-sources Remove dependency on global state in generated commands (#595) 2023-07-25 20:19:07 +02:00
experiments Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
external-locations Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
functions Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
git-credentials Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
global-init-scripts Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
grants Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
groups Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
instance-pools Do not require positional arguments if they should be provided in JSON (#1125) 2024-01-17 10:53:50 +00:00
instance-profiles Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
ip-access-lists Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
jobs Do not require positional arguments if they should be provided in JSON (#1125) 2024-01-17 10:53:50 +00:00
lakeview Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
libraries Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
metastores Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
model-registry Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
model-versions Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
permissions Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
pipelines Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
policy-families Simplified code generation logic for handling path and request body parameters and JSON input (#905) 2023-10-24 17:37:08 +00:00
providers Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
queries Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
query-history Simplified code generation logic for handling path and request body parameters and JSON input (#905) 2023-10-24 17:37:08 +00:00
query-visualizations Always require path parameters as positional arguments (#1129) 2024-01-17 14:14:20 +00:00
recipient-activation Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
recipients Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
registered-models Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
repos Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
schemas Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
secrets Added output template for list-secrets command (#1074) 2023-12-18 16:09:11 +00:00
service-principals Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
serving-endpoints Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
settings Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
shares Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
storage-credentials Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
system-schemas Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
table-constraints Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
tables Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
token-management Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
tokens Do not require positional arguments if they should be provided in JSON (#1125) 2024-01-17 10:53:50 +00:00
users Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
vector-search-endpoints Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
vector-search-indexes Always require path parameters as positional arguments (#1129) 2024-01-17 14:14:20 +00:00
volumes Upgrade Go SDK to 0.27.0 (#1064) 2023-12-14 08:15:00 +00:00
warehouses Add list of supported values for flags that represent an enum field (#1036) 2023-12-06 08:12:17 +00:00
workspace Added `databricks bundle generate job` command (#1043) 2024-01-17 14:26:33 +00:00
workspace-bindings Add documentation for positional args in commands generated from the Databricks OpenAPI specification (#1033) 2023-11-30 16:22:23 +00:00
workspace-conf Simplified code generation logic for handling path and request body parameters and JSON input (#905) 2023-10-24 17:37:08 +00:00
cmd.go Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00
groups.go Upgrade Go SDK to v0.29.0 (#1111) 2024-01-11 08:16:25 +00:00