Add cloud-2026-upgrade: step-by-step upgrade of the shop to Spring Boot 4.2.0 / Spring Cloud 2026.0.0, with probes
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""List what the spring-cloud-dependencies BOM manages in two release trains and print the difference.
|
||||
Usage: bom-diff.py OLD NEW (e.g. bom-diff.py 2025.1.5 2026.0.0). Set MAVEN_REPO to use another repository."""
|
||||
import os, re, sys, time, urllib.request
|
||||
import xml.etree.ElementTree as ET
|
||||
REPO = os.environ.get("MAVEN_REPO", "https://repo1.maven.org/maven2").rstrip("/")
|
||||
NS = "{http://maven.apache.org/POM/4.0.0}"
|
||||
cache = {}
|
||||
|
||||
def pom(g, a, v):
|
||||
key = (g, a, v)
|
||||
if key not in cache:
|
||||
url = f"{REPO}/{g.replace('.', '/')}/{a}/{v}/{a}-{v}.pom"
|
||||
for attempt in range(5):
|
||||
try:
|
||||
cache[key] = ET.fromstring(urllib.request.urlopen(url, timeout=30).read()); break
|
||||
except Exception:
|
||||
if attempt == 4: raise
|
||||
time.sleep(5 * (attempt + 1))
|
||||
return cache[key]
|
||||
|
||||
def managed(g, a, v, props=None, out=None):
|
||||
"""Collect groupId:artifactId -> version from a BOM, following imported BOMs and the parent POM's properties."""
|
||||
out = {} if out is None else out
|
||||
root = pom(g, a, v)
|
||||
p = {}
|
||||
parent = root.find(NS + "parent")
|
||||
chain = []
|
||||
while parent is not None:
|
||||
pr = pom(*(parent.findtext(NS + k) for k in ("groupId", "artifactId", "version")))
|
||||
chain.append(pr); parent = pr.find(NS + "parent")
|
||||
for doc in reversed(chain):
|
||||
for e in doc.findall(NS + "properties/*"): p[e.tag.replace(NS, "")] = (e.text or "").strip()
|
||||
for e in root.findall(NS + "properties/*"): p[e.tag.replace(NS, "")] = (e.text or "").strip()
|
||||
p.update(props or {})
|
||||
p["project.version"] = v; p["project.groupId"] = g
|
||||
def sub(s):
|
||||
for _ in range(5): s = re.sub(r"\$\{([^}]+)\}", lambda m: p.get(m.group(1), m.group(0)), s)
|
||||
return s
|
||||
for d in root.findall(f"{NS}dependencyManagement/{NS}dependencies/{NS}dependency"):
|
||||
dg, da, dv = (sub(d.findtext(NS + k, "").strip()) for k in ("groupId", "artifactId", "version"))
|
||||
if d.findtext(NS + "scope") == "import":
|
||||
managed(dg, da, dv, None, out)
|
||||
elif dg.startswith("org.springframework.cloud"):
|
||||
out.setdefault(f"{dg}:{da}", dv)
|
||||
return out
|
||||
|
||||
old, new = sys.argv[1], sys.argv[2]
|
||||
o = managed("org.springframework.cloud", "spring-cloud-dependencies", old)
|
||||
n = managed("org.springframework.cloud", "spring-cloud-dependencies", new)
|
||||
print(f"# org.springframework.cloud artifacts managed by spring-cloud-dependencies {old} vs {new}")
|
||||
print(f"managed in {old}: {len(o)} managed in {new}: {len(n)}")
|
||||
for title, keys, src in (("REMOVED", sorted(set(o) - set(n)), o), ("ADDED", sorted(set(n) - set(o)), n)):
|
||||
print(f"\n{title} ({len(keys)})")
|
||||
for k in keys:
|
||||
print(f" {k}:{src[k]}")
|
||||
if title == "REMOVED":
|
||||
g, a = k.split(":")
|
||||
try: pom(g, a, src[k]); print(" (that version's POM is published)")
|
||||
except Exception as e: print(f" (but that version's POM is NOT in the repository: {getattr(e, 'code', e)})")
|
||||
Reference in New Issue
Block a user