Skip to content

Commit 6ba6fef

Browse files
authored
Merge pull request ceph#54721 from adk3798/pull-stable-compiled-cephadm
qa/cephadm: add support to pull compiled cephadm for stable branches Reviewed-by: John Mulligan <[email protected]>
2 parents edbb9fa + 967716f commit 6ba6fef

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

qa/suites/upgrade/reef-x/parallel/1-tasks.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ tasks:
77
- print: "**** done start installing reef cephadm ..."
88
- cephadm:
99
image: quay.ceph.io/ceph-ci/ceph:reef
10-
cephadm_branch: reef
11-
cephadm_git_url: https://github.com/ceph/ceph
10+
compiled_cephadm_branch: reef
1211
conf:
1312
osd:
1413
#set config option for which cls modules are allowed to be loaded / used

qa/suites/upgrade/reef-x/stress-split/1-start.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ tasks:
66

77
- cephadm:
88
image: quay.ceph.io/ceph-ci/ceph:reef
9-
cephadm_branch: reef
10-
cephadm_git_url: https://github.com/ceph/ceph
9+
compiled_cephadm_branch: reef
1110
conf:
1211
osd:
1312
#set config option for which cls modules are allowed to be loaded / used

qa/tasks/cephadm.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def download_cephadm(ctx, config, ref):
169169
# cephadm
170170
elif 'cephadm_git_url' in config and 'cephadm_branch' in config:
171171
_fetch_cephadm_from_github(ctx, config, ref)
172+
elif 'compiled_cephadm_branch' in config:
173+
_fetch_stable_branch_cephadm_from_chacra(ctx, config, cluster_name)
172174
else:
173175
_fetch_cephadm_from_chachra(ctx, config, cluster_name)
174176

@@ -291,6 +293,55 @@ def _fetch_cephadm_from_chachra(ctx, config, cluster_name):
291293
],
292294
)
293295

296+
def _fetch_stable_branch_cephadm_from_chacra(ctx, config, cluster_name):
297+
branch = config.get('compiled_cephadm_branch', 'reef')
298+
flavor = config.get('flavor', 'default')
299+
300+
log.info(f'Downloading "compiled" cephadm from cachra for {branch}')
301+
302+
bootstrap_remote = ctx.ceph[cluster_name].bootstrap_remote
303+
bp = packaging.get_builder_project()(
304+
config.get('project', 'ceph'),
305+
config,
306+
ctx=ctx,
307+
remote=bootstrap_remote,
308+
)
309+
log.info('builder_project result: %s' % (bp._result.json()))
310+
311+
# pull the cephadm binary from chacra
312+
url = chacra.get_binary_url(
313+
'cephadm',
314+
project=bp.project,
315+
distro=bp.distro.split('/')[0],
316+
release=bp.distro.split('/')[1],
317+
arch=bp.arch,
318+
flavor=flavor,
319+
branch=branch,
320+
)
321+
log.info("Discovered cachra url: %s", url)
322+
ctx.cluster.run(
323+
args=[
324+
'curl', '--silent', '-L', url,
325+
run.Raw('>'),
326+
ctx.cephadm,
327+
run.Raw('&&'),
328+
'ls', '-l',
329+
ctx.cephadm,
330+
],
331+
)
332+
333+
# sanity-check the resulting file and set executable bit
334+
cephadm_file_size = '$(stat -c%s {})'.format(ctx.cephadm)
335+
ctx.cluster.run(
336+
args=[
337+
'test', '-s', ctx.cephadm,
338+
run.Raw('&&'),
339+
'test', run.Raw(cephadm_file_size), "-gt", run.Raw('1000'),
340+
run.Raw('&&'),
341+
'chmod', '+x', ctx.cephadm,
342+
],
343+
)
344+
294345

295346
def _rm_cluster(ctx, cluster_name):
296347
log.info('Removing cluster...')

qa/tasks/util/chacra.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ def get_binary_url(
7171
if len(result) == 0:
7272
raise RuntimeError(f'no results found at {resp.url}')
7373

74-
# TODO: filter the result down to the correct arch etc.?
74+
# if arch was supplied, filter down to only results
75+
# that include the desired arch
76+
if arch:
77+
result = [r for r in result if ('archs' in r and arch in r['archs'])]
78+
79+
# TODO: Is there any further filtering we should do beyond arch?
80+
# We already use flavor, ref, etc. in our search.
81+
82+
# TODO: After filtering, does it matter which result we take?
7583
result = result[0]
7684

7785
status = result['status']

0 commit comments

Comments
 (0)