From: Tobias Urdin Date: Thu, 15 Aug 2024 15:17:14 +0000 (+0200) Subject: qa: barbican: restrict python packages with upper-constraints X-Git-Tag: v17.2.8~128^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4025ec424b7e7c9dd6ad22d707a8e50ba8bf5c67;p=ceph.git qa: barbican: restrict python packages with upper-constraints We install barbican by doing a pip install directly on the cloned git repository but we don't honor the upper-constraints from the OpenStack Requirements project that handles what versions is supported. This changes the pip install command that we issue when installing barbican to honor the requirements for the version (derived from the branch) that we use, in this case it's the 2023.1 release upper-constraints [1]. This prevents us from pulling in untested Python packages. This only updates Barbican because for the Keystone job we dont directly issue pip but install using tox using the `venv` environment which already by default sets the constraints as you can see in [2]. [1] https://releases.openstack.org/constraints/upper/2023.1 [2] https://github.com/openstack/keystone/blob/stable/2023.1/tox.ini#L12 Fixes: https://tracker.ceph.com/issues/67444 Signed-off-by: Tobias Urdin (cherry picked from commit bbcb820c779ed6c48ff4fa7c10730228f43e9305) --- diff --git a/qa/tasks/barbican.py b/qa/tasks/barbican.py index 771304fba928e..c32277c3c0916 100644 --- a/qa/tasks/barbican.py +++ b/qa/tasks/barbican.py @@ -88,6 +88,14 @@ def run_in_barbican_venv(ctx, client, args): run.Raw('&&') ] + args) +def get_constraints_url(cconf): + version = cconf.get('force-branch', 'master') + if '/' in version: + # split stable/ to + version = str(version).split('/')[1] + url = f"https://releases.openstack.org/constraints/upper/{version}" + return url + @contextlib.contextmanager def setup_venv(ctx, config): """ @@ -95,13 +103,14 @@ def setup_venv(ctx, config): """ assert isinstance(config, dict) log.info('Setting up virtualenv for barbican...') - for (client, _) in config.items(): + for (client, cconf) in config.items(): run_in_barbican_dir(ctx, client, ['python3', '-m', 'venv', '.barbicanenv']) run_in_barbican_venv(ctx, client, ['pip', 'install', '--upgrade', 'pip']) + url = get_constraints_url(cconf) run_in_barbican_venv(ctx, client, - ['pip', 'install', 'pytz', + ['pip', 'install', f'-c{url}', 'pytz', '-e', get_barbican_dir(ctx)]) yield