Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
187c460
start of updating pr
l0lawrence Mar 10, 2025
2c273bf
try
l0lawrence Mar 11, 2025
4ce69ba
try removing live tests
l0lawrence Mar 12, 2025
c2b1f47
update
l0lawrence Mar 12, 2025
0944981
try
l0lawrence Mar 12, 2025
5723c3e
try
l0lawrence Mar 12, 2025
fb53a83
try
l0lawrence Mar 12, 2025
c1b19da
bump
l0lawrence Mar 12, 2025
d12ea80
remove logid
l0lawrence Mar 12, 2025
7c65e94
add here?
l0lawrence Mar 12, 2025
fd2e7b8
sdwap
l0lawrence Mar 12, 2025
da4554e
requests
l0lawrence Mar 12, 2025
d82da39
update
l0lawrence Mar 12, 2025
6b41848
this
l0lawrence Mar 12, 2025
452a045
lose
l0lawrence Mar 12, 2025
e706695
try
l0lawrence Mar 12, 2025
f74536c
add
l0lawrence Mar 12, 2025
9cbb3dc
add
l0lawrence Mar 12, 2025
2b1fa1e
whoops
l0lawrence Mar 12, 2025
8a8425e
try
l0lawrence Mar 12, 2025
917b96d
bump
l0lawrence Mar 12, 2025
3cbf607
try
l0lawrence Mar 12, 2025
6b61713
this
l0lawrence Mar 12, 2025
44fe1cd
actually you know need to return sometyhing
l0lawrence Mar 12, 2025
56c4f2e
this
l0lawrence Mar 12, 2025
d978cac
this
l0lawrence Mar 12, 2025
8134dc1
tryt
l0lawrence Mar 12, 2025
f3903df
try
l0lawrence Mar 13, 2025
e1fffe0
try
l0lawrence Mar 13, 2025
9635bf5
this
l0lawrence Mar 13, 2025
b66522b
this
l0lawrence Mar 13, 2025
eb8484f
this
l0lawrence Mar 13, 2025
43e033e
try
l0lawrence Mar 13, 2025
da8e917
try
l0lawrence Mar 13, 2025
3d8a5f8
try
l0lawrence Mar 13, 2025
f9d7827
try
l0lawrence Mar 13, 2025
761385f
json
l0lawrence Mar 13, 2025
6492a07
try nthis
l0lawrence Mar 13, 2025
44d20d5
try
l0lawrence Mar 13, 2025
8c90a24
tests
l0lawrence Mar 13, 2025
a47e641
try this
l0lawrence Mar 13, 2025
ea3975d
task
l0lawrence Mar 13, 2025
d20ae58
do
l0lawrence Mar 13, 2025
e603881
bump
l0lawrence Mar 13, 2025
a00456e
this
l0lawrence Mar 13, 2025
810cdfe
eteer
l0lawrence Mar 13, 2025
e50c669
this
l0lawrence Mar 13, 2025
5cc0f11
log link
l0lawrence Mar 14, 2025
688d9a1
log_output
l0lawrence Mar 14, 2025
f284a17
log_output
l0lawrence Mar 14, 2025
9103150
THIS
l0lawrence Mar 14, 2025
fa0928e
add
l0lawrence Mar 14, 2025
8b3438f
this
l0lawrence Mar 14, 2025
04c0eb7
wrong naming
l0lawrence Mar 14, 2025
aecb566
content
l0lawrence Mar 14, 2025
569449c
this
l0lawrence Mar 14, 2025
a9cc38c
this
l0lawrence Mar 14, 2025
0e27fd0
bump
l0lawrence Mar 14, 2025
9cf7a50
update
l0lawrence Mar 14, 2025
41df3c1
add
l0lawrence Mar 14, 2025
221e563
bump
l0lawrence Mar 14, 2025
2b31e71
fix
l0lawrence Mar 17, 2025
fbe986d
remove comment
l0lawrence Mar 17, 2025
34675a1
start addressing comments
l0lawrence Mar 17, 2025
e50b76a
comments
l0lawrence Mar 17, 2025
e99cedf
this
l0lawrence Mar 17, 2025
2215990
Update eng/tox/run_pylint.py
l0lawrence Mar 17, 2025
0f97707
move try
l0lawrence Mar 17, 2025
9dff014
add
l0lawrence Mar 17, 2025
f934ce7
add other reqs
l0lawrence Mar 17, 2025
7e316bc
requests
l0lawrence Mar 17, 2025
3fdf356
update
l0lawrence Mar 17, 2025
f02b004
this?
l0lawrence Mar 18, 2025
b4ca01a
need to remove- for eg righjt now
l0lawrence Mar 19, 2025
e0dfa90
revert
l0lawrence Mar 20, 2025
ae86434
this
l0lawrence Mar 20, 2025
eec4740
script
l0lawrence Mar 20, 2025
6495391
pin
l0lawrence Mar 20, 2025
57f3fdb
this
l0lawrence Mar 20, 2025
de7e73e
this?
l0lawrence Mar 20, 2025
a1c66a6
oops
l0lawrence Mar 20, 2025
369a3e8
logging
l0lawrence Mar 20, 2025
084e8e5
this
l0lawrence Mar 20, 2025
287578e
bump
l0lawrence Mar 21, 2025
7873a62
targeted
l0lawrence Mar 21, 2025
15179a7
done?
l0lawrence Mar 21, 2025
d2ff814
this
l0lawrence Mar 21, 2025
b86dfe8
version
l0lawrence Mar 21, 2025
ae04bef
this
l0lawrence Mar 21, 2025
fe427f2
bump
l0lawrence Mar 21, 2025
49ab3d0
remove
l0lawrence Mar 21, 2025
b5dad17
delete
l0lawrence Mar 21, 2025
94e1a0c
unused import
l0lawrence Mar 21, 2025
07a8079
bump
l0lawrence Mar 21, 2025
f0481db
update
l0lawrence Mar 21, 2025
1141192
naming
l0lawrence Mar 21, 2025
2c6564f
add
l0lawrence Mar 21, 2025
74fd3f9
liscene
l0lawrence Mar 21, 2025
2a043af
new approach
l0lawrence Mar 25, 2025
efbea2e
rename
l0lawrence Mar 25, 2025
a109857
this
l0lawrence Mar 25, 2025
8a45720
this
l0lawrence Mar 25, 2025
540839f
path
l0lawrence Mar 25, 2025
814b8f8
this
l0lawrence Mar 25, 2025
f5da0c2
this
l0lawrence Mar 25, 2025
44ae4f7
try
l0lawrence Mar 25, 2025
d66791e
unrelated to this p\r
l0lawrence Mar 25, 2025
23c2570
bump
l0lawrence Mar 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ extends:
env:
GH_TOKEN: $(azuresdk-github-pat)

