Accept Title-Case Representation of Booleans to Adapt for awkward Azure Pipelines Behaviour
まだ誰も着手していません。
評価
調査の方向性
databricks/bundles/core/_transform.py の199-207行目から始めます。ここでは boolean 変数の文字列が変換され、例外が発生します。"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分
- マージ済み PR(30日)
- 276
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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