mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
handles the case grep doesn't match, otherwise the script exits with 1 (error)
This commit is contained in:
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -51,13 +51,12 @@ jobs:
|
|||||||
run: sudo systemctl restart apache2.service
|
run: sudo systemctl restart apache2.service
|
||||||
- name: Search for errors/warnings in error log
|
- name: Search for errors/warnings in error log
|
||||||
run: |
|
run: |
|
||||||
errors=$(grep -E ':(?error|warn)[]]' /var/log/apache2/error.log)
|
# '|| :' handles the case grep doesn't match, otherwise the script exits with 1 (error)
|
||||||
if [[ -n "${errors}" ]]; then
|
errors=$(grep -E ':(?error|warn)[]]' /var/log/apache2/error.log) || :
|
||||||
|
if [[ -z "${errors}" ]]; then exit 0; fi
|
||||||
echo "Found errors/warnings in error.log"
|
echo "Found errors/warnings in error.log"
|
||||||
echo "${errors}"
|
echo "${errors}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
- name: Show httpd error log
|
- name: Show httpd error log
|
||||||
if: always()
|
if: always()
|
||||||
run: sudo cat /var/log/apache2/error.log
|
run: sudo cat /var/log/apache2/error.log
|
||||||
|
Reference in New Issue
Block a user