- script: |
Comment thread
scbedd marked this conversation as resolved.
python -m pip install PyGithub>=1.59.0
python -m pip install requests>=2.0
displayName: 'Prep Environment'
- task: PythonScript@0
displayName: 'Update vNext Issues with build errors'
continueOnError: true
inputs:
scriptPath: 'tools/azure-sdk-tools/gh_tools/update_issue.py'
arguments: >-
${{ parameters.BuildTargetingString }}
--service="${{ parameters.ServiceDirectory }}"
--disablecov
env:
GH_TOKEN: $(azuresdk-github-pat)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)

- task: UsePythonVersion@0
displayName: 'Use Python 3.13 for docs generation'
inputs:
Expand Down
17 changes: 17 additions & 0 deletions eng/pipelines/templates/stages/python-analyze-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ stages:
env:
GH_TOKEN: $(azuresdk-github-pat)

- script: |
python -m pip install PyGithub>=1.59.0
python -m pip install requests>=2.0
displayName: 'Prep Environment'
- task: PythonScript@0
displayName: 'Update vNext Issues with build errors'
continueOnError: true
inputs:
scriptPath: 'tools/azure-sdk-tools/gh_tools/update_issue.py'
arguments: >-
${{ parameters.BuildTargetingString }}
--service="${{ parameters.ServiceDirectory }}"
--disablecov
env:
GH_TOKEN: $(azuresdk-github-pat)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)

- task: UsePythonVersion@0
displayName: 'Use Python 3.13 for docs generation'
inputs:
Expand Down
153 changes: 153 additions & 0 deletions tools/azure-sdk-tools/gh_tools/update_issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import os
import argparse
import requests
import json
import logging
from github import Github, Auth
from ci_tools.functions import discover_targeted_packages

logging.getLogger().setLevel(logging.INFO)
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..", ".."))

def get_build_info(service_directory: str, package_name: str) -> str:
"""Get the build info from the build link."""
build_id = os.getenv("BUILD_BUILDID")
timeline_link =f"https://dev.azure.com/azure-sdk/internal/_apis/build/builds/{build_id}/timeline?api-version=6.0"

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

try:
# Make the API request
response = requests.get(timeline_link, headers=AUTH_HEADERS)
response_json = json.loads(response.text)

for task in response_json["records"]:
if "Run Pylint Next" in task["name"]:
log_link = task['log']['url'] + "?api-version=6.0"
# Get the log file from the build link
log_output = requests.get(log_link, headers=AUTH_HEADERS)
build_output = log_output.content.decode("utf-8")
new_output = (build_output.split(f"next-pylint: commands[3]> python /mnt/vss/_work/1/s/eng/tox/run_pylint.py -t {service_directory} --next=True")[1]).split(f"ERROR:root:{package_name} exited with linting error")[0]
return new_output
except Exception as e:
logging.error(f"Exception occurred while getting build info: {e}")
return "Error getting build info"



