Skip to content

Catch InvalidRequirement error in CI - #25787

Closed
Laia Patiño (laiapat) wants to merge 1 commit into
mainfrom
pkg-invalidrequirements
Closed

Catch InvalidRequirement error in CI#25787
Laia Patiño (laiapat) wants to merge 1 commit into
mainfrom
pkg-invalidrequirements

Conversation

@laiapat

Copy link
Copy Markdown
Member

Description

Scott Beddall (@scbedd) I'm not entirely sure why, but azure-identity CI runs have started failing this week with errors like this:

INFO:root:Wheel for package azure-devtools is /mnt/vss/_work/1/s/sdk/identity/azure-identity/.tmp_whl_dir/azure_devtools-1.2.1-py2.py3-none-any.whl
INFO:root:Replacing dev requirement. Old requirement:../../../tools/azure-devtools, New requirement:/mnt/vss/_work/1/s/sdk/identity/azure-identity/.tmp_whl_dir/azure_devtools-1.2.1-py2.py3-none-any.whl
INFO:root:New dependency_tools.txt:['/mnt/vss/_work/1/s/sdk/identity/azure-identity/.tmp_whl_dir/azure_sdk_tools-0.0.0-py3-none-any.whl', '/mnt/vss/_work/1/s/sdk/identity/azure-identity/.tmp_whl_dir/azure_devtools-1.2.1-py2.py3-none-any.whl', "aiohttp>=3.0; python_version >= '3.5'"]
INFO:root:Adding custom packages to requirements for /mnt/vss/_work/1/s/sdk/identity/azure-identity
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing/core.py", line 1141, in parse_string
    raise exc.with_traceback(None)
pkg_resources._vendor.pyparsing.exceptions.ParseException: Expected W:(0-9A-Za-z), found '/'  (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/vss/_work/1/s/scripts/devops_tasks/setup_execute_tests.py", line 321, in <module>
    prep_and_run_tox(compatible_targeted_packages, args, extended_pytest_args)
  File "/mnt/vss/_work/1/s/scripts/devops_tasks/tox_harness.py", line 437, in prep_and_run_tox
    destination_dev_req, parsed_args.injected_packages, package_dir
  File "/mnt/vss/_work/1/s/scripts/devops_tasks/tox_harness.py", line 212, in inject_custom_reqs
    parsed_req = [req for req in parse_requirements(line)]
  File "/mnt/vss/_work/1/s/scripts/devops_tasks/tox_harness.py", line 212, in <listcomp>
    parsed_req = [req for req in parse_requirements(line)]
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3102, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 105, in __init__
    f'Parse error at "{ requirement_string[e.loc : e.loc + 8]!r}": {e.msg}'
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'/mnt/vss'": Expected W:(0-9A-Za-z)

We currently catch RequirementParseErrors, but according to setuptools, we should actually be catching this InvalidRequirement error instead.

Based on the timing and the setuptools changelog, I assume the new failure is coming from a versioning update that was included in the test tools refactor earlier this week.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@laiapat Laia Patiño (laiapat) added the Central-EngSys This issue is owned by the Engineering System team. label Aug 20, 2022
@laiapat

Copy link
Copy Markdown
Member Author

/azp run python - identity - ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@laiapat

Copy link
Copy Markdown
Member Author

😑 Running the CI pipeline manually here: https://dev.azure.com/azure-sdk/public/_build/results?buildId=1795307&view=results

@scbedd

Copy link
Copy Markdown
Member

I don't fully understand why this is throwing though. I'm trying to get a local repro so I can run that down.

@laiapat

Copy link
Copy Markdown
Member Author

Closing since this fix doesn't resolve the issue, and there's more work to be done with the code that triggers this exception in the first place (discussed offline with Scott)

@laiapat
Laia Patiño (laiapat) deleted the pkg-invalidrequirements branch October 1, 2022 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Central-EngSys This issue is owned by the Engineering System team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants