Skip to content
Merged
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
2 changes: 0 additions & 2 deletions kcidev/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
maestro,
results,
testretry,
validate,
watch,
)

Expand Down Expand Up @@ -64,7 +63,6 @@ def run():
cli.add_command(maestro.maestro)
cli.add_command(testretry.testretry)
cli.add_command(results.results)
cli.add_command(validate.validate)
cli.add_command(watch.watch)
cli()

Expand Down
3 changes: 2 additions & 1 deletion kcidev/subcommands/maestro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import click

from kcidev.subcommands.maestro.results import results
from kcidev.subcommands.maestro.validate import validate


@click.group(
Expand Down Expand Up @@ -37,7 +38,7 @@ def maestro(ctx):

# Add subcommands to the maestro group
maestro.add_command(results)

maestro.add_command(validate)

if __name__ == "__main__":
from kcidev.libs.common import main_kcidev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import click

from kcidev.subcommands.validate.boots import boots
from kcidev.subcommands.validate.builds import builds
from kcidev.subcommands.validate.builds_history import builds_history
from kcidev.subcommands.maestro.validate.boots import boots
from kcidev.subcommands.maestro.validate.builds import builds


@click.group(
Expand All @@ -14,7 +13,6 @@
Subcommands:
builds - Validate build results
boots - Validate boot results
builds-history - Validate builds history

\b
Examples:
Expand All @@ -25,8 +23,8 @@
kci-dev validate boots --all-checkouts --days <number-of-days>
kci-dev validate boots -commit <git-commit> --giturl <git-url> --branch <git-branch>
# Validate builds history
kci-dev validate builds-history --all-checkouts --days <number-of-days> --arch <architecture-filter>
kci-dev validate builds-history -commit <git-commit> --giturl <git-url> --branch <git-branch> --days <number-of-days>
kci-dev validate builds --history --all-checkouts --days <number-of-days> --arch <architecture-filter>
kci-dev validate builds --history -commit <git-commit> --giturl <git-url> --branch <git-branch> --days <number-of-days>
""",
invoke_without_command=True,
)
Expand All @@ -41,7 +39,6 @@ def validate(ctx):
# Add subcommands to the validate group
validate.add_command(builds)
validate.add_command(boots)
validate.add_command(builds_history)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from kcidev.libs.git_repo import get_tree_name, set_giturl_branch_commit
from kcidev.subcommands.results import trees

from .helper import get_build_stats, print_stats
from .helper import get_build_stats, get_builds_history_stats, print_stats


@click.command(
Expand All @@ -19,10 +19,18 @@
If above options are not provided, if will take latest/provided commit
checkout from the git folder specified.

Builds history validation, i.e. checking if number of builds is consistent
for different checkouts of the same git tree/branch, can be performed by the command
by providing --history option.

\b
Examples:
# Build validation
kci-dev validate builds --all-checkouts --days <number-of-days>
kci-dev validate builds -commit <git-commit> --giturl <git-url> --branch <git-branch>
# Build history validation
kci-dev validate builds --history --all-checkouts --days <number-of-days>
kci-dev validate builds --history --giturl <git-url> --branch <git-branch> --days <number-of-days>
""",
)
@click.option(
Expand Down Expand Up @@ -63,6 +71,11 @@
help="Select latest results available",
)
@click.option("--arch", help="Filter by arch")
@click.option(
"--history",
is_flag=True,
help="Check if number of builds is consistent for different checkouts of the same git tree/branch",
)
@click.option(
"--verbose",
is_flag=True,
Expand All @@ -81,6 +94,7 @@ def builds(
latest,
arch,
days,
history,
verbose,
):
final_stats = []
Expand All @@ -90,17 +104,34 @@ def builds(
raise click.UsageError(
"Cannot use --all-checkouts with --giturl, --branch, or --commit"
)
trees_list = ctx.invoke(trees, origin=origin, days=days, verbose=False)
for tree in trees_list:
giturl = tree["git_repository_url"]
branch = tree["git_repository_branch"]
commit = tree["git_commit_hash"]
tree_name = tree["tree_name"]
stats = get_build_stats(
ctx, giturl, branch, commit, tree_name, verbose, arch
)
if stats:
final_stats.append(stats)
if history:
trees_list = ctx.invoke(trees, origin=origin, days=days, verbose=False)
for tree in trees_list:
giturl = tree["git_repository_url"]
branch = tree["git_repository_branch"]
tree_name = tree["tree_name"]
stats = get_builds_history_stats(
ctx, giturl, branch, tree_name, arch, days, verbose
)
if stats:
final_stats.extend(stats)
else:
trees_list = ctx.invoke(trees, origin=origin, days=days, verbose=False)
for tree in trees_list:
giturl = tree["git_repository_url"]
branch = tree["git_repository_branch"]
commit = tree["git_commit_hash"]
tree_name = tree["tree_name"]
stats = get_build_stats(
ctx, giturl, branch, commit, tree_name, verbose, arch
)
if stats:
final_stats.append(stats)
elif history:
tree_name = get_tree_name(origin, giturl, branch)
final_stats = get_builds_history_stats(
ctx, giturl, branch, tree_name, arch, days, verbose
)
else:
giturl, branch, commit = set_giturl_branch_commit(
origin, giturl, branch, commit, latest, git_folder
Expand All @@ -110,15 +141,27 @@ def builds(
if stats:
final_stats.append(stats)
if final_stats:
headers = [
"tree/branch",
"Commit",
"Maestro\nbuilds",
"Dashboard\nbuilds",
"Build count\ncomparison",
"Missing build IDs",
"Builds with\nstatus mismatch",
]
max_col_width = [None, 40, 3, 3, 2, 30, 30]
if history:
headers = [
"tree/branch",
"Commit",
"Maestro\nbuilds",
"Dashboard\nbuilds",
"Build count\ncomparison",
"Missing build IDs",
]
max_col_width = [None, 40, 3, 3, 2, 30]

else:
headers = [
"tree/branch",
"Commit",
"Maestro\nbuilds",
"Dashboard\nbuilds",
"Build count\ncomparison",
"Missing build IDs",
"Builds with\nstatus mismatch",
]
max_col_width = [None, 40, 3, 3, 2, 30, 30]
table_fmt = "simple_grid"
print_stats(final_stats, headers, max_col_width, table_fmt)
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def get_builds(ctx, giturl, branch, commit, arch):
arch=arch,
)
except click.Abort:
kci_msg_red("Aborted while fetching dashboard builds")
kci_msg_red(f"{branch}/{commit}: Aborted while fetching dashboard builds")
return maestro_builds, None
except click.ClickException as e:
kci_msg_red(f"{branch}/{commit}: {e.message}")
return maestro_builds, None
return maestro_builds, dashboard_builds

Expand Down Expand Up @@ -211,7 +214,10 @@ def get_boots(ctx, giturl, branch, commit, arch):
arch=arch,
)
except click.Abort:
kci_msg_red("Aborted while fetching dashboard boots")
kci_msg_red(f"{branch}/{commit}: Aborted while fetching dashboard boots")
return maestro_boots, None
except click.ClickException as e:
kci_msg_red(f"{branch}/{commit}: {e.message}")
return maestro_boots, None
return maestro_boots, dashboard_boots

Expand Down Expand Up @@ -303,17 +309,20 @@ def get_builds_history(ctx, checkouts, arch):
paginate=False,
)

branch = c["data"]["kernel_revision"].get("branch")
try:
dashboard_builds = ctx.invoke(
builds,
giturl=c["data"]["kernel_revision"].get("url"),
branch=c["data"]["kernel_revision"].get("branch"),
branch=branch,
commit=commit,
count=True,
verbose=False,
arch=arch,
)
builds_history.append([commit, maestro_builds, dashboard_builds])
except click.Abort:
kci_msg_red("Aborted while fetching dashboard builds")
kci_msg_red(f"{branch}/{commit}: Aborted while fetching dashboard builds")
except click.ClickException as e:
kci_msg_red(f"{branch}/{commit}: {e.message}")
return builds_history
99 changes: 0 additions & 99 deletions kcidev/subcommands/validate/builds_history.py

This file was deleted.