Skip to content

Commit d6b71fb

Browse files
committed
Fix Copilot review issues in Spring update automation
1 parent 7a63afb commit d6b71fb

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

.github/workflows/test-spring-boot-rc-version.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,38 @@ jobs:
6969
git config --global user.name github-actions
7070
git add -A
7171
git commit -m "Upgrade external dependencies to align with Spring Boot ${{ env.spring_boot_version }}"
72-
sed -i "s/NONE_SUPPORTED_SPRING_CLOUD_VERSION/${spring_cloud_version}/g" "./sdk/spring/pipeline/spring-cloud-azure-supported-spring.json"
72+
python - <<'PY'
73+
import json
74+
from pathlib import Path
75+
76+
spring_boot_version = "${{ env.spring_boot_version }}"
77+
spring_cloud_version = "${{ env.spring_cloud_version }}"
78+
placeholder = "NONE_SUPPORTED_SPRING_CLOUD_VERSION"
79+
matrix_path = Path("./sdk/spring/pipeline/spring-cloud-azure-supported-spring.json")
80+
81+
with matrix_path.open("r", encoding="utf-8") as f:
82+
entries = json.load(f)
83+
84+
updated = False
85+
for entry in entries:
86+
if (
87+
entry.get("spring-boot-version") == spring_boot_version
88+
and entry.get("spring-cloud-version") == placeholder
89+
):
90+
entry["spring-cloud-version"] = spring_cloud_version
91+
updated = True
92+
break
93+
94+
if not updated:
95+
raise SystemExit(
96+
"Did not find RC support-matrix entry for "
97+
f"spring-boot-version={spring_boot_version} with placeholder cloud version"
98+
)
99+
100+
with matrix_path.open("w", encoding="utf-8") as f:
101+
json.dump(entries, f, indent=2)
102+
f.write("\n")
103+
PY
73104
git add ./sdk/spring/pipeline/spring-cloud-azure-supported-spring.json
74105
git commit -m "Upgrade spring-cloud-azure-supported-spring"
75106
git push origin "HEAD:${{ env.update_branch }}"

sdk/spring/scripts/generate_spring_versions_and_pr_description.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ def main():
203203
latest_rc = sort_versions_desc(rc_versions)[0] if rc_versions else None
204204

205205
current_boot, current_cloud = read_current_supported_versions()
206-
is_new_ga = latest_ga is not None and compare_versions(latest_ga, current_boot) != 0
207-
is_new_rc = latest_rc is not None and compare_versions(latest_rc, current_boot) != 0
206+
is_new_ga = latest_ga is not None and compare_versions(latest_ga, current_boot) > 0
207+
is_new_rc = latest_rc is not None and compare_versions(latest_rc, current_boot) > 0
208208

209209
if not is_new_ga and not is_new_rc:
210210
return
@@ -253,6 +253,8 @@ def main():
253253
try:
254254
target_cloud = find_compatible_spring_cloud_version(target_boot, spring_cloud_ranges)
255255
except RuntimeError:
256+
if latest_ga is None:
257+
raise
256258
target_cloud = find_compatible_spring_cloud_version(latest_ga, spring_cloud_ranges)
257259

258260
write_outputs(target_boot, target_cloud, current_boot, current_cloud, release_notes_html(target_boot))

0 commit comments

Comments
 (0)