Accept Title-Case Representation of Booleans to Adapt for awkward Azure Pipelines Behaviour
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
Direzione di ricerca
Inizia in databricks/bundles/core/_transform.py alle righe 199-207, dove vengono convertite le stringhe delle variabili booleane e viene sollevata l'eccezione. Riproduci l'input di Azure Pipelines con "True" e "False", quindi verifica che entrambi i valori in Title Case siano accettati come i loro equivalenti in minuscolo, senza modificare la gestione degli altri tipi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Go
- Stelle
- 396
- Fork
- 233
- Merge medio
- 2g 52m
- PR unite (30g)
- 276
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di databricks/cli
-
DABs
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
databricks/cli#6670 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
databricks/cli#6786 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
databricks/cli#6785 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
databricks/cli#6770 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
databricks/cli#6765 ·
Tutte le issue di databricks/cli
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 60/100
github/gh-aw-mcpg#13748 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
googleapis/librarian#7670 · 2 commenti ·