databricks / mlops-stacks

This repo provides a customizable stack for starting new ML projects on Databricks that follow production best-practices out of the box.
https://docs.databricks.com/en/dev-tools/bundles/mlops-stacks.html
Apache License 2.0
425 stars 143 forks source link

Move regex validation checks to template schema #108

Closed shreyas-goenka closed 10 months ago

shreyas-goenka commented 10 months ago

Changes

This PR moves regex validation checks to the template schema. This has the following advantages:

  1. Mlops-stacks will fail / give feedback early when an invalid value is provided
  2. Allows us to remove existing validation checks

Note: We first need to get https://github.com/databricks/cli/pull/912 in, and set / update the minimum CLI version for mlops-stacks before this PR can be merged.

Tests

Tested manually. Here are the cases:

Case project_name: ab

shreyas.goenka@THW32HFW6T playground % cli bundle init ~/mlops-stack
Welcome to MLOps Stacks. For detailed information on project generation, see the README at https://github.com/databricks/mlops-stacks/blob/main/README.md. 

Project Name [my-mlops-project]: ab
Error: invalid value for input_project_name: "ab". Project name must be at least 3 characters long and cannot contain the following characters: "\", "/", " " and ".".

Case project_name: abcd/

shreyas.goenka@THW32HFW6T playground % cli bundle init ~/mlops-stack
Welcome to MLOps Stacks. For detailed information on project generation, see the README at https://github.com/databricks/mlops-stacks/blob/main/README.md. 

Project Name [my-mlops-project]: abcd/
Error: invalid value for input_project_name: "abcd/". Project name must be at least 3 characters long and cannot contain the following characters: ",", "/", " " and ".".

Case staging URL: abc

URL of staging Databricks workspace, used to run CI tests on PRs and preview config changes before they're deployed to production. Default: 
Azure - https://adb-xxxx.xx.azuredatabricks.net
AWS - https://your-staging-workspace.cloud.databricks.com
: abc
Error: invalid value for input_databricks_staging_workspace_host: "abc". Databricks staging workspace host URLs must start with https. Got invalid workspace host.
shreyas-goenka commented 10 months ago

This PR requires a CLI side fix before proceeding: https://github.com/databricks/cli/pull/959