MCPcopy
hub / github.com/saltstack/salt / get_testing_releases

Function get_testing_releases

tools/ci.py:321–364  ·  view source on GitHub ↗

Get a list of releases to use for the upgrade and downgrade tests.

(
    ctx: Context,
    releases: list[tools.utils.Version],
    salt_version: str = None,
)

Source from the content-addressed store, hash-verified

319 },
320)
321def get_testing_releases(
322 ctx: Context,
323 releases: list[tools.utils.Version],
324 salt_version: str = None,
325):
326 """
327 Get a list of releases to use for the upgrade and downgrade tests.
328 """
329 parsed_salt_version = tools.utils.Version(salt_version)
330 # We want the latest 4 major versions, removing the oldest if this version is a new major
331 num_major_versions = 4
332 if parsed_salt_version.minor == 0:
333 num_major_versions = 3
334 majors = sorted(
335 list(
336 {
337 # We aren't testing upgrades from anything before 3006.0
338 # and we don't want to test 3007.? on the 3006.x branch
339 version.major
340 for version in releases
341 if version.major > 3005 and version.major <= parsed_salt_version.major
342 }
343 )
344 )[-num_major_versions:]
345 testing_releases = []
346 # Append the latest minor for each major that is older than the current version
347 for major in majors:
348 minors_of_major = [version for version in releases if version.major == major]
349 latest_minor = minors_of_major[-1]
350 # Only include versions older than current to prevent version paradox
351 # (e.g., don't test upgrading FROM 3007.10 TO 3007.9+dev)
352 if latest_minor < parsed_salt_version:
353 testing_releases.append(latest_minor)
354
355 str_releases = [str(version) for version in testing_releases]
356
357 ctx.info("Testing Releases:", sorted(str_releases))
358
359 github_output = os.environ.get("GITHUB_OUTPUT")
360 if github_output is not None:
361 with open(github_output, "a", encoding="utf-8") as wfh:
362 wfh.write(f"testing-releases={json.dumps(str_releases)}\n")
363
364 ctx.exit(0)
365
366
367@ci.command(

Callers

nothing calls this directly

Calls 8

exitMethod · 0.80
listFunction · 0.50
openFunction · 0.50
appendMethod · 0.45
infoMethod · 0.45
getMethod · 0.45
writeMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected