Commit c65c0bc
ci: add SonarQube analysis, quality gate and issue report
Mirrors the setup already running on hrms, qa-process-automation and
be-automation, adapted to this repo.
Placed between Verify Environment and Build, so the gate can actually stop a
release -- this pipeline deploys, unlike the QC automation jobs where the scan
runs after the work. Verify Environment still runs first so a missing .env
variable fails fast and cheaply, before a scan is spent, keeping the existing
"fail before anything is torn down" ordering intact.
- SonarQube Analysis: runs the sonar-scanner CLI via the official
sonarsource/sonar-scanner-cli image inside withSonarQubeEnv('MySonarQube').
The agent has Docker but no sonar-scanner on PATH and no SonarQube Scanner
tool installation, so the image avoids adding global tool config.
sonar.working.directory is redirected into the bind-mounted workspace: the
image's baked-in /tmp/.scannerwork is owned by uid 1000 and unwritable under
-u, and the override also lands report-task.txt where waitForQualityGate
looks for it.
- Quality Gate: waitForQualityGate(abortPipeline: true) inside a 5 minute
timeout, so a missed webhook cannot hold the deploy hostage.
- Fetch Sonar Issues / Publish Issue Report: paginates api/issues/search and
renders the result on the build page via warnings-ng. Both wrapped in
catchError(buildResult: 'UNSTABLE') so reporting cannot fail a deploy that
already passed the gate. The merged JSON keeps the top-level total/p/ps
fields, without which the warnings-ng parser fails format detection and
silently reports zero issues.
sonar-project.properties is new. This is a polyglot monorepo (282 Python, 266
TS, 188 TSX), so sources are listed explicitly to keep media_files/,
database-docker/ and docs/ out. backend/analytics_server/tests and
cli/source/__tests__ sit inside source roots, so they are excluded from main
and declared as tests instead -- without that the scan fails outright with
"file can't be indexed twice".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 119c779 commit c65c0bc
2 files changed
Lines changed: 143 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
69 | 167 | | |
70 | 168 | | |
71 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments