Skip to content

ci: Add CI env var check to debug workflow #6

ci: Add CI env var check to debug workflow

ci: Add CI env var check to debug workflow #6

Workflow file for this run

name: Debug TMT
permissions:
actions: read
on:
push:
branches: [main]
workflow_dispatch: {}
env:
CARGO_TERM_COLOR: always
LIBVIRT_DEFAULT_URI: "qemu:///session"
jobs:
debug-tmt:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Bootc Ubuntu Setup
uses: ./.github/actions/bootc-ubuntu-setup
with:
libvirt: true
- name: Install tmt
run: pip install --user "tmt[provision-virtual]"
- name: Check environment and RUNNER_DEBUG
run: |
echo "=== Python version ==="
python3 --version
pip --version
echo "=== TMT version ==="
tmt --version
echo "=== Critical: Check RUNNER_DEBUG, ENABLE_RUNNER_TRACING, and CI ==="
echo "RUNNER_DEBUG=${RUNNER_DEBUG:-<not set>}"
echo "ENABLE_RUNNER_TRACING=${ENABLE_RUNNER_TRACING:-<not set>}"
echo "ACTIONS_STEP_DEBUG=${ACTIONS_STEP_DEBUG:-<not set>}"
echo "TMT_DEBUG=${TMT_DEBUG:-<not set>}"
echo "CI=${CI:-<not set>}"
echo "=== All environment variables (full list) ==="
env | sort
echo "=== Python logging configuration ==="
python3 -c "import logging; print(f'Root logger level: {logging.getLogger().level}')"
- name: Reproduce actual CI TMT run and check verbosity levels
run: |
set -exuo pipefail
cd /var/tmp
mkdir -p tmt-repro
cd tmt-repro
# Create a minimal FMF tree
mkdir -p .fmf
cat > .fmf/version <<'FMFEOF'
1

Check failure on line 63 in .github/workflows/debug-tmt.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/debug-tmt.yml

Invalid workflow file

You have an error in your yaml syntax on line 63
FMFEOF
# Create minimal plan
mkdir -p tmt
cat > tmt/test.fmf <<'FMFEOF'
summary: Minimal test
test: echo "hello world"
FMFEOF
echo "=== Test 1: Default tmt run (with set -x from this script) ==="
tmt run discover --how fmf 2>&1 | head -50 || true
echo ""
echo "=== Test 2: Check if TMT detects it's in CI and enables debug ==="
python3 << 'EOF'
import sys, os
sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages')
# Import TMT and check if it has CI detection logic
import tmt.log
import tmt.cli
import inspect
# Get the Logger class source
logger_cls_source = inspect.getsource(tmt.log.Logger)
print("Searching tmt.log.Logger for CI detection or auto-debug logic:")
for line_no, line in enumerate(logger_cls_source.split('\n'), 1):
if any(keyword in line.lower() for keyword in ['ci', 'github', 'actions', 'debug', 'level']):
print(f" Line {line_no}: {line.rstrip()}")
print("\n\n=== Check TMT_DEBUG environment variable ===")
print(f"TMT_DEBUG={os.environ.get('TMT_DEBUG', '<not set>')}")
print("\n=== Let's manually check what default log level TMT uses ===")
# Try to instantiate TMT's logger and see what level it uses
import logging
# Before importing tmt.cli, check current logger levels
print(f"Root logger level: {logging.getLogger().level}")
print(f"Root logger effective level: {logging.getLogger().getEffectiveLevel()}")
# Import and check tmt logger
tmt_logger = logging.getLogger('tmt')
print(f"TMT logger level: {tmt_logger.level}")
print(f"TMT logger effective level: {tmt_logger.getEffectiveLevel()}")
print(f"TMT logger handlers: {tmt_logger.handlers}")
# Check if handlers have different levels
for handler in tmt_logger.handlers:
print(f" Handler {handler}: level={handler.level}")
EOF