Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Added if condition when input flags are not setÃ
Browse files Browse the repository at this point in the history
Improved debugging

Testing new approach

Removed string literals from path

Removed string literals from path

Changed commit hash back to latest master
  • Loading branch information
krikkrob committed Nov 8, 2023
1 parent 01c8dec commit a9ef51f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a9ef51f

Please sign in to comment.