dstack
dstack copied to clipboard
[Bug]: `env` validation inconsistency in task/service/dev-environment configurations
Steps to reproduce
- Create a task configuration with
envsetting as a list of strings:
env:
- VAR-1=value
- VAR:2=value
- Apply the configuration:
dstack apply -f test-task.dstack.yml→ validation errors:
3 validation errors for ApplyConfigurationRequest
__root__ -> TaskConfigurationRequest -> env -> 0
string does not match regex "^[a-zA-Z_][a-zA-Z0-9_]*(=.*$|$)" (type=value_error.str.regex; pattern=^[a-zA-Z_][a-zA-Z0-9_]*(=.*$|$))
__root__ -> TaskConfigurationRequest -> env -> 1
string does not match regex "^[a-zA-Z_][a-zA-Z0-9_]*(=.*$|$)" (type=value_error.str.regex; pattern=^[a-zA-Z_][a-zA-Z0-9_]*(=.*$|$))
__root__ -> TaskConfigurationRequest -> env
value is not a valid dict (type=type_error.dict)
- Update the configuration, replace the
envlist with a mapping:
env:
VAR-1: value
VAR:2: value
- Apply the configuration again:
dstack apply -f test-task.dstack.yml→ OK, no validation errors
Actual behaviour
Variable name validation rules depend on the env format.
Expected behaviour
Variable names are validated uniformly, that is, hyphens, colons, etc. are either valid or invalid in both env formats.
dstack version
0.18.8
Server logs
No response
Additional information
No response