databricks-cli/bundle/config/validate
Gleb Kanterov 3d9decdda9
Add JobTaskClusterSpec validate mutator (#1784)
## Changes
Add JobTaskClusterSpec validate mutator. It catches the case when tasks
don't which cluster to use.

For example, we can get this error with minor modifications to
`default-python` template:

```yaml
      tasks:
        - task_key: python_file_task
          spark_python_task:
            python_file: ../src/my_project_10/main.py
```

```
 % databricks bundle validate
Error: Missing required cluster or environment settings
  at resources.jobs.my_project_10_job.tasks[0]
  in resources/my_project_10_job.yml:17:11

Task "print_github_stars" requires a cluster or an environment to run.
Specify one of the following fields: job_cluster_key, environment_key, existing_cluster_id, new_cluster.
```

We implicitly rely on "one of" validation, which does not exist. Many
bundle fields can't co-exist, for instance, specifying:
`JobTask.{existing_cluster_id,job_cluster_key}`, `Library.{whl,pypi}`,
`JobTask.{notebook_task,python_wheel_task}`, etc.

## Tests
Unit tests

---------

Co-authored-by: Pieter Noordhuis <pcnoordhuis@gmail.com>
2024-09-25 11:30:14 +00:00
..
all_resources_have_values.go Report all empty resources present in error diagnostic (#1685) 2024-08-20 00:22:00 +00:00
files_to_sync.go Support multiple paths for diagnostics (#1616) 2024-07-25 15:16:27 +00:00
job_cluster_key_defined.go Support multiple paths for diagnostics (#1616) 2024-07-25 15:16:27 +00:00
job_cluster_key_defined_test.go Added validate mutator to surface additional bundle warnings (#1352) 2024-04-18 15:13:16 +00:00
job_task_cluster_spec.go Add JobTaskClusterSpec validate mutator (#1784) 2024-09-25 11:30:14 +00:00
job_task_cluster_spec_test.go Add JobTaskClusterSpec validate mutator (#1784) 2024-09-25 11:30:14 +00:00
unique_resource_keys.go Pass copy of `dyn.Path` to callback function (#1747) 2024-09-05 11:05:16 +00:00
validate.go Add JobTaskClusterSpec validate mutator (#1784) 2024-09-25 11:30:14 +00:00
validate_sync_patterns.go Make fileset take optional list of paths to list (#1684) 2024-08-19 15:15:14 +00:00