Skip to content

Commit eddc48c

Browse files
committed
results: add --arch filter
Adds --arch to results options and parameter filter_architecture to api params in dashboard_fetch_summary, dashboard_fetch_builds, dashboard_fetch_boots, and dashboard_fetch_tests. Signed-off-by: Camila Alvarez <cam.alvarez.i@gmail.com>
1 parent 780f9da commit eddc48c

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

kcidev/subcommands/results.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,47 +55,51 @@ def dashboard_api_fetch(endpoint, params, max_retries=3):
5555
raise click.Abort()
5656

5757

58-
def dashboard_fetch_summary(origin, giturl, branch, commit):
58+
def dashboard_fetch_summary(origin, giturl, branch, commit, arch):
5959
endpoint = f"tree/{commit}/summary"
6060
params = {
6161
"origin": origin,
6262
"git_url": giturl,
6363
"git_branch": branch,
6464
}
65-
65+
if arch is not None:
66+
params["filter_architecture"] = arch
6667
return dashboard_api_fetch(endpoint, params)
6768

6869

69-
def dashboard_fetch_builds(origin, giturl, branch, commit):
70+
def dashboard_fetch_builds(origin, giturl, branch, commit, arch):
7071
endpoint = f"tree/{commit}/builds"
7172
params = {
7273
"origin": origin,
7374
"git_url": giturl,
7475
"git_branch": branch,
7576
}
76-
77+
if arch is not None:
78+
params["filter_architecture"] = arch
7779
return dashboard_api_fetch(endpoint, params)
7880

7981

80-
def dashboard_fetch_boots(origin, giturl, branch, commit):
82+
def dashboard_fetch_boots(origin, giturl, branch, commit, arch):
8183
endpoint = f"tree/{commit}/boots"
8284
params = {
8385
"origin": origin,
8486
"git_url": giturl,
8587
"git_branch": branch,
8688
}
87-
89+
if arch is not None:
90+
params["filter_architecture"] = arch
8891
return dashboard_api_fetch(endpoint, params)
8992

9093

91-
def dashboard_fetch_tests(origin, giturl, branch, commit):
94+
def dashboard_fetch_tests(origin, giturl, branch, commit, arch):
9295
endpoint = f"tree/{commit}/tests"
9396
params = {
9497
"origin": origin,
9598
"git_url": giturl,
9699
"git_branch": branch,
97100
}
98-
101+
if arch is not None:
102+
params["filter_architecture"] = arch
99103
return dashboard_api_fetch(endpoint, params)
100104

101105

@@ -439,6 +443,10 @@ def common_options(func):
439443
is_flag=True,
440444
help="Select latest results available",
441445
)
446+
@click.option(
447+
"--arch",
448+
help="Filter by arch"
449+
)
442450
@wraps(func)
443451
def wrapper(*args, **kwargs):
444452
return func(*args, **kwargs)
@@ -488,12 +496,13 @@ def summary(
488496
branch,
489497
commit,
490498
latest,
499+
arch
491500
):
492501
"""Display a summary of results."""
493502
giturl, branch, commit = set_giturl_branch_commit(
494503
origin, giturl, branch, commit, latest, git_folder
495504
)
496-
data = dashboard_fetch_summary(origin, giturl, branch, commit)
505+
data = dashboard_fetch_summary(origin, giturl, branch, commit, arch)
497506
cmd_summary(data)
498507

499508

@@ -521,6 +530,7 @@ def builds(
521530
branch,
522531
commit,
523532
latest,
533+
arch,
524534
download_logs,
525535
status,
526536
filter,
@@ -529,7 +539,7 @@ def builds(
529539
giturl, branch, commit = set_giturl_branch_commit(
530540
origin, giturl, branch, commit, latest, git_folder
531541
)
532-
data = dashboard_fetch_builds(origin, giturl, branch, commit)
542+
data = dashboard_fetch_builds(origin, giturl, branch, commit, arch)
533543
cmd_builds(data, commit, download_logs, status)
534544

535545

@@ -545,6 +555,7 @@ def boots(
545555
branch,
546556
commit,
547557
latest,
558+
arch,
548559
download_logs,
549560
status,
550561
filter,
@@ -553,7 +564,7 @@ def boots(
553564
giturl, branch, commit = set_giturl_branch_commit(
554565
origin, giturl, branch, commit, latest, git_folder
555566
)
556-
data = dashboard_fetch_boots(origin, giturl, branch, commit)
567+
data = dashboard_fetch_boots(origin, giturl, branch, commit, arch)
557568
cmd_tests(data["boots"], commit, download_logs, status, filter)
558569

559570

@@ -569,6 +580,7 @@ def tests(
569580
branch,
570581
commit,
571582
latest,
583+
arch,
572584
download_logs,
573585
status,
574586
filter,
@@ -577,7 +589,7 @@ def tests(
577589
giturl, branch, commit = set_giturl_branch_commit(
578590
origin, giturl, branch, commit, latest, git_folder
579591
)
580-
data = dashboard_fetch_tests(origin, giturl, branch, commit)
592+
data = dashboard_fetch_tests(origin, giturl, branch, commit, arch)
581593
cmd_tests(data["tests"], commit, download_logs, status, filter)
582594

583595

0 commit comments

Comments
 (0)