ci(bstein-home): publish metrics even when test stages fail

This commit is contained in:
Brad Stein 2026-04-19 15:37:06 -03:00
parent 7d7c719fc7
commit e9a4218ae9

15
Jenkinsfile vendored
View File

@ -52,7 +52,7 @@ spec:
- name: workspace-volume - name: workspace-volume
mountPath: /home/jenkins/agent mountPath: /home/jenkins/agent
- name: frontend - name: frontend
image: mcr.microsoft.com/playwright:v1.51.0-jammy image: mcr.microsoft.com/playwright:v1.59.1-jammy
command: ["cat"] command: ["cat"]
tty: true tty: true
volumeMounts: volumeMounts:
@ -253,7 +253,11 @@ PY
mkdir -p build mkdir -p build
export PYTHONPATH="${WORKSPACE}/backend:${PYTHONPATH:-}" export PYTHONPATH="${WORKSPACE}/backend:${PYTHONPATH:-}"
python -m pip install --no-cache-dir -r backend/requirements.txt -r backend/requirements-dev.txt python -m pip install --no-cache-dir -r backend/requirements.txt -r backend/requirements-dev.txt
set +e
python -m pytest backend/tests -q --cov=backend/atlas_portal --cov-report=xml:build/backend-coverage.xml --junitxml=build/junit-backend.xml python -m pytest backend/tests -q --cov=backend/atlas_portal --cov-report=xml:build/backend-coverage.xml --junitxml=build/junit-backend.xml
backend_rc=$?
set -e
printf '%s\n' "${backend_rc}" > build/backend-tests.rc
''' '''
} }
} }
@ -266,11 +270,15 @@ PY
set -euo pipefail set -euo pipefail
mkdir -p build mkdir -p build
cd frontend cd frontend
set +e
npm ci npm ci
npm run lint npm run lint
npm run test:unit npm run test:unit
npm run test:component npm run test:component
npm run test:e2e npm run test:e2e
frontend_rc=$?
set -e
printf '%s\n' "${frontend_rc}" > ../build/frontend-tests.rc
''') ''')
} }
} }
@ -288,6 +296,11 @@ npm run test:e2e
--frontend-coverage frontend/coverage/coverage-summary.json \ --frontend-coverage frontend/coverage/coverage-summary.json \
--report build/quality-gate.json --report build/quality-gate.json
gate_rc=$? gate_rc=$?
backend_rc="$(cat build/backend-tests.rc 2>/dev/null || echo 1)"
frontend_rc="$(cat build/frontend-tests.rc 2>/dev/null || echo 1)"
if [ "${backend_rc}" -ne 0 ] || [ "${frontend_rc}" -ne 0 ]; then
gate_rc=1
fi
set -e set -e
printf '%s\n' "${gate_rc}" > build/quality-gate.rc printf '%s\n' "${gate_rc}" > build/quality-gate.rc
''' '''