Fix: Update stack creation endpoint for Git repositories
- Use correct endpoint /api/stacks/create/standalone/repository - Fix field names to lowercase for this endpoint - Add proper authentication handling - Remove incorrect query parameters
This commit is contained in:
parent
c4da16a951
commit
51bd6ea954
@ -568,29 +568,30 @@ async def handle_call_tool(
|
|||||||
elif name == "create_compose_stack_from_git":
|
elif name == "create_compose_stack_from_git":
|
||||||
env_id = arguments["environment_id"]
|
env_id = arguments["environment_id"]
|
||||||
|
|
||||||
# Build request data
|
# Build request data with lowercase field names for this endpoint
|
||||||
data = {
|
data = {
|
||||||
"Name": arguments["name"],
|
"name": arguments["name"],
|
||||||
"EndpointId": int(env_id),
|
"repositoryURL": arguments["repository_url"],
|
||||||
"GitConfig": {
|
"repositoryReferenceName": arguments.get("repository_ref", "main"),
|
||||||
"URL": arguments["repository_url"],
|
"composeFilePathInRepository": arguments.get("compose_path", "docker-compose.yml")
|
||||||
"ReferenceName": arguments.get("repository_ref", "main"),
|
|
||||||
"ComposeFilePathInRepository": arguments.get("compose_path", "docker-compose.yml")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add authentication if provided
|
# Add authentication if provided
|
||||||
if arguments.get("repository_auth") and arguments.get("repository_username"):
|
if arguments.get("repository_auth") and arguments.get("repository_username"):
|
||||||
data["GitConfig"]["Authentication"] = {
|
data["repositoryAuthentication"] = True
|
||||||
"Username": arguments["repository_username"],
|
data["repositoryUsername"] = arguments["repository_username"]
|
||||||
"Password": arguments.get("repository_password", "")
|
data["repositoryPassword"] = arguments.get("repository_password", "")
|
||||||
}
|
else:
|
||||||
|
data["repositoryAuthentication"] = False
|
||||||
|
|
||||||
# Add environment variables if provided
|
# Add environment variables if provided
|
||||||
if arguments.get("env_vars"):
|
if arguments.get("env_vars"):
|
||||||
data["Env"] = arguments["env_vars"]
|
data["env"] = arguments["env_vars"]
|
||||||
|
|
||||||
result = await make_request("POST", "/api/stacks", json_data=data)
|
# Use the correct endpoint for standalone Docker stack creation from Git
|
||||||
|
endpoint = f"/api/stacks/create/standalone/repository?endpointId={env_id}"
|
||||||
|
|
||||||
|
result = await make_request("POST", endpoint, json_data=data)
|
||||||
|
|
||||||
if "error" in result:
|
if "error" in result:
|
||||||
return [types.TextContent(type="text", text=f"Error: {result['error']}")]
|
return [types.TextContent(type="text", text=f"Error: {result['error']}")]
|
||||||
|
Loading…
Reference in New Issue
Block a user