Skip to content

Required Variable Without a Description Causes a Panic #934

@jaloren

Description

@jaloren

Describe the issue

If you create a required variable without a description, then deploying a DAB will cause the CLI to panic.

Steps to reproduce the behavior

Create a dab that has a job config shown below. Then attempt to deploy it with the following command:

databricks --profile ingestion-qa bundle deploy --compute-id 1016-174627-7wbh39rf --var="env=qa"

here is the config

variables:
  env:
resources:
  jobs:
    kafka_sync_job:
      name: kafka_sync_job

      tasks:
        - task_key: main_task
          job_cluster_key: job_cluster
          python_wheel_task:
            package_name: kafka_sync
            entry_point: main
            parameters:
              - --env
              - ${var.env}
          libraries:
            # By default, we just include the .whl file generated for the kafka_sync package.
            # See https://docs.databricks.com/dev-tools/bundles/library-dependencies.html
            # for more information on how to add other libraries.
            - whl: ../dist/*.whl
            - pypi:
                package: "confluent-kafka==2.2.0"

      job_clusters:
        - job_cluster_key: job_cluster
          new_cluster:
            spark_version: 14.1.x-scala2.12
            node_type_id: i3.xlarge
            autoscale:
              min_workers: 1

Expected Behavior

If a description is required, then instead of panicking the CLI should exit with a useful error message. Alternatively, don't panic and instead process the variables properly.

Actual Behavior

CLI panics with the following stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1673701]

goroutine 1 [running]:
github.com/databricks/cli/bundle/config/variable.(*Variable).HasValue(...)
	github.com/databricks/cli/bundle/config/variable/variable.go:37
github.com/databricks/cli/bundle/config/variable.(*Variable).Set(0x0, {0xc0000135f4, 0x2})
	github.com/databricks/cli/bundle/config/variable/variable.go:41 +0x61
github.com/databricks/cli/bundle/config.(*Root).InitializeVariables(0xc0003b82c0, {0xc000048890?, 0x1, 0x0?})
	github.com/databricks/cli/bundle/config/root.go:152 +0x126
github.com/databricks/cli/cmd/bundle.ConfigureBundleWithVariables(0xc0004b7b00, {0xc0004344b0?, 0x4?, 0x1c93457?})
	github.com/databricks/cli/cmd/bundle/variables.go:23 +0x9b
github.com/spf13/cobra.(*Command).execute(0xc0004b7b00, {0xc000434460, 0x5, 0x5})
	github.com/spf13/[email protected]/command.go:925 +0x7f6
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003d0000)
	github.com/spf13/[email protected]/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
	github.com/spf13/[email protected]/command.go:1001
github.com/databricks/cli/cmd/root.Execute(0x1e471e8?)
	github.com/databricks/cli/cmd/root/root.go:99 +0x5b
main.main()
	github.com/databricks/cli/main.go:11 +0x2a

OS and CLI version

mac os
Databricks CLI v0.208.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingCLICLI related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions