Commit bc3de2b
authored
fix(deploy): collect the right Pull Request scope for deployment actions and Apex test classes on every merge (#2054)
* fix(deploy): scope deployment actions and Apex test classes to the merged Pull Request
Merging a feature branch into a major branch reported and executed the
deployment actions of every other Pull Request of the batch, because
listAllPullRequestsForCurrentScope discards the merged Pull Request in
deployment mode and re-derives the scope from the branch strategy. One feature
merge could therefore run an action belonging to another Pull Request, and
attribute it to the wrong one in the Slack notification and in the Pull Request
comment.
The scope is now the merged Pull Request alone when its source branch is
neither a major branch nor a retrofit branch. A merge between major branches,
or from a retrofit branch, keeps collecting the batch, because those carry the
Pull Requests merged into the source major branch since its last promotion.
The scoping happens at collection time, so deployment actions, the Apex test
classes selected from Pull Requests, the deployment notification, the Pull
Request comment and the per-PR "Deployment Actions" state comment all follow it
without any of them needing a filter of their own.
Side effect worth noting: the single Pull Request scope no longer depends on
mergeTargets being configured. A feature merge into a major branch whose config
declares no merge target used to collect nothing at all, silently dropping the
merged Pull Request's own actions.
* [MegaLinter] Apply linters fixes
* fix(deploy): run deployment actions on go-live merges, retrofitted upstream PRs and GitHub push deploys (#2055)
* fix(deploy): run deployment actions on go-live merges, retrofitted upstream PRs and GitHub push deploys
Three holes in the Pull Request scope collection prevented deployment actions
and selected Apex test classes from running in major orgs where they had not
been performed yet.
Production merges collected nothing. The batch window is anchored on the
target branch's mergeTargets, and a production branch has none, so a
preprod -> main merge returned an empty scope: no action ran and no test class
was selected on the go-live deployment. The scope is now the batch of Pull
Requests carried by the go-live merge itself, through the existing
listPullRequestsInGoLive provider method, bounded by the merge commit's first
parent. When the merge commit is unknown, the scope falls back to the merged
Pull Request alone instead of nothing.
Upstream Pull Requests were invisible to retrofits. The window collectors only
fetched Pull Requests whose base is the window branch or one of its children,
so a hotfix merged into main was never collected when a retrofit branch
brought its commits down to integration. Every major branch is now part of the
search list: matching stays bounded by the window's commit SHAs, so an
upstream Pull Request is only collected when its merge commit actually arrived
in the window.
GitHub push-triggered deployments never entered the engine at all. Without a
Pull Request number, the GraphQL commit lookup selected neither the head and
base ref names nor the merge commit, so the resolved Pull Request had empty
source and target branches and the scope resolution bailed out immediately.
The query now selects them and maps the node to the shape the common Pull
Request info builder reads, which also fixes the empty author and web URL.
* docs(deploy): correct the search-branches example comment in listAllPullRequestsForCurrentScope
---------
Co-authored-by: nvuillam <17500430+nvuillam@users.noreply.github.com>1 parent 538ec96 commit bc3de2b
19 files changed
Lines changed: 327 additions & 23 deletions
File tree
- docs
- hardis/project/deploy
- sources
- src
- commands/hardis/project/deploy
- common
- gitProvider
- utils
- i18n
- test/common/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
377 | 381 | | |
378 | 382 | | |
379 | 383 | | |
| |||
395 | 399 | | |
396 | 400 | | |
397 | 401 | | |
398 | | - | |
399 | | - | |
| 402 | + | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| |||
416 | 420 | | |
417 | 421 | | |
418 | 422 | | |
| 423 | + | |
| 424 | + | |
419 | 425 | | |
420 | 426 | | |
421 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
92 | 114 | | |
93 | 115 | | |
94 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
209 | 213 | | |
210 | 214 | | |
211 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
306 | 313 | | |
307 | 314 | | |
308 | 315 | | |
| |||
333 | 340 | | |
334 | 341 | | |
335 | 342 | | |
336 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
337 | 358 | | |
338 | 359 | | |
339 | 360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
275 | 288 | | |
276 | 289 | | |
277 | 290 | | |
| |||
0 commit comments