Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Accept Title-Case Representation of Booleans to Adapt for awkward Azure Pipelines Behaviour

未关闭 适合新手
#3,926 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
python
领域
cli

调研方向

从 databricks/bundles/core/_transform.py 的第199-207行开始,这里会转换布尔变量字符串并引发异常。使用 "True" 和 "False" 重现 Azure Pipelines 输入,然后验证这两个 Title Case 值都能像对应的小写值一样被接受,同时不改变其他类型的处理方式。

由索引模型根据 Issue 内容生成。

描述

DABs PyDABs
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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

databricks/cli 的其他 Issue

查看 databricks/cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。