|
13 | 13 | SPRING_BOOT_RELEASE_TAG_URL = "https://github.com/spring-projects/spring-boot/releases/tag/v{}" |
14 | 14 | SPRING_BOOT_RELEASE_API_URL = "https://api.github.com/repos/spring-projects/spring-boot/releases/tags/v{}" |
15 | 15 | EXTERNAL_DEPENDENCIES_FILE = "eng/versioning/external_dependencies.txt" |
| 16 | +SUPPORT_MATRIX_FILE = "sdk/spring/pipeline/spring-cloud-azure-supported-spring.json" |
16 | 17 | SPRING_VERSIONS_OUTPUT = "spring-versions.txt" |
17 | 18 | PR_DESCRIPTIONS_OUTPUT = "pr-descriptions.txt" |
18 | 19 |
|
@@ -59,17 +60,47 @@ def sort_versions_desc(versions): |
59 | 60 |
|
60 | 61 |
|
61 | 62 | def read_current_supported_versions(): |
| 63 | + # Prefer the support matrix because it reflects the current Spring compatibility target. |
62 | 64 | boot = None |
63 | 65 | cloud = None |
| 66 | + try: |
| 67 | + with open(SUPPORT_MATRIX_FILE, "r", encoding="utf-8") as f: |
| 68 | + entries = json.load(f) |
| 69 | + current_entries = [ |
| 70 | + e for e in entries |
| 71 | + if e.get("current") and e.get("supportStatus") == "SUPPORTED" |
| 72 | + ] |
| 73 | + if current_entries: |
| 74 | + current = current_entries[0] |
| 75 | + boot = current.get("spring-boot-version") |
| 76 | + cloud = current.get("spring-cloud-version") |
| 77 | + except (FileNotFoundError, json.JSONDecodeError, TypeError): |
| 78 | + pass |
| 79 | + |
| 80 | + if boot and cloud: |
| 81 | + return boot, cloud |
| 82 | + |
| 83 | + # Fallback to external dependencies for compatibility with older layouts. |
| 84 | + boot_candidates = { |
| 85 | + "org.springframework.boot:spring-boot-dependencies", |
| 86 | + "org.springframework.boot:spring-boot-starter-parent", |
| 87 | + "org.springframework.boot:spring-boot-starter", |
| 88 | + "org.springframework.boot:spring-boot-maven-plugin", |
| 89 | + } |
64 | 90 | with open(EXTERNAL_DEPENDENCIES_FILE, "r", encoding="utf-8") as f: |
65 | 91 | for line in f: |
66 | 92 | line = line.strip() |
67 | | - if line.startswith("org.springframework.boot:spring-boot-dependencies;"): |
68 | | - boot = line.split(";", 1)[1] |
69 | | - elif line.startswith("org.springframework.cloud:spring-cloud-dependencies;"): |
70 | | - cloud = line.split(";", 1)[1] |
| 93 | + if not line or line.startswith("#") or ";" not in line: |
| 94 | + continue |
| 95 | + artifact, version = line.split(";", 1) |
| 96 | + if artifact in boot_candidates and not boot: |
| 97 | + boot = version |
| 98 | + elif artifact == "org.springframework.cloud:spring-cloud-dependencies" and not cloud: |
| 99 | + cloud = version |
71 | 100 | if not boot or not cloud: |
72 | | - raise RuntimeError("Failed to read current Spring Boot/Cloud versions from external_dependencies.txt") |
| 101 | + raise RuntimeError( |
| 102 | + "Failed to read current Spring Boot/Cloud versions from support matrix and external_dependencies.txt" |
| 103 | + ) |
73 | 104 | return boot, cloud |
74 | 105 |
|
75 | 106 |
|
|
0 commit comments