Skip to content

Commit 02601f5

Browse files
committed
workflows: Update conformance client
* client was not checking if artifact was cached already: do so to pass test_artifact_cache * Also add some better logging These changes are copied from the client embedded in tuf-conformance Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent df7f9d6 commit 02601f5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/scripts/conformance-client.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# SPDX-License-Identifier: MIT OR Apache-2.0
66

77
import argparse
8+
import logging
89
import os
910
import shutil
1011
import sys
@@ -49,7 +50,8 @@ def download_target(
4950
target_info = updater.get_targetinfo(target_name)
5051
if not target_info:
5152
raise RuntimeError(f"{target_name} not found in repository")
52-
updater.download_target(target_info)
53+
if not updater.find_cached_target(target_info):
54+
updater.download_target(target_info)
5355

5456

5557
def main() -> int:
@@ -61,6 +63,7 @@ def main() -> int:
6163
parser.add_argument("--target-name", required=False)
6264
parser.add_argument("--target-dir", required=False)
6365
parser.add_argument("--target-base-url", required=False)
66+
parser.add_argument("-v", "--verbose", action="count", default=0)
6467

6568
sub_command = parser.add_subparsers(dest="sub_command")
6669
init_parser = sub_command.add_parser(
@@ -81,6 +84,15 @@ def main() -> int:
8184

8285
command_args = parser.parse_args()
8386

87+
if command_args.verbose <= 1:
88+
loglevel = logging.WARNING
89+
elif command_args.verbose == 2:
90+
loglevel = logging.INFO
91+
else:
92+
loglevel = logging.DEBUG
93+
94+
logging.basicConfig(level=loglevel)
95+
8496
# initialize the TUF Client Example infrastructure
8597
if command_args.sub_command == "init":
8698
init(command_args.metadata_dir, command_args.trusted_root)

0 commit comments

Comments
 (0)