From 8c2cc1a4bf151e91d2ce4b233e009cc1c44817cd Mon Sep 17 00:00:00 2001 From: Oleg Kulachenko Date: Tue, 15 Aug 2023 22:28:32 +0400 Subject: [PATCH] Add expire argument to process-allure-reports.py Signed-off-by: Oleg Kulachenko --- tools/src/process-allure-reports.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/src/process-allure-reports.py b/tools/src/process-allure-reports.py index 2131de5d3..791a5ed94 100644 --- a/tools/src/process-allure-reports.py +++ b/tools/src/process-allure-reports.py @@ -17,17 +17,24 @@ def parse_args(): parser.add_argument('--cid', required=True, type=str, help='Container ID') parser.add_argument('--run_id', required=True, type=str, help='GitHub run ID') parser.add_argument('--allure_report', type=str, help='Path to generated allure report directory', - default='allure_report') + default='allure_report'), + parser.add_argument('--expire-at', type=int, + help='Expiration epoch. If epoch is not provided, or if it is 0, the report will be stored indefinitely', + default=None) + return parser.parse_args() def put_combine_result_as_static_page(directory: str, neofs_domain: str, wallet: str, cid: str, run_id: str, - password: str) -> None: + expire_at: int, password: str) -> None: base_cmd = ( f'NEOFS_CLI_PASSWORD={password} neofs-cli --rpc-endpoint st1.{neofs_domain}:8080 ' f'--wallet {wallet} object put --cid {cid} --timeout {PUT_TIMEOUT}s' ) + if expire_at is not None and expire_at > 0: + base_cmd += f' --expire-at {expire_at}' + for subdir, dirs, files in os.walk(directory): current_dir_name = os.path.basename(subdir) for filename in files: @@ -96,8 +103,9 @@ def get_password() -> str: combine_path = combine_report(args.allure_report) neofs_password = get_password() - put_combine_result_as_static_page(combine_path, args.neofs_domain, args.wallet, args.cid, args.run_id, neofs_password) - put_combine_result_as_static_page(args.allure_report, args.neofs_domain, args.wallet, args.cid, args.run_id, + put_combine_result_as_static_page(combine_path, args.neofs_domain, args.wallet, args.cid, args.run_id, args.expire_at, neofs_password) + put_combine_result_as_static_page(args.allure_report, args.neofs_domain, args.wallet, args.cid, args.run_id, + args.expire_at, neofs_password) print(f'See report: https://http.{args.neofs_domain}/{args.cid}/{args.run_id}/{COMPLETE_FILE_NAME}')