Skip to content

Commit bf4c19e

Browse files
authored
ci: fail "Print openidm logs" step on errors/exceptions in OpenIDM logs (#175)
1 parent 541c8e4 commit bf4c19e

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ jobs:
5555
openidm/startup.sh &
5656
timeout 3m bash -c 'until grep -q "OpenIDM ready" openidm/logs/openidm0.log.0 ; do sleep 5; done' || cat openidm/logs/openidm0.log.0
5757
grep -q "OpenIDM ready" openidm/logs/openidm0.log.0
58-
! grep "ERROR" openidm/logs/openidm0.log.0
59-
! grep "SEVERE" openidm/logs/openidm0.log.0
58+
! grep -E "ERROR|SEVERE|Exception|Throwable" openidm/logs/openidm0.log.0
6059
- name: Test on Windows
6160
if: runner.os == 'Windows'
6261
run: |
@@ -66,8 +65,11 @@ jobs:
6665
Start-Sleep -s 180
6766
type logs\openidm0.log.0
6867
findstr "OpenIDM ready" logs\openidm0.log.0
69-
type logs\openidm0.log.0 | find /c '"ERROR"' | findstr "0"
70-
type logs\openidm0.log.0 | find /c '"SEVERE"' | findstr "0"
68+
if (Select-String -Path logs\openidm0.log.0 -Pattern 'ERROR|SEVERE|Exception|Throwable' -Quiet) {
69+
Write-Host "Errors or exceptions detected in openidm0.log.0"
70+
Select-String -Path logs\openidm0.log.0 -Pattern 'ERROR|SEVERE|Exception|Throwable'
71+
exit 1
72+
}
7173
- name: Upload failure artifacts
7274
uses: actions/upload-artifact@v7
7375
if: ${{ failure() }}
@@ -136,8 +138,7 @@ jobs:
136138
OPENIDM_OPTS="$OPTS" openidm/startup.sh $ARGS &
137139
timeout 3m bash -c 'until grep -q "OpenIDM ready" openidm/logs/openidm0.log.0 ; do sleep 5; done' || cat openidm/logs/openidm0.log.0
138140
grep -q "OpenIDM ready" openidm/logs/openidm0.log.0
139-
! grep "ERROR" openidm/logs/openidm0.log.0
140-
! grep "SEVERE" openidm/logs/openidm0.log.0
141+
! grep -E "ERROR|SEVERE|Exception|Throwable" openidm/logs/openidm0.log.0
141142
- name: UI Smoke Tests (Playwright)
142143
run: |
143144
cd e2e
@@ -170,7 +171,23 @@ jobs:
170171
done
171172
else
172173
echo "openidm/logs directory not found"
174+
exit 0
173175
fi
176+
echo "----- Checking logs for errors/exceptions -----"
177+
status=0
178+
while IFS= read -r f; do
179+
if grep -E -n "ERROR|SEVERE|Exception|Throwable" "$f" > /tmp/log_errors.$$ 2>/dev/null; then
180+
echo "Found errors/exceptions in $f:"
181+
cat /tmp/log_errors.$$
182+
status=1
183+
fi
184+
rm -f /tmp/log_errors.$$
185+
done < <(find openidm/logs -type f)
186+
if [ "$status" -ne 0 ]; then
187+
echo "Errors or exceptions detected in openidm logs"
188+
exit 1
189+
fi
190+
echo "No errors or exceptions detected in openidm logs"
174191
build-docker:
175192
runs-on: 'ubuntu-latest'
176193
services:

0 commit comments

Comments
 (0)