Skip to content

Enable --days switch for getting tree list #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion kcidev/libs/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ def dashboard_fetch_build(build_id, use_json):
return dashboard_api_fetch(endpoint, {}, use_json)


def dashboard_fetch_tree_list(origin, use_json):
def dashboard_fetch_tree_list(origin, use_json, days=7):
params = {
"origin": origin,
"interval_in_days": days,
}
logging.info(f"Fetching tree list for origin: {origin}")
return dashboard_api_fetch("tree-fast", params, use_json)
Expand Down
10 changes: 8 additions & 2 deletions kcidev/subcommands/results/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,16 @@ def summary(origin, git_folder, giturl, branch, commit, latest, arch, tree, use_
help="Select KCIDB origin",
default="maestro",
)
@click.option(
"--days",
help="Provide a period of time in days to get results for",
type=int,
default=7,
)
@results_display_options
def trees(origin, use_json):
def trees(origin, use_json, days):
"""List trees from a give origin."""
cmd_list_trees(origin, use_json)
cmd_list_trees(origin, use_json, days)


@results.command()
Expand Down
5 changes: 2 additions & 3 deletions kcidev/subcommands/results/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ def get_command_summary(command_data):
return inconclusive_cmd, pass_cmd, fail_cmd


def cmd_list_trees(origin, use_json):
def cmd_list_trees(origin, use_json, days):
logging.info(f"Listing trees for origin: {origin}")
trees = dashboard_fetch_tree_list(origin, use_json)
trees = dashboard_fetch_tree_list(origin, use_json, days)
logging.debug(f"Found {len(trees)} trees")

if use_json:
kci_msg(json.dumps(list(map(lambda t: create_tree_json(t), trees))))
return
Expand Down