@@ -40,30 +40,46 @@ jobs:
4040 from pathlib import Path
4141
4242 def get_spring_boot_versions():
43- """Fetch all Spring Boot versions from Maven Central"""
43+ """Fetch all Spring Boot versions from Maven Central with retry logic """
4444 url = "https://search.maven.org/solrsearch/select"
4545 params = {
4646 "q": "g:org.springframework.boot AND a:spring-boot",
4747 "rows": 200,
4848 "wt": "json"
4949 }
5050
51- try:
52- response = requests.get(url, params=params, timeout=30)
53- response.raise_for_status()
54- data = response.json()
55-
56- versions = []
57- for doc in data['response']['docs']:
58- v = doc['v']
59- # Only include release versions (no SNAPSHOT, RC, M versions for 2.x and 3.x)
60- if not any(suffix in v for suffix in ['SNAPSHOT', 'RC', 'BUILD']):
61- versions.append(v)
62-
63- return sorted(versions, key=version.parse)
64- except Exception as e:
65- print(f"Error fetching versions: {e}")
66- return []
51+ max_retries = 3
52+ timeout = 60 # Increased timeout
53+
54+ for attempt in range(max_retries):
55+ try:
56+ print(f"Fetching versions (attempt {attempt + 1}/{max_retries})...")
57+ response = requests.get(url, params=params, timeout=timeout)
58+ response.raise_for_status()
59+ data = response.json()
60+
61+ versions = []
62+ for doc in data['response']['docs']:
63+ v = doc['v']
64+ # Only include release versions (no SNAPSHOT, RC, M versions for 2.x and 3.x)
65+ if not any(suffix in v for suffix in ['SNAPSHOT', 'RC', 'BUILD']):
66+ versions.append(v)
67+
68+ print(f"Successfully fetched {len(versions)} versions")
69+ return sorted(versions, key=version.parse)
70+ except requests.exceptions.Timeout as e:
71+ print(f"Attempt {attempt + 1} timed out: {e}")
72+ if attempt < max_retries - 1:
73+ print("Retrying...")
74+ continue
75+ except Exception as e:
76+ print(f"Attempt {attempt + 1} failed: {e}")
77+ if attempt < max_retries - 1:
78+ print("Retrying...")
79+ continue
80+
81+ print("All attempts failed")
82+ return []
6783
6884 def parse_current_versions(workflow_file):
6985 """Parse current Spring Boot versions from workflow file"""
0 commit comments