Skip to content

Commit 5d18942

Browse files
committed
ci: Fix YAML syntax by moving heredocs to separate script
The heredoc syntax in the YAML was causing parser errors. Moved the TMT reproduction test to a separate shell script for cleaner handling. Assisted-by: Claude Code (Sonnet 4.5)
1 parent 60adb49 commit 5d18942

File tree

2 files changed

+61
-62
lines changed

2 files changed

+61
-62
lines changed

.github/scripts/debug-tmt.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
set -exuo pipefail
3+
4+
cd /var/tmp
5+
mkdir -p tmt-repro
6+
cd tmt-repro
7+
8+
# Create a minimal FMF tree
9+
mkdir -p .fmf
10+
echo "1" > .fmf/version
11+
12+
# Create minimal plan
13+
mkdir -p tmt
14+
cat > tmt/test.fmf <<'FMFEOF'
15+
summary: Minimal test
16+
test: echo "hello world"
17+
FMFEOF
18+
19+
echo "=== Test 1: Default tmt run (with set -x from this script) ==="
20+
tmt run discover --how fmf 2>&1 | head -50 || true
21+
22+
echo ""
23+
echo "=== Test 2: Check if TMT detects it's in CI and enables debug ==="
24+
python3 <<'EOF'
25+
import sys, os
26+
sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages')
27+
28+
# Import TMT and check if it has CI detection logic
29+
import tmt.log
30+
import tmt.cli
31+
import inspect
32+
33+
# Get the Logger class source
34+
logger_cls_source = inspect.getsource(tmt.log.Logger)
35+
print("Searching tmt.log.Logger for CI detection or auto-debug logic:")
36+
for line_no, line in enumerate(logger_cls_source.split('\n'), 1):
37+
if any(keyword in line.lower() for keyword in ['ci', 'github', 'actions', 'debug', 'level']):
38+
print(f" Line {line_no}: {line.rstrip()}")
39+
40+
print("\n\n=== Check TMT_DEBUG environment variable ===")
41+
print(f"TMT_DEBUG={os.environ.get('TMT_DEBUG', '<not set>')}")
42+
43+
print("\n=== Let's manually check what default log level TMT uses ===")
44+
# Try to instantiate TMT's logger and see what level it uses
45+
import logging
46+
47+
# Before importing tmt.cli, check current logger levels
48+
print(f"Root logger level: {logging.getLogger().level}")
49+
print(f"Root logger effective level: {logging.getLogger().getEffectiveLevel()}")
50+
51+
# Import and check tmt logger
52+
tmt_logger = logging.getLogger('tmt')
53+
print(f"TMT logger level: {tmt_logger.level}")
54+
print(f"TMT logger effective level: {tmt_logger.getEffectiveLevel()}")
55+
print(f"TMT logger handlers: {tmt_logger.handlers}")
56+
57+
# Check if handlers have different levels
58+
for handler in tmt_logger.handlers:
59+
print(f" Handler {handler}: level={handler.level}")
60+
EOF

.github/workflows/debug-tmt.yml

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -50,65 +50,4 @@ jobs:
5050
python3 -c "import logging; print(f'Root logger level: {logging.getLogger().level}')"
5151
5252
- name: Reproduce actual CI TMT run and check verbosity levels
53-
run: |
54-
set -exuo pipefail
55-
56-
cd /var/tmp
57-
mkdir -p tmt-repro
58-
cd tmt-repro
59-
60-
# Create a minimal FMF tree
61-
mkdir -p .fmf
62-
cat > .fmf/version <<'FMFEOF'
63-
1
64-
FMFEOF
65-
66-
# Create minimal plan
67-
mkdir -p tmt
68-
cat > tmt/test.fmf <<'FMFEOF'
69-
summary: Minimal test
70-
test: echo "hello world"
71-
FMFEOF
72-
73-
echo "=== Test 1: Default tmt run (with set -x from this script) ==="
74-
tmt run discover --how fmf 2>&1 | head -50 || true
75-
76-
echo ""
77-
echo "=== Test 2: Check if TMT detects it's in CI and enables debug ==="
78-
python3 << 'EOF'
79-
import sys, os
80-
sys.path.insert(0, '/home/runner/.local/lib/python3.13/site-packages')
81-
82-
# Import TMT and check if it has CI detection logic
83-
import tmt.log
84-
import tmt.cli
85-
import inspect
86-
87-
# Get the Logger class source
88-
logger_cls_source = inspect.getsource(tmt.log.Logger)
89-
print("Searching tmt.log.Logger for CI detection or auto-debug logic:")
90-
for line_no, line in enumerate(logger_cls_source.split('\n'), 1):
91-
if any(keyword in line.lower() for keyword in ['ci', 'github', 'actions', 'debug', 'level']):
92-
print(f" Line {line_no}: {line.rstrip()}")
93-
94-
print("\n\n=== Check TMT_DEBUG environment variable ===")
95-
print(f"TMT_DEBUG={os.environ.get('TMT_DEBUG', '<not set>')}")
96-
97-
print("\n=== Let's manually check what default log level TMT uses ===")
98-
# Try to instantiate TMT's logger and see what level it uses
99-
import logging
100-
101-
# Before importing tmt.cli, check current logger levels
102-
print(f"Root logger level: {logging.getLogger().level}")
103-
print(f"Root logger effective level: {logging.getLogger().getEffectiveLevel()}")
104-
105-
# Import and check tmt logger
106-
tmt_logger = logging.getLogger('tmt')
107-
print(f"TMT logger level: {tmt_logger.level}")
108-
print(f"TMT logger effective level: {tmt_logger.getEffectiveLevel()}")
109-
print(f"TMT logger handlers: {tmt_logger.handlers}")
110-
111-
# Check if handlers have different levels
112-
for handler in tmt_logger.handlers:
113-
print(f" Handler {handler}: level={handler.level}")
114-
EOF
53+
run: bash .github/scripts/debug-tmt.sh

0 commit comments

Comments
 (0)