Commit 32e1afe
authored
ci: move SonarCloud branch scans out of the merge queue, serialize per branch (erigontech#21669)
## Problem
SonarCloud rejects a branch analysis dated older than the branch's
latest processed one. Every merge-queue entry analyzes the target
branch, so when queue entry N's report uploads *after* entry N+1's,
SonarCloud rejects N's with *"Date of analysis cannot be older than the
date of the last known analysis"* and flips that commit's **SonarCloud
Code Analysis** check to `cancelled`.
Seen on
[`5027d259c2`](erigontech@5027d25):
three stacked queue entries (erigontech#21648, erigontech#21584, erigontech#21640) scanned
concurrently; erigontech#21584 started 6s later but uploaded 21s earlier, so
erigontech#21648's analysis was rejected as out of order. No impact on the gate
(the scan step is `continue-on-error` and the merge succeeded), but it
leaves a spurious failed check on a merged commit.
## Fix
Make it structurally impossible to submit branch analyses out of order:
- **`merge_group` runs** keep `make test-sonar-coverage` as a gate check
but **no longer scan**. They upload `coverage-test-all.out` as a 7-day
artifact.
- **A new `SonarCloud Branch Scan` workflow** (`push` on `main` +
`release/**`, matching the branches SonarCloud tracks) downloads that
artifact and runs **only the scanner** (~7 min vs ~25). The merge queue
fast-forwards the target branch to the already-tested merge commit, so
the pushed SHA equals the merge-queue run's head SHA and the artifact
maps to the commit exactly. If no artifact exists (direct push, or
expired retention), it falls back to running the tests itself.
- Branch scans are serialized per branch **FIFO** via
`concurrency.queue: max` ([GitHub Actions,
2026-05](https://github.blog/changelog/2026-05-07-github-actions-concurrency-groups-now-allow-larger-queues/)),
so every merged commit is analyzed, in order, with **no runs cancelled**
during merge bursts.
- **PR scans** (Sonar PR analyses — separate from main-branch date
ordering) and **cache-warming** runs are unchanged.
A failed analysis upload no longer touches the gate at all: scanner
failures now surface on a post-merge run, while PR runs keep exercising
the scanner so config/scanner breakage is still caught before merge.
## Notes
- `actionlint` (≤ v1.7.12, the latest release) does not know the `queue`
concurrency key yet, so `lint.yml` gets a narrow `--ignore` alongside
the existing `workspace` one. Removable once actionlint learns the key.
- `concurrency.queue: max` is ~1 month old — first real merge-burst
after this lands is where FIFO ordering gets exercised live.
## Testing
- `make lint`, `actionlint` (CI flags), and `zizmor` (repo config) all
clean; the new workflow is finding-free.
- The artifact-lookup script was shellchecked and run against live API
data: correctly resolves the merge-queue run by head SHA, filters
expired artifacts, and degrades to the test-running fallback on a
missing artifact or total API failure (never fails the job).1 parent 3ec49a3 commit 32e1afe
3 files changed
Lines changed: 91 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
37 | 76 | | |
38 | | - | |
| 77 | + | |
39 | 78 | | |
40 | 79 | | |
41 | 80 | | |
42 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
43 | 94 | | |
44 | 95 | | |
45 | 96 | | |
| |||
99 | 150 | | |
100 | 151 | | |
101 | 152 | | |
102 | | - | |
| 153 | + | |
103 | 154 | | |
104 | 155 | | |
105 | 156 | | |
| |||
111 | 162 | | |
112 | 163 | | |
113 | 164 | | |
114 | | - | |
| 165 | + | |
115 | 166 | | |
116 | 167 | | |
117 | 168 | | |
| |||
123 | 174 | | |
124 | 175 | | |
125 | 176 | | |
126 | | - | |
| 177 | + | |
127 | 178 | | |
128 | 179 | | |
129 | 180 | | |
130 | 181 | | |
131 | 182 | | |
132 | 183 | | |
133 | 184 | | |
134 | | - | |
| 185 | + | |
135 | 186 | | |
136 | 187 | | |
137 | 188 | | |
138 | | - | |
| 189 | + | |
139 | 190 | | |
140 | 191 | | |
141 | 192 | | |
| |||
0 commit comments