Skip to content

Commit d67d36e

Browse files
authored
Migrate release endpoint (#98)
This pull request updates the source URL used to fetch Elasticsearch release data across multiple implementations in the codebase. The main change is switching from the legacy `https://artifacts.elastic.co/releases/stack.json` endpoint to the new `https://ela.st/past-stack-releases` endpoint, ensuring consistent and up-to-date data retrieval for Elasticsearch versions. **Endpoint update for Elasticsearch release data:** * Python (`main.py`): Changed the fetch URL in `get_latest_elasticsearch_version` to use the new endpoint. * .NET (`Program.cs`): Updated the HTTP request in `GetLatestVersion` to use the new URL. * Java (`ElasticsearchTools.java`): Modified the `WebClient` request to point to the new endpoint. * JavaScript (`index.js`): Updated the fetch call in `getLatestElasticsearchVersion` to use the new URL. **Test and cassette updates:** * YAML cassette (`test_main.yaml`): Updated both the request URI and the returned manifest field to reflect the new endpoint, ensuring test coverage matches the production change. [[1]](diffhunk://#diff-55217b7d75be834356ba5990e38ad0c928e8e3175f51c9c52f19527b5eb80ee2L185-R185) [[2]](diffhunk://#diff-55217b7d75be834356ba5990e38ad0c928e8e3175f51c9c52f19527b5eb80ee2L2444-R2444)
1 parent ca0a5b9 commit d67d36e

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

genai-function-calling/openai-agents/cassettes/test_main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ interactions:
182182
user-agent:
183183
- python-httpx/0.28.1
184184
method: GET
185-
uri: https://artifacts.elastic.co/releases/stack.json
185+
uri: https://ela.st/past-stack-releases
186186
response:
187187
body:
188188
string: |-
@@ -2441,7 +2441,7 @@ interactions:
24412441
"end_of_maintenance_date": "2027-01-15",
24422442
"is_retired": false,
24432443
"retired_date": null,
2444-
"manifest": "https://artifacts.elastic.co/releases/stack.json"
2444+
"manifest": "https://ela.st/past-stack-releases"
24452445
},
24462446
{
24472447
"version": "8.19.0",

genai-function-calling/openai-agents/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async def get_latest_elasticsearch_version(major_version: int = 0) -> str:
2323
major_version: Major version to filter by (e.g. 7, 8). Defaults to latest
2424
"""
2525
async with AsyncClient() as client:
26-
response = await client.get("https://artifacts.elastic.co/releases/stack.json")
26+
response = await client.get("https://ela.st/past-stack-releases")
2727
response.raise_for_status()
2828
releases = response.json()["releases"]
2929

genai-function-calling/semantic-kernel-dotnet/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public string GetLatestVersion(
3636
[Description("Major version to filter by (e.g. 8, 9). Defaults to latest")] int? majorVersion = null)
3737
{
3838
using var httpClient = new HttpClient();
39-
var response = httpClient.GetAsync("https://artifacts.elastic.co/releases/stack.json").Result;
39+
var response = httpClient.GetAsync("https://ela.st/past-stack-releases").Result;
4040
var json = response.Content.ReadAsStringAsync().Result;
4141
var releaseData = JsonSerializer.Deserialize<ReleasesResponse>(json);
4242

genai-function-calling/spring-ai/src/main/java/example/ElasticsearchTools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ record ReleasesResponse(List<Release> releases) {
2121

2222
@Tool(description = "Returns the latest GA version of Elasticsearch in \"X.Y.Z\" format.")
2323
String getLatestElasticsearchVersion(@ToolParam(description = "Major version to filter by (e.g. 8, 9). Defaults to latest") @Nullable Integer majorVersion) {
24-
ReleasesResponse response = WebClient.create().get().uri("https://artifacts.elastic.co/releases/stack.json")
24+
ReleasesResponse response = WebClient.create().get().uri("https://ela.st/past-stack-releases")
2525
.exchangeToMono(res -> res.mutate()
2626
// Fix incorrect content-type from artifacts.elastic.co
2727
.headers(hdrs -> hdrs.setContentType(MediaType.APPLICATION_JSON))

genai-function-calling/vercel-ai/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const getLatestElasticsearchVersion = tool({
2121
majorVersion: z.number().optional().describe('Major version to filter by (e.g. 8, 9). Defaults to latest'),
2222
}),
2323
execute: async ({majorVersion}) => {
24-
const response = await fetch('https://artifacts.elastic.co/releases/stack.json');
24+
const response = await fetch('https://ela.st/past-stack-releases');
2525
const data = await response.json();
2626
const latest = data.releases
2727
// Filter out non-release versions (e.g. -rc1) and remove " GA" suffix

0 commit comments

Comments
 (0)