Improve CI output visibility and remove buffering

- Add flush=True to all colored_print calls for immediate output
- Add PYTHONUNBUFFERED=1 to all deployment and performance test jobs
- Replace simple sleep with countdown progress indicator
- Show 'Retrying in X seconds...' with real-time countdown
- Clear progress line after countdown completes
- Better visibility of what the script is doing during long waits
This commit is contained in:
Oliver Falk
2025-10-24 13:06:57 +02:00
parent 8fbdf35c02
commit 27dd40b4aa
2 changed files with 12 additions and 3 deletions

View File

@@ -161,6 +161,7 @@ performance_tests_dev:
when: on_success # Run automatically after successful deployment verification when: on_success # Run automatically after successful deployment verification
variables: variables:
DEV_URL: "https://dev.libravatar.org" DEV_URL: "https://dev.libravatar.org"
PYTHONUNBUFFERED: 1
before_script: before_script:
- apk add --no-cache curl - apk add --no-cache curl
- pip install requests Pillow prettytable pyLibravatar dnspython py3dns - pip install requests Pillow prettytable pyLibravatar dnspython py3dns
@@ -185,6 +186,7 @@ performance_tests_prod:
when: on_success # Run automatically after successful deployment verification when: on_success # Run automatically after successful deployment verification
variables: variables:
PROD_URL: "https://libravatar.org" PROD_URL: "https://libravatar.org"
PYTHONUNBUFFERED: 1
before_script: before_script:
- apk add --no-cache curl - apk add --no-cache curl
- pip install requests Pillow prettytable pyLibravatar dnspython py3dns - pip install requests Pillow prettytable pyLibravatar dnspython py3dns
@@ -209,6 +211,7 @@ performance_tests_prod_manual:
when: manual # Manual trigger for on-demand performance testing when: manual # Manual trigger for on-demand performance testing
variables: variables:
PROD_URL: "https://libravatar.org" PROD_URL: "https://libravatar.org"
PYTHONUNBUFFERED: 1
before_script: before_script:
- apk add --no-cache curl - apk add --no-cache curl
- pip install requests Pillow prettytable pyLibravatar dnspython py3dns - pip install requests Pillow prettytable pyLibravatar dnspython py3dns
@@ -231,6 +234,7 @@ verify_dev_deployment:
DEV_URL: "https://dev.libravatar.org" DEV_URL: "https://dev.libravatar.org"
MAX_RETRIES: 30 MAX_RETRIES: 30
RETRY_DELAY: 60 RETRY_DELAY: 60
PYTHONUNBUFFERED: 1
before_script: before_script:
- apk add --no-cache curl git - apk add --no-cache curl git
- pip install Pillow - pip install Pillow
@@ -249,6 +253,7 @@ verify_prod_deployment:
PROD_URL: "https://libravatar.org" PROD_URL: "https://libravatar.org"
MAX_RETRIES: 10 MAX_RETRIES: 10
RETRY_DELAY: 30 RETRY_DELAY: 30
PYTHONUNBUFFERED: 1
before_script: before_script:
- apk add --no-cache curl git - apk add --no-cache curl git
- pip install Pillow - pip install Pillow

View File

@@ -54,8 +54,8 @@ class Colors:
def colored_print(message: str, color: str = Colors.NC) -> None: def colored_print(message: str, color: str = Colors.NC) -> None:
"""Print a colored message.""" """Print a colored message with immediate flush."""
print(f"{color}{message}{Colors.NC}") print(f"{color}{message}{Colors.NC}", flush=True)
def get_current_commit_hash() -> Optional[str]: def get_current_commit_hash() -> Optional[str]:
@@ -485,7 +485,11 @@ def test_deployment(
colored_print( colored_print(
f"Waiting {retry_delay} seconds before next attempt...", Colors.BLUE f"Waiting {retry_delay} seconds before next attempt...", Colors.BLUE
) )
time.sleep(retry_delay) # Show progress during wait
for remaining in range(retry_delay, 0, -1):
print(f"\r⏳ Retrying in {remaining:2d} seconds...", end="", flush=True)
time.sleep(1)
print("\r" + " " * 30 + "\r", end="", flush=True) # Clear the line
colored_print( colored_print(
f"❌ FAILED: {name} deployment verification timed out after {max_retries} attempts", f"❌ FAILED: {name} deployment verification timed out after {max_retries} attempts",