From 9b958696b4b36f287eb9fb9002fc19d9939ad3a4 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 8 Feb 2026 20:20:22 +0100 Subject: [PATCH] batch upload allure --- .gitea/workflows/test.yml | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index d6e1ad6..2823e0a 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -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}" \