diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 86732b0..510248a 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -51,29 +51,38 @@ jobs: - name: Upload to Allure if: always() run: | - # Login und Cookie speichern + # Login und Cookies speichern 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 aus Cookie extrahieren + 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 - + -d '{"id":"'${ALLURE_PROJECT}'"}' || true + # Clean results - curl -s -b cookies.txt \ + 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 for f in target/allure-results/*; do - [ -f "$f" ] && curl -s -b cookies.txt \ + [ -f "$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" done - + # Generate report curl -s -b cookies.txt \ - "${ALLURE_SERVER}/allure-docker-service/generate-report?project_id=${ALLURE_PROJECT}" \ No newline at end of file + -H "X-CSRF-TOKEN: ${CSRF_TOKEN}" \ + "${ALLURE_SERVER}/allure-docker-service/generate-report?project_id=${ALLURE_PROJECT}" + + echo "Allure upload complete" \ No newline at end of file