Skip to content

Commit a52c3ff

Browse files
JennyPngCopilot
andcommitted
Fix update_issue.py to parse azpysdk log format instead of deleted tox script
The get_build_info function was referencing eng/tox/run_pylint.py which no longer exists. Updated to parse the dispatch_checks.py grouped log format (##[group] markers) from the 'Run Tests' CI task instead of the old tox 'Run Pylint Next' task. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7ed0462 commit a52c3ff

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

eng/tools/azure-sdk-tools/gh_tools/update_issue.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,38 @@
1616

1717

1818
def get_build_info(service_directory: str, package_name: str) -> str:
19-
"""Get the build info from the build link."""
19+
"""Get the pylint build info from the CI build logs.
20+
21+
Parses the Azure DevOps build timeline to find the "Run Tests" task,
22+
then extracts next-pylint output for the given package from the
23+
dispatch_checks.py log format.
24+
"""
2025
build_id = os.getenv("BUILD_BUILDID")
2126
timeline_link = f"https://dev.azure.com/azure-sdk/internal/_apis/build/builds/{build_id}/timeline?api-version=6.0"
2227

2328
token = os.environ["SYSTEM_ACCESSTOKEN"]
2429
AUTH_HEADERS = {"Authorization": f"Bearer {token}"}
2530

2631
try:
27-
# Make the API request
2832
response = requests.get(timeline_link, headers=AUTH_HEADERS)
2933
response_json = json.loads(response.text)
3034

3135
for task in response_json["records"]:
32-
if "Run Pylint Next" in task["name"]:
36+
if "Run Tests" in task.get("name", ""):
3337
log_link = task["log"]["url"] + "?api-version=6.0"
34-
# Get the log file from the build link
3538
log_output = requests.get(log_link, headers=AUTH_HEADERS)
3639
build_output = log_output.content.decode("utf-8")
37-
new_output = (
38-
build_output.split(
39-
f"next-pylint: commands[3]> python /mnt/vss/_work/1/s/eng/scripts/run_pylint.py -t {service_directory} --next=True"
40-
)[1]
41-
).split(f"ERROR:root:{package_name} exited with linting error")[0]
42-
return new_output
40+
41+
# Extract next-pylint output from the dispatch_checks.py grouped log format
42+
group_marker = f"{package_name} :: next-pylint ::"
43+
if group_marker in build_output:
44+
section = build_output.split(group_marker, 1)[1]
45+
# The section ends at the next ##[endgroup] or the end of the log
46+
if "##[endgroup]" in section:
47+
section = section.split("##[endgroup]", 1)[0]
48+
return section.strip()
49+
50+
return "No next-pylint output found in build logs."
4351
except Exception as e:
4452
logging.error(f"Exception occurred while getting build info: {e}")
4553
return "Error getting build info"

0 commit comments

Comments
 (0)