Commit 0f47fd3
Cleanup and fix the GeneratePackageVersions (#8478)
## Summary of changes
This goes back through the recent changes (#8371 and #8340) to
`GeneratePackageVersions` and attempts to do some removals,
refactorings, and fixes that have come up. Notably this removes the
`nuget_cache`, fixes `IncludePackages` (again 😅), and rewrites the
cooldown logic to not use `supported_versions.json` and `nuget_cache`
and instead reads from the `.g.cs` files in addition to refactoring the
verbage used throughout.
## Reason for change
While working on (#8128) I started running into several issues with
`GeneratePackageVersions` namely that I couldn't get `IncludePackages`
to work and then I started fighting issues with the `nuget_cache` as
well when attempting to add a new integration.
This sets out to do a few things:
- Simplify the logic for NuGet cooldown (automated dependency updates
must adhere to our current cooldown policy for potential supply chain
attacks)
- Remove the `nuget_cache` - this was added so that we wouldn't go and
query NuGet info for packages not listed in the `IncludePackages`
- Change the "verbage" of the cooldown/baseline to be easier to read /
follow
- Do NOT read / rely upon `supported_versions` (this is what I
previously used to determine what the highest version was currently
allowed) - this file is planned to be changed/modified/removed by
another team in the near future hence why we shouldn't use it.
- I didn't account for different timezones in the publish state of the
`nuget_cache` before so if someone ran it depending on their locale it
would change.
## Implementation details
- New `CooldownMode` `enum`: `Normal`, `BypassCooldown`, `Freeze`
- Normal drops recent versions that are above the previous max
- BypassCooldown accepts all in-range versions (no cooldown) (when
`IncludePackages` is used is an example)
- Freeze re-emits the previous run's output verbatim
- `XUnitFileGenerator.LoadExistingVersions` reads the previous `.g.cs`
and returns `Dictionary<IntegrationName, List<(Framework, Versions)>>`.
`PackageGroup` loads this once and exposes `TryGetFrozenVersions`
- I think we should probably still try and do something different here
but this seems a bit more reasonable
- Deleted `nuget_version_cache.json` and `NuGetVersionCache.cs`
- No longer used/needed
- Some readability improvements
- `IsWithinCooldown` → `WasPublishedTooRecently`
- `baseline` → `previousMaxVersions`
- `ApplyCooldown` now uses two named local booleans
(`publishedTooRecently`, `atOrBelowPreviousMax`) so the drop condition
reads positively: "drop the version if it was published too recently
**and** we haven't already shipped against it."
## Test coverage
I ran it locally for a handful of cases I think it is better.
## Other details
<!-- Fixes #{issue} -->
I have ran through several instances with this and it _seems_ to be
good, basically default runs, runs with configurable cooldowns, runs
with `IncludePackages` and runs with `ExcludePackages`. All appeared as
expected to me.
<!-- 1 parent 3ee5618 commit 0f47fd3
7 files changed
Lines changed: 300 additions & 57357 deletions
File tree
- tracer/build
- _build
- GeneratePackageVersions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
240 | 245 | | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
250 | 269 | | |
251 | 270 | | |
252 | 271 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 272 | + | |
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
272 | | - | |
| 276 | + | |
273 | 277 | | |
274 | | - | |
275 | 278 | | |
276 | 279 | | |
277 | | - | |
| 280 | + | |
278 | 281 | | |
279 | 282 | | |
280 | 283 | | |
281 | 284 | | |
282 | 285 | | |
283 | | - | |
284 | | - | |
| 286 | + | |
| 287 | + | |
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
| |||
290 | 293 | | |
291 | 294 | | |
292 | 295 | | |
293 | | - | |
| 296 | + | |
294 | 297 | | |
295 | | - | |
| 298 | + | |
296 | 299 | | |
297 | 300 | | |
298 | | - | |
| 301 | + | |
299 | 302 | | |
300 | 303 | | |
301 | 304 | | |
| |||
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
328 | | - | |
329 | 331 | | |
330 | | - | |
| 332 | + | |
331 | 333 | | |
332 | 334 | | |
333 | | - | |
334 | | - | |
| 335 | + | |
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
| |||
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
350 | | - | |
| 351 | + | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| |||
Lines changed: 33 additions & 0 deletions
| 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 | + | |
Lines changed: 6 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 34 | + | |
41 | 35 | | |
42 | 36 | | |
43 | 37 | | |
| |||
53 | 47 | | |
54 | 48 | | |
55 | 49 | | |
56 | | - | |
57 | | - | |
| 50 | + | |
| 51 | + | |
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
61 | | - | |
| 55 | + | |
62 | 56 | | |
63 | 57 | | |
64 | 58 | | |
65 | | - | |
66 | 59 | | |
67 | | - | |
| 60 | + | |
68 | 61 | | |
69 | 62 | | |
70 | 63 | | |
| |||
84 | 77 | | |
85 | 78 | | |
86 | 79 | | |
87 | | - | |
88 | | - | |
| 80 | + | |
89 | 81 | | |
Lines changed: 0 additions & 60 deletions
This file was deleted.
0 commit comments