Skip to content

Commit

Permalink
Add expire argument to process-allure-reports.py
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Kulachenko <oleg@nspcc.ru>
  • Loading branch information
vvarg229 committed Aug 15, 2023
1 parent e2cd420 commit 3120d35
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tools/src/process-allure-reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,25 @@ 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', type=int,
help='Expiration time in epochs (hours for current testnet and mainnet).'
'If expire is not provided, or if it is 0 or less, 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: 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 is not None and expire > 0:
base_cmd += f' --expire-at {expire}'

for subdir, dirs, files in os.walk(directory):
current_dir_name = os.path.basename(subdir)
for filename in files:
Expand Down Expand Up @@ -96,8 +104,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,
neofs_password)
put_combine_result_as_static_page(args.allure_report, args.neofs_domain, args.wallet, args.cid, args.run_id,
args.expire, neofs_password)

print(f'See report: https://http.{args.neofs_domain}/{args.cid}/{args.run_id}/{COMPLETE_FILE_NAME}')

0 comments on commit 3120d35

Please sign in to comment.