Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foldable groups in CI outputs in commands that need it #24035

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ def cleanup(verbose: bool, dry_run: bool, github_repository: str, all: bool, ans
given_answer = user_confirm("Are you sure with the removal?")
if given_answer == Answer.YES:
system_prune_command_to_execute = ['docker', 'system', 'prune']
run_command(system_prune_command_to_execute, verbose=verbose, dry_run=dry_run, check=False)
run_command(
system_prune_command_to_execute,
verbose=verbose,
dry_run=dry_run,
check=False,
enabled_output_group=True,
)
elif given_answer == Answer.QUIT:
sys.exit(0)
get_console().print(f"Removing build cache dir ${BUILD_CACHE_DIR}")
Expand Down Expand Up @@ -455,7 +461,9 @@ def fix_ownership(github_repository: str, verbose: bool, dry_run: bool):
shell_params.airflow_image_name_with_tag,
"/opt/airflow/scripts/in_container/run_fix_ownership.sh",
]
run_command(cmd, verbose=verbose, dry_run=dry_run, text=True, env=env, check=False)
run_command(
cmd, verbose=verbose, dry_run=dry_run, text=True, env=env, check=False, enabled_output_group=True
)
# Always succeed
sys.exit(0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ def build_production_image(
cwd=AIRFLOW_SOURCES_ROOT,
check=False,
text=True,
enabled_output_group=True,
)
if build_command_result.returncode == 0:
if prod_image_params.tag_as_latest:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def prepare_airflow_packages(
verbose=verbose,
dry_run=dry_run,
debug=debug,
enabled_output_group=True,
)
sys.exit(result_command.returncode)

Expand Down Expand Up @@ -550,6 +551,7 @@ def verify_provider_packages(
verbose=verbose,
dry_run=dry_run,
debug=debug,
enabled_output_group=True,
)
sys.exit(result_command.returncode)

Expand Down
2 changes: 1 addition & 1 deletion dev/breeze/src/airflow_breeze/utils/ci_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def ci_group(title: str, enabled: bool = True):
get_console().print(f"[info]{title}[/]")
yield
return
get_console().print(f"::group::<EXPAND>: [info]{title}[/]")
get_console().print(f"::group::<CLICK_TO_EXPAND>: [info]{title}[/]")
yield
get_console().print("::endgroup::")
1 change: 0 additions & 1 deletion dev/breeze/src/airflow_breeze/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def run_pull_image(
dry_run=dry_run,
text=True,
check=False,
enabled_output_group=not parallel,
)
if not dry_run:
if command_result.returncode == 0:
Expand Down
2 changes: 1 addition & 1 deletion dev/breeze/src/airflow_breeze/utils/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run_command(
if verbose or dry_run:
command_to_print = ' '.join(shlex.quote(c) for c in cmd)
env_to_print = get_environments_to_print(env)
with ci_group(title=f"Running {title}", enabled=enabled_output_group):
with ci_group(title=f"Running {title}"):
get_console().print(f"\n[info]Working directory {workdir} [/]\n")
# Soft wrap allows to copy&paste and run resulting output as it has no hard EOL
get_console().print(f"\n[info]{env_to_print}{command_to_print}[/]\n", soft_wrap=True)
Expand Down