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":
|
||||
env_id = arguments["environment_id"]
|
||||
|
||||
# Build request data
|
||||
# Build request data with lowercase field names for this endpoint
|
||||
data = {
|
||||
"Name": arguments["name"],
|
||||
"EndpointId": int(env_id),
|
||||
"GitConfig": {
|
||||
"URL": arguments["repository_url"],
|
||||
"ReferenceName": arguments.get("repository_ref", "main"),
|
||||
"ComposeFilePathInRepository": arguments.get("compose_path", "docker-compose.yml")
|
||||
}
|
||||
"name": arguments["name"],
|
||||
"repositoryURL": arguments["repository_url"],
|
||||
"repositoryReferenceName": arguments.get("repository_ref", "main"),
|
||||
"composeFilePathInRepository": arguments.get("compose_path", "docker-compose.yml")
|
||||
}
|
||||
|
||||
# Add authentication if provided
|
||||
if arguments.get("repository_auth") and arguments.get("repository_username"):
|
||||
data["GitConfig"]["Authentication"] = {
|
||||
"Username": arguments["repository_username"],
|
||||
"Password": arguments.get("repository_password", "")
|
||||
}
|
||||
data["repositoryAuthentication"] = True
|
||||
data["repositoryUsername"] = arguments["repository_username"]
|
||||
data["repositoryPassword"] = arguments.get("repository_password", "")
|
||||
else:
|
||||
data["repositoryAuthentication"] = False
|
||||
|
||||
# Add environment variables if provided
|
||||
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:
|
||||
return [types.TextContent(type="text", text=f"Error: {result['error']}")]
|
||||
|
Loading…
Reference in New Issue
Block a user