From 995620efbeb130f42eb396bc05cc178059de9f5b Mon Sep 17 00:00:00 2001 From: krikkrob <38075357+krikkrob@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:49:58 +0200 Subject: [PATCH] Qepm 1117 test artifacts integrate artifact storing flow into important reusable workflows (#4) Added if condition when input flags are not set Improved debugging Removed string literals from path Changed commit hash back to latest master Support spaces in source parameter --- entrypoint.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 4359911..843396a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -115,20 +115,27 @@ main() { aws --version # Iterate over $INPUT_SOURCE multiline string and run aws s3 $COMMAND - while IFS= read -r source; do +while IFS= read -r source; do if [ -n "$source" ]; then - if [ "$COMMAND" == "cp" ] || [ "$COMMAND" == "mv" ] || [ "$COMMAND" == "sync" ] - then - echo "aws s3 $COMMAND \"$source\" $INPUT_DESTINATION $INPUT_FLAGS" - aws s3 "$COMMAND" "$source" "$INPUT_DESTINATION" "$INPUT_FLAGS" + if [ "$COMMAND" == "cp" ] || [ "$COMMAND" == "mv" ] || [ "$COMMAND" == "sync" ]; then + if [ -n "$INPUT_FLAGS" ]; then + cmd="aws s3 $COMMAND \"$source\" $INPUT_DESTINATION $INPUT_FLAGS" + echo "Executing command: $cmd" + $cmd + else + cmd="aws s3 $COMMAND \"$source\" $INPUT_DESTINATION" + echo "Executing command: $cmd" + $cmd + fi else - echo "aws s3 $COMMAND \"$source\" $INPUT_FLAGS" - aws s3 "$COMMAND" "$source" "$INPUT_FLAGS" + cmd="aws s3 $COMMAND \"$source\" $INPUT_FLAGS" + echo "Executing command: $cmd" + $cmd fi else echo "Source is empty, skipping AWS S3 command." fi - done <<< "$INPUT_SOURCE" +done <<< "$INPUT_SOURCE" } main