Skip to content

Commit 9e13eba

Browse files
committed
Fix ADK agent structure and organization
- Restructured for proper ADK compatibility - Created ci_analysis_agent/ directory as main agent - Renamed _sub_agents to sub_agents to avoid ADK confusion - Added e2e_test_analyst sub-agent for CI test analysis - Enhanced error handling with HTML detection in analysts - Updated imports to use relative imports - Cleaned up old root agent files - Added __pycache__ to .gitignore The agent is now properly discoverable in ADK web interface and all sub-agents are working correctly.
1 parent b80c6fe commit 9e13eba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+975
-163
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__/
-269 Bytes
Binary file not shown.

__pycache__/agent.cpython-313.pyc

-936 Bytes
Binary file not shown.

__pycache__/prompt.cpython-313.pyc

-2.64 KB
Binary file not shown.

_prow_mcp_server/mcp_server.py

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ async def get_build_logs(job_name: str, build_id: str) -> dict:
168168
async def get_install_logs(job_name: str, build_id: str, test_name: str):
169169
"""Get the install logs for a specific build ID and job name.
170170
171+
This function looks specifically in the installation directories:
172+
<job_name>/<build_id>/artifacts/<test_name>/<ipi-install-*>/
173+
174+
It tries multiple installation directory patterns:
175+
- ipi-install-install
176+
- ipi-install-install-stableinitial
177+
171178
Args:
172179
job_name: The name of the job
173180
build_id: The build ID for which to get install logs
@@ -176,35 +183,58 @@ async def get_install_logs(job_name: str, build_id: str, test_name: str):
176183
Returns:
177184
Dictionary containing the job metadata(job_name, build_id, test_name), installation logs or error information
178185
"""
179-
try:
180-
# Construct the artifacts URL
181-
artifacts_url = f"{GCS_URL}/{job_name}/{build_id}/artifacts"
182-
183-
async with httpx.AsyncClient() as client:
184-
response = await client.get(f"{artifacts_url}/{test_name}/ipi-install-install/finished.json")
185-
response.raise_for_status()
186-
json_resp = response.json()
187-
result = json_resp["result"]
188-
passed = json_resp["passed"]
189-
190-
async with httpx.AsyncClient() as client:
191-
response = await client.get(f"{artifacts_url}/{test_name}/ipi-install-install/build-log.txt")
192-
response.raise_for_status()
193-
logs = response.text
194-
return {
195-
"build_id": build_id,
196-
"job_name": job_name,
197-
"test_name": test_name,
198-
"passed": passed,
199-
"result": result,
200-
"logs": logs,
201-
"artifacts_url": artifacts_url
202-
}
203-
except Exception as e:
204-
return {
205-
"error": f"Failed to fetch logs: {str(e)}",
206-
"artifacts_url": artifacts_url if 'artifacts_url' in locals() else None
207-
}
186+
# List of possible installation directory patterns
187+
install_dirs = [
188+
"ipi-install-install",
189+
"ipi-install-install-stableinitial"
190+
]
191+
192+
# Construct the base artifacts URL
193+
artifacts_url = f"{GCS_URL}/{job_name}/{build_id}/artifacts"
194+
195+
# Try each installation directory pattern
196+
for install_dir in install_dirs:
197+
try:
198+
async with httpx.AsyncClient() as client:
199+
# Try to get finished.json from this installation directory
200+
finished_url = f"{artifacts_url}/{test_name}/{install_dir}/finished.json"
201+
response = await client.get(finished_url)
202+
response.raise_for_status()
203+
json_resp = response.json()
204+
result = json_resp["result"]
205+
passed = json_resp["passed"]
206+
207+
async with httpx.AsyncClient() as client:
208+
# Get build-log.txt from the same installation directory
209+
log_url = f"{artifacts_url}/{test_name}/{install_dir}/build-log.txt"
210+
response = await client.get(log_url)
211+
response.raise_for_status()
212+
logs = response.text
213+
214+
return {
215+
"build_id": build_id,
216+
"job_name": job_name,
217+
"test_name": test_name,
218+
"install_dir": install_dir,
219+
"passed": passed,
220+
"result": result,
221+
"logs": logs,
222+
"artifacts_url": artifacts_url,
223+
"log_url": log_url
224+
}
225+
except Exception as e:
226+
# Continue to try the next directory pattern
227+
continue
228+
229+
# If none of the patterns worked, return an error
230+
return {
231+
"error": f"Failed to fetch install logs from any installation directory. Tried: {', '.join(install_dirs)}",
232+
"build_id": build_id,
233+
"job_name": job_name,
234+
"test_name": test_name,
235+
"artifacts_url": artifacts_url,
236+
"tried_directories": [f"{artifacts_url}/{test_name}/{d}" for d in install_dirs]
237+
}
208238

209239

210240

_sub_agents/installation_analyst/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.
-241 Bytes
Binary file not shown.
-954 Bytes
Binary file not shown.
-1.36 KB
Binary file not shown.

_sub_agents/installation_analyst/agent.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)