Skip to content

Commit

Permalink
Do not print content of loaded toml file from new providers in CI (ap…
Browse files Browse the repository at this point in the history
…ache#45848)

When running breeze in CI we run it with VERBOSE="true". We print
the content of the loaded pyproject.toml provider when read via
verbose command and that pollutes the CI logs.

This PR will only print content of such pyproject.toml when there
is a decode error (which was the main reason for this printing).
  • Loading branch information
potiuk authored Jan 21, 2025
1 parent a9ad69c commit f4fed79
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions dev/breeze/src/airflow_breeze/utils/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
OLD_PROVIDER_DATA_SCHEMA_PATH,
)
from airflow_breeze.utils.run_utils import run_command
from airflow_breeze.utils.shared_options import get_verbose
from airflow_breeze.utils.version_utils import remove_local_version_suffix
from airflow_breeze.utils.versions import get_version_tag, strip_leading_zeros_from_version

Expand Down Expand Up @@ -636,14 +635,11 @@ def load_pyproject_toml(pyproject_toml_file_path: Path) -> dict[str, Any]:
except ImportError:
import tomli as tomllib
toml_content = pyproject_toml_file_path.read_text()
syntax = Syntax(toml_content, "toml", theme="monokai", line_numbers=True)
if get_verbose():
get_console().print(syntax)
syntax = Syntax(toml_content, "toml", theme="ansi_dark", line_numbers=True)
try:
return tomllib.loads(toml_content)
except tomllib.TOMLDecodeError as e:
if not get_verbose():
get_console().print(syntax)
get_console().print(syntax)
get_console().print(f"[red]Error when loading {pyproject_toml_file_path}: {e}:")
sys.exit(1)

Expand Down

0 comments on commit f4fed79

Please sign in to comment.