From 914e5742dbe8b3ed2578223de2e076f32dc7ab52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Gr=C3=BCner?= <47506558+MegaRedHand@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:58:10 -0300 Subject: [PATCH] fix: extract keystore's password in independent step --- kurtosis_package/keys.star | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kurtosis_package/keys.star b/kurtosis_package/keys.star index 241e31d3..e24646f7 100644 --- a/kurtosis_package/keys.star +++ b/kurtosis_package/keys.star @@ -63,8 +63,7 @@ def generate_keys(plan, egnkey_service_name, key_type, artifact_name): output_dir = "/_output" cmd = "set -e ; rm -rf {output} && \ - egnkey generate --key-type {type} --num-keys 1 --output-dir {output} ; \ - cat {output}/password.txt | tr -d '\n'".format( + egnkey generate --key-type {type} --num-keys 1 --output-dir {output}".format( output=output_dir, type=key_type ) @@ -73,7 +72,6 @@ def generate_keys(plan, egnkey_service_name, key_type, artifact_name): recipe=ExecRecipe(command=["sh", "-c", cmd]), description="Generating " + key_type + " key", ) - password = result["output"] artifact_name = plan.store_service_files( service_name=egnkey_service_name, @@ -82,6 +80,16 @@ def generate_keys(plan, egnkey_service_name, key_type, artifact_name): description="Storing " + key_type + " key", ) + # NOTE: we do this in another step to avoid egnkey's output from being stored + cmd = "set -e ; cat {}/password.txt | tr -d '\n'".format(output_dir) + + result = plan.exec( + service_name=egnkey_service_name, + recipe=ExecRecipe(command=["sh", "-c", cmd]), + description="Extracting keystore password", + ) + password = result["output"] + cmd = "set -e ; cat {}/private_key_hex.txt | tr -d '\n'".format(output_dir) result = plan.exec(