2 Commits

Author SHA1 Message Date
8d47c0c378 [NX-501 Issue] Add wait for PostgreSQL in e2e API smoke workflow
Some checks failed
Container CVE Scan (development) / Scan backend/frontend images for CVEs (push) Successful in 2m20s
E2E API Smoke / Core API E2E Smoke (push) Failing after 2m8s
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 7s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 8s
This change introduces a step in the e2e API smoke workflow to wait for PostgreSQL readiness before executing further steps. It retries the connection multiple times to ensure the database is available, reducing potential errors caused by service unavailability.
2026-02-15 20:07:35 +01:00
7f7cf9179f Remove Trivy scans from container CVE scan workflow
Trivy-based scanning steps and their summaries have been removed from the GitHub Actions workflow. This change focuses on streamlining the workflow by reducing redundancy and relying on alternate scanning methods.
2026-02-15 20:04:20 +01:00
2 changed files with 26 additions and 46 deletions

View File

@@ -55,50 +55,6 @@ jobs:
provenance: false
sbom: false
- name: Trivy scan (backend)
uses: aquasecurity/trivy-action@0.24.0
with:
image-ref: nexapg-backend:dev-scan
format: json
output: trivy-backend.json
severity: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
ignore-unfixed: false
exit-code: 0
- name: Trivy scan (frontend)
uses: aquasecurity/trivy-action@0.24.0
with:
image-ref: nexapg-frontend:dev-scan
format: json
output: trivy-frontend.json
severity: UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
ignore-unfixed: false
exit-code: 0
- name: Summarize Trivy severities
run: |
python - <<'PY'
import json
from collections import Counter
def summarize(path):
c = Counter()
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
for result in data.get("Results", []):
for v in result.get("Vulnerabilities", []) or []:
c[v.get("Severity", "UNKNOWN")] += 1
for sev in ["CRITICAL", "HIGH", "MEDIUM", "LOW", "UNKNOWN"]:
c.setdefault(sev, 0)
return c
for label, path in [("backend", "trivy-backend.json"), ("frontend", "trivy-frontend.json")]:
s = summarize(path)
print(f"===== Trivy {label} =====")
print(f"CRITICAL={s['CRITICAL']} HIGH={s['HIGH']} MEDIUM={s['MEDIUM']} LOW={s['LOW']} UNKNOWN={s['UNKNOWN']}")
print()
PY
- name: Docker Scout scan (backend)
continue-on-error: true
run: |
@@ -152,7 +108,5 @@ jobs:
with:
name: container-cve-scan-reports
path: |
trivy-backend.json
trivy-frontend.json
scout-backend.txt
scout-frontend.txt

View File

@@ -68,6 +68,32 @@ jobs:
pip install -r backend/requirements.txt
pip install pytest
- name: Wait for PostgreSQL service
run: |
python - <<'PY'
import asyncio
import asyncpg
async def wait_for_db():
dsn = "postgresql://nexapg:nexapg@127.0.0.1:5432/nexapg?sslmode=disable"
last_err = None
for attempt in range(1, 61):
try:
conn = await asyncpg.connect(dsn=dsn, timeout=3)
try:
await conn.execute("SELECT 1")
finally:
await conn.close()
print(f"PostgreSQL ready after {attempt} attempt(s).")
return
except Exception as exc:
last_err = exc
await asyncio.sleep(2)
raise RuntimeError(f"PostgreSQL not ready after retries: {last_err}")
asyncio.run(wait_for_db())
PY
- name: Run Alembic migrations
working-directory: backend
run: alembic upgrade head