Update test_docker.yml

nginx & haproxy tests temp removed
This commit is contained in:
fab 2025-01-17 12:02:39 +01:00 committed by GitHub
parent 4eccf10943
commit ddb39751e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -112,48 +112,48 @@ jobs:
echo "Checking Apache container logs..."
sudo docker logs apache-waf
- name: Validate HAProxy configuration
run: |
echo "Validating HAProxy configuration..."
for file in waf_patterns/haproxy/*.acl; do
echo "Validating $file..."
# Create a temporary haproxy.cfg file to include the ACL
echo "global" > temp_haproxy.cfg
echo " log stdout format raw local0" >> temp_haproxy.cfg
echo "defaults" >> temp_haproxy.cfg
echo " log global" >> temp_haproxy.cfg
echo " timeout connect 10s" >> temp_haproxy.cfg
echo " timeout client 30s" >> temp_haproxy.cfg
echo " timeout server 30s" >> temp_haproxy.cfg
echo "frontend test" >> temp_haproxy.cfg
echo " bind *:${{ env.HAPROXY_PORT }}" >> temp_haproxy.cfg
echo " default_backend test_backend" >> temp_haproxy.cfg
echo " $(cat "$file")" >> temp_haproxy.cfg
echo "backend test_backend" >> temp_haproxy.cfg
echo " server s1 127.0.0.1:${{ env.NGINX_PORT }}" >> temp_haproxy.cfg
# - name: Validate HAProxy configuration
# run: |
# echo "Validating HAProxy configuration..."
# for file in waf_patterns/haproxy/*.acl; do
# echo "Validating $file..."
# # Create a temporary haproxy.cfg file to include the ACL
# echo "global" > temp_haproxy.cfg
# echo " log stdout format raw local0" >> temp_haproxy.cfg
# echo "defaults" >> temp_haproxy.cfg
# echo " log global" >> temp_haproxy.cfg
# echo " timeout connect 10s" >> temp_haproxy.cfg
# echo " timeout client 30s" >> temp_haproxy.cfg
# echo " timeout server 30s" >> temp_haproxy.cfg
# echo "frontend test" >> temp_haproxy.cfg
# echo " bind *:${{ env.HAPROXY_PORT }}" >> temp_haproxy.cfg
# echo " default_backend test_backend" >> temp_haproxy.cfg
# echo " $(cat "$file")" >> temp_haproxy.cfg
# echo "backend test_backend" >> temp_haproxy.cfg
# echo " server s1 127.0.0.1:${{ env.NGINX_PORT }}" >> temp_haproxy.cfg
#
# # Validate the file using haproxy -c
# sudo docker run --rm -v $(pwd)/temp_haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg
# if [ $? -ne 0 ]; then
# echo "Error: Validation failed for $file"
# exit 1
# fi
# done
# Validate the file using haproxy -c
sudo docker run --rm -v $(pwd)/temp_haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro haproxy haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg
if [ $? -ne 0 ]; then
echo "Error: Validation failed for $file"
exit 1
fi
done
- name: Start HAProxy container with WAF rules
run: |
echo "Starting HAProxy container..."
sudo docker run -d \
--name haproxy-waf \
-p ${{ env.HAPROXY_PORT }}:80 \
-v $(pwd)/waf_patterns/haproxy:/usr/local/etc/haproxy \
haproxy:latest
echo "HAProxy is running on port ${{ env.HAPROXY_PORT }}."
- name: Check HAProxy container logs
run: |
echo "Checking HAProxy container logs..."
sudo docker logs haproxy-waf
# - name: Start HAProxy container with WAF rules
# run: |
# echo "Starting HAProxy container..."
# sudo docker run -d \
# --name haproxy-waf \
# -p ${{ env.HAPROXY_PORT }}:80 \
# -v $(pwd)/waf_patterns/haproxy:/usr/local/etc/haproxy \
# haproxy:latest
# echo "HAProxy is running on port ${{ env.HAPROXY_PORT }}."
#
# - name: Check HAProxy container logs
# run: |
# echo "Checking HAProxy container logs..."
# sudo docker logs haproxy-waf
- name: Validate Traefik configuration
run: |