From 6bfb61fc81a2bb8055618c9aa43713a67a30ae41 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Fri, 28 Feb 2020 17:14:32 -0600 Subject: [PATCH] Don't fail version validation on install failure There could be an issue in previous tagged releases due to external factors. In that case, there is no way to fix that version. Validation currently checks out the previous tag and creates an sdist in order to compare requirements changes on bugfix version bumps only. In the case where the previous release has an issue, just handle the failure and move along. Change-Id: I60db41a475c3a13359556198c0611489dffa4b3f Signed-off-by: Sean McGinnis --- openstack_releases/requirements.py | 36 +++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/openstack_releases/requirements.py b/openstack_releases/requirements.py index 24cff95a1a..227f1a2b8a 100644 --- a/openstack_releases/requirements.py +++ b/openstack_releases/requirements.py @@ -86,19 +86,29 @@ def get_min_specifier(specifier_set): def get_requirements_at_ref(workdir, repo, ref): - "Check out the repo at the ref and load the list of requirements." - dest = gitutils.clone_repo(workdir, repo, ref=ref) - processutils.check_call(['python3', 'setup.py', 'sdist'], cwd=dest) - sdist_name = pythonutils.get_sdist_name(workdir, repo) - requirements_filename = os.path.join( - dest, sdist_name + '.egg-info', 'requires.txt', - ) - if os.path.exists(requirements_filename): - with open(requirements_filename, 'r') as f: - body = f.read() - else: - # The package has no dependencies. - body = '' + """Check out the repo at the ref and load the list of requirements.""" + body = '' + + try: + dest = gitutils.clone_repo(workdir, repo, ref=ref) + processutils.check_call(['python3', 'setup.py', 'sdist'], cwd=dest) + sdist_name = pythonutils.get_sdist_name(workdir, repo) + requirements_filename = os.path.join( + dest, sdist_name + '.egg-info', 'requires.txt', + ) + if os.path.exists(requirements_filename): + with open(requirements_filename, 'r') as f: + body = f.read() + else: + # The package has no dependencies. + pass + except Exception: + # We've had a few cases where a previous version had an issue and could + # no longer be installed. In this case, just move along. + LOG.warning('Unable to create sdist, unable to get requirements.') + LOG.warning('!!! Perform manual comparison for requirements changes' + '!!!') + return parse_requirements(body)