Accept Title-Case Representation of Booleans to Adapt for awkward Azure Pipelines Behaviour
还没有人认领这个 Issue。
评估
调研方向
从 databricks/bundles/core/_transform.py 的第199-207行开始,这里会转换布尔变量字符串并引发异常。使用 "True" 和 "False" 重现 Azure Pipelines 输入,然后验证这两个 Title Case 值都能像对应的小写值一样被接受,同时不改变其他类型的处理方式。
由索引模型根据 Issue 内容生成。
描述
Describe the issue
Variable resolution in asset bundles only accepts "true"/"false" literals, while Azure Pipelines passes "True"/"False".
Configuration
Azure Pipelines sending boolean parameters to Asset Bundles' /bundles/core/_transform.py:199-207.
Steps to reproduce the behavior
Declare some asset bundle variable as Variable[bool], then pass "True" to it. Like Azure DevOps Pipelines do.
Expected Behavior
Asset Bundles accepts the passed string as boolean value. Like it does for the lowercase variant.
Actual Behavior
Asset Bundles raises an exception (see below) and fails.
OS and CLI version
Azure Pipeline runners on linux, databricks-bundles==0.265.0. But the _transform() function is unchanged in the latest version.
Is this a regression?
Not that I know of.
Debug Logs
Error: Failed to load resources
in resources/__init__.py:108:1
Traceback (most recent call last):
File "/mnt/vss/_work/1/s/.venv/lib/python3.10/site-packages/databricks/bundles/core/_bundle.py", line 90, in resolve_variable
return _transform(variable.type, value)
File "/mnt/vss/_work/1/s/.venv/lib/python3.10/site-packages/databricks/bundles/core/_transform.py", line 207, in _transform
raise ValueError(f"Unexpected type: {cls} for '{value}'")
ValueError: Unexpected type: <class 'bool'> for 'False'
Is this a bug?
Of course this could be considered a Azure DevOps Pipelines bug. Why are they keeping the Python-style string cast for bools? But as that would be a breaking change on their side and is thus unlikely to happen, we should consider adapting here.
Or course this can be worked around by explicitly lowercasing the bool. But that's far from obvious as shown in this azure devops pipeline:
parameters:
- name: enableFeature
displayName: Enable Feature?
type: boolean
default: true
jobs:
- job: deploy
pool:
vmImage: 'ubuntu-latest'
steps:
- bash: |
# Azure Pipelines passes boolean as "True" or "False"
echo "Parameter value: ${{ parameters.enableFeature }}"
# This FAILS - Databricks rejects title-case:
databricks bundle deploy --var="my_bool=${{ parameters.enableFeature }}"
# Workaround - convert to lowercase:
# databricks bundle deploy --var="my_bool=${{ lower(parameters.enableFeature) }}"
displayName: Deploy Bundle
- 主要语言
- Go
- 星标
- 396
- 派生
- 233
- 平均合并
- 2 天 52 分钟
- 30 天内合并 PR
- 276
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
databricks/cli 的其他 Issue
-
DABs
难度 2/5 1-3 小时 新手友好度 68/100
databricks/cli#6670 ·
-
难度 4/5 3-5 天 新手友好度 68/100
databricks/cli#6786 ·
-
难度 4/5 3-5 天 新手友好度 45/100
databricks/cli#6785 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
databricks/cli#6770 ·
-
难度 1/5 1 小时以内 新手友好度 20/100
databricks/cli#6765 ·
相似的 Issue
-
bug github_actions
难度 2/5 1-3 小时 新手友好度 75/100
registrystack/registry-stack#1393 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
JakeChampion/lang#10213 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
oasisprotocol/oasis-sdk#2523 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 70/100