Skip to content

Commit bbcb820

Browse files
committed
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 <[email protected]>
1 parent 489919e commit bbcb820

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

qa/tasks/barbican.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,29 @@ def run_in_barbican_venv(ctx, client, args):
8888
run.Raw('&&')
8989
] + args)
9090

91+
def get_constraints_url(cconf):
92+
version = cconf.get('force-branch', 'master')
93+
if '/' in version:
94+
# split stable/<version> to <version>
95+
version = str(version).split('/')[1]
96+
url = f"https://releases.openstack.org/constraints/upper/{version}"
97+
return url
98+
9199
@contextlib.contextmanager
92100
def setup_venv(ctx, config):
93101
"""
94102
Setup the virtualenv for Barbican using pip.
95103
"""
96104
assert isinstance(config, dict)
97105
log.info('Setting up virtualenv for barbican...')
98-
for (client, _) in config.items():
106+
for (client, cconf) in config.items():
99107
run_in_barbican_dir(ctx, client,
100108
['python3', '-m', 'venv', '.barbicanenv'])
101109
run_in_barbican_venv(ctx, client,
102110
['pip', 'install', '--upgrade', 'pip'])
111+
url = get_constraints_url(cconf)
103112
run_in_barbican_venv(ctx, client,
104-
['pip', 'install', 'pytz',
113+
['pip', 'install', f'-c{url}', 'pytz',
105114
'-e', get_barbican_dir(ctx)])
106115
yield
107116

0 commit comments

Comments
 (0)