From: Adam King Date: Wed, 16 Aug 2023 23:56:38 +0000 (-0400) Subject: qa/cephadm: support to pull stable branch compiled cephadm X-Git-Tag: v19.1.0~532^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=67c5669157e1771ab075bef095fb6bcd29975a38;p=ceph.git qa/cephadm: support to pull stable branch compiled cephadm This is to allow us to pull the latest build of cephadm off of a stable branch (currently the only valid option for that is reef, although this hopefully will work with squid, T release, etc. in the future). This should allow us to bootstrap cliusters based on those stable branches for use in upgrade testing Signed-off-by: Adam King --- diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 1fdf6ee012e32..9e386bbd5c29b 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -169,6 +169,8 @@ def download_cephadm(ctx, config, ref): # cephadm elif 'cephadm_git_url' in config and 'cephadm_branch' in config: _fetch_cephadm_from_github(ctx, config, ref) + elif 'compiled_cephadm_branch' in config: + _fetch_stable_branch_cephadm_from_chacra(ctx, config, cluster_name) else: _fetch_cephadm_from_chachra(ctx, config, cluster_name) @@ -291,6 +293,55 @@ def _fetch_cephadm_from_chachra(ctx, config, cluster_name): ], ) +def _fetch_stable_branch_cephadm_from_chacra(ctx, config, cluster_name): + branch = config.get('compiled_cephadm_branch', 'reef') + flavor = config.get('flavor', 'default') + + log.info(f'Downloading "compiled" cephadm from cachra for {branch}') + + bootstrap_remote = ctx.ceph[cluster_name].bootstrap_remote + bp = packaging.get_builder_project()( + config.get('project', 'ceph'), + config, + ctx=ctx, + remote=bootstrap_remote, + ) + log.info('builder_project result: %s' % (bp._result.json())) + + # pull the cephadm binary from chacra + url = chacra.get_binary_url( + 'cephadm', + project=bp.project, + distro=bp.distro.split('/')[0], + release=bp.distro.split('/')[1], + arch=bp.arch, + flavor=flavor, + branch=branch, + ) + log.info("Discovered cachra url: %s", url) + ctx.cluster.run( + args=[ + 'curl', '--silent', '-L', url, + run.Raw('>'), + ctx.cephadm, + run.Raw('&&'), + 'ls', '-l', + ctx.cephadm, + ], + ) + + # sanity-check the resulting file and set executable bit + cephadm_file_size = '$(stat -c%s {})'.format(ctx.cephadm) + ctx.cluster.run( + args=[ + 'test', '-s', ctx.cephadm, + run.Raw('&&'), + 'test', run.Raw(cephadm_file_size), "-gt", run.Raw('1000'), + run.Raw('&&'), + 'chmod', '+x', ctx.cephadm, + ], + ) + def _rm_cluster(ctx, cluster_name): log.info('Removing cluster...') diff --git a/qa/tasks/util/chacra.py b/qa/tasks/util/chacra.py index ed9358a597497..52414c890f9c0 100644 --- a/qa/tasks/util/chacra.py +++ b/qa/tasks/util/chacra.py @@ -71,7 +71,15 @@ def get_binary_url( if len(result) == 0: raise RuntimeError(f'no results found at {resp.url}') - # TODO: filter the result down to the correct arch etc.? + # if arch was supplied, filter down to only results + # that include the desired arch + if arch: + result = [r for r in result if ('archs' in r and arch in r['archs'])] + + # TODO: Is there any further filtering we should do beyond arch? + # We already use flavor, ref, etc. in our search. + + # TODO: After filtering, does it matter which result we take? result = result[0] status = result['status']