# 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)
],
)
+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...')
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']