batch upload allure

This commit is contained in:
Jan 2026-02-08 20:20:22 +01:00
parent 8f7b132dd4
commit 9b958696b4

View file

@ -51,44 +51,39 @@ jobs:
- name: Upload to Allure
if: always()
run: |
# Debug: Check if results exist
echo "=== Allure results directory ==="
ls -la target/allure-results/ || echo "Directory not found"
# Login
curl -s -c cookies.txt \
-X POST "${ALLURE_SERVER}/allure-docker-service/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"${{ secrets.ALLURE_PASSWORD }}"}'
CSRF_TOKEN=$(grep csrf_access_token cookies.txt | awk '{print $7}')
# Create project
curl -s -o /dev/null -b cookies.txt \
-H "X-CSRF-TOKEN: ${CSRF_TOKEN}" \
-X POST "${ALLURE_SERVER}/allure-docker-service/projects" \
-H "Content-Type: application/json" \
-d '{"id":"'${ALLURE_PROJECT}'"}' || true
# Clean old results
curl -s -o /dev/null -b cookies.txt \
-H "X-CSRF-TOKEN: ${CSRF_TOKEN}" \
"${ALLURE_SERVER}/allure-docker-service/clean-results?project_id=${ALLURE_PROJECT}"
# Upload files with debug
FILE_COUNT=0
# Upload ALL files in one request
FILES=""
for f in target/allure-results/*; do
if [ -f "$f" ]; then
echo "Uploading: $f"
curl -s -o /dev/null -b cookies.txt \
-H "X-CSRF-TOKEN: ${CSRF_TOKEN}" \
-X POST "${ALLURE_SERVER}/allure-docker-service/send-results?project_id=${ALLURE_PROJECT}" \
-F "results[]=@$f"
FILE_COUNT=$((FILE_COUNT + 1))
fi
[ -f "$f" ] && FILES="$FILES -F results[]=@$f"
done
echo "Uploaded ${FILE_COUNT} files"
curl -s -o /dev/null -b cookies.txt \
-H "X-CSRF-TOKEN: ${CSRF_TOKEN}" \
-X POST "${ALLURE_SERVER}/allure-docker-service/send-results?project_id=${ALLURE_PROJECT}" \
$FILES
echo "Uploaded files"
# Generate report
curl -s -b cookies.txt \
-H "X-CSRF-TOKEN: ${CSRF_TOKEN}" \