def main(targeted_packages):
for package in targeted_packages:
# iterate through the packages and find if there is an issue associated with the package
# there may be multiple packages in the targeted_packages list
logging.info(f"Processing package: {package}")

# update open GitHub issues matching the package pattern
auth = Auth.Token(os.environ["GH_TOKEN"])
g = Github(auth=auth)
repo = g.get_repo("Azure/azure-sdk-for-python")

package_name = package.split("/")[-1]
logging.info(f"Searching for issues in repo {repo.name} for package {package_name}")

for issue in repo.get_issues(state="open", labels=["pylint"], creator="azure-sdk"):
if f"{package_name} needs linting updates for pylint version" in issue.title:
logging.info(f"Found issue for package {package_name}: {issue.title}")
build_info = get_build_info(package, package_name)

template = (
f"\n\n**Pylint Errors:**"
f"\n\n{build_info}"
f"\n"
f"\n\n**How to fix:**"
f"\n**Note:** If you are a bot. Fix the issue by fixing the above pylint errors."
)
if issue.body:
first_section = issue.body.split("**How to fix:**")[0]
new_body = first_section + template + "\n" + issue.body.split("**How to fix:**")[1]
issue.edit(body=new_body)
logging.info(f"Updated issue #{issue.number} for package {package_name}")

if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="""
This script is the single point for all checks invoked by CI within this repo. It works in two phases.
1. Identify which packages in the repo are in scope for this script invocation, based on a glob string and a service directory.
2. Invoke one or multiple `tox` environments for each package identified as in scope.

In the case of an environment invoking `pytest`, results can be collected in a junit xml file, and test markers can be selected via --mark_arg.
"""
)

parser.add_argument(
"glob_string",
nargs="?",
help=(
"A comma separated list of glob strings that will target the top level directories that contain packages."
'Examples: All = "azure-*", Single = "azure-keyvault", Targeted Multiple = "azure-keyvault,azure-mgmt-resource"'
),
)

parser.add_argument("--disablecov", help=("Flag. Disables code coverage."), action="store_true")

parser.add_argument(
"--service",
help=("Name of service directory (under sdk/) to test. Example: --service applicationinsights"),
)

parser.add_argument(
"-w",
"--wheel_dir",
dest="wheel_dir",
help="Location for prebuilt artifacts (if any)",
)

parser.add_argument(
"-i",
"--injected-packages",
dest="injected_packages",
default="",
help="Comma or space-separated list of packages that should be installed prior to dev_requirements. If local path, should be absolute.",
)

parser.add_argument(
"--filter-type",
dest="filter_type",
default="Build",
help="Filter type to identify eligible packages. for e.g. packages filtered in Build can pass filter type as Build,",
choices=["Build", "Docs", "Regression", "Omit_management", "None"],
)


args = parser.parse_args()

# We need to support both CI builds of everything and individual service
# folders. This logic allows us to do both.
if args.service and args.service != "auto":
service_dir = os.path.join("sdk", args.service)
target_dir = os.path.join(root_dir, service_dir)
else:
target_dir = root_dir

logging.info(f"Beginning discovery for {args.service} and root dir {root_dir}. Resolving to {target_dir}.")

if args.filter_type == "None":
args.filter_type = "Build"
compatibility_filter = False
else:
compatibility_filter = True

targeted_packages = discover_targeted_packages(
args.glob_string, target_dir, "", args.filter_type, compatibility_filter
)

if len(targeted_packages) == 0:
logging.info(f"No packages collected for targeting string {args.glob_string} and root dir {root_dir}. Exit 0.")
exit(0)

main(targeted_packages)
2 changes: 1 addition & 1 deletion tools/azure-sdk-tools/gh_tools/vnext_issue_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def create_vnext_issue(package_dir: str, check_type: CHECK_TYPE) -> None:
f"The build will begin to fail for this library if errors are not fixed."
f"\n\n**Library name:** {package_name}"
f"\n**{check_type.capitalize()} version:** {version}"
f"\n**{check_type.capitalize()} errors:** [Link to build ({today.strftime('%Y-%m-%d')})]({build_link})"
f"\n**{check_type.capitalize()} Build:** [Link to build ({today.strftime('%Y-%m-%d')})]({build_link})"
f"\n**How to fix:** Run the `next-{check_type}` tox command at the library package-level and resolve "
f"the {error_type} errors.\n"
f'1) `../{package_name}>pip install "tox<5"`\n'
Expand Down
Loading