Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Failing Documentation Build for azure-mgmt-core #14239

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
6 changes: 6 additions & 0 deletions eng/pipelines/templates/steps/test_regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
BuildTargetingString: 'azure-*'
ServiceDirectory: ''
BuildStagingDirectory: $(Build.ArtifactStagingDirectory)
DevFeedName: 'public/azure-sdk-for-python'

steps:
- task: UsePythonVersion@0
Expand All @@ -14,6 +15,11 @@ steps:
artifactName: 'artifacts'
targetPath: $(Build.ArtifactStagingDirectory)

- ${{if eq(variables['System.TeamProject'], 'internal') }}:
- template: ../steps/auth-dev-feed.yml
parameters:
DevFeedName: ${{ parameters.DevFeedName }}

- script: |
pip install -r eng/ci_tools.txt
displayName: 'Prep Environment'
Expand Down
15 changes: 11 additions & 4 deletions eng/tox/sanitize_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import logging
import glob
from packaging.specifiers import SpecifierSet
from packaging.version import Version
from pkg_resources import Requirement
from pypi_tools.pypi import PyPIClient

Expand All @@ -22,7 +23,7 @@
sys.path.append(setup_parser_path)
from setup_parser import get_install_requires, parse_setup

DEV_BUILD_IDENTIFIER = ".dev"
DEV_BUILD_IDENTIFIER = "a"

def update_requires(setup_py_path, requires_dict):
# This method changes package requirement by overriding the specifier
Expand Down Expand Up @@ -62,12 +63,17 @@ def get_version(pkg_name):
# When building package with dev build version, version for packages in same service is updated to dev build
# and other packages will not have dev build number
# strip dev build number so we can check if package exists in PyPI and replace
if DEV_BUILD_IDENTIFIER in version:
version = version[:version.find(DEV_BUILD_IDENTIFIER)]

version_obj = Version(version)
if version_obj.pre:
if version_obj.pre[0] == DEV_BUILD_IDENTIFIER:
version = version_obj.base_version

return version
else:
logging.error("setyp.py is not found for package {} to identify current version".format(pkg_name))
exit(1)


def process_requires(setup_py_path):
# This method process package requirement to verify if all required packages are available on PyPI
Expand All @@ -82,11 +88,12 @@ def process_requires(setup_py_path):
for req in requires:
pkg_name = req.key
spec = SpecifierSet(str(req).replace(pkg_name, ""))

if not is_required_version_on_pypi(pkg_name, spec):
old_req = str(req)
version = get_version(pkg_name)
logging.info("Updating version {0} in requirement {1} to dev build version".format(version, old_req))
new_req = old_req.replace(version, "{}.dev".format(version))
new_req = old_req.replace(version, "{}{}".format(version, DEV_BUILD_IDENTIFIER))
logging.info("New requirement for package {0}: {1}".format(pkg_name, new_req))
requirement_to_update[old_req] = new_req