Aws-s3 cp errors on --exclude argument

I am trying to run an aws s3 cp using the aws-s3 orb.

version: 2.1

orbs:
  aws-cli: circleci/aws-cli@4.1.2
  aws-s3: circleci/aws-s3@4.0.0
...
jobs:
  deploy:
    docker:
      - image: cimg/base:current
    steps:
      - checkout
      - aws-cli/setup:
          role_arn: arn:aws:iam::123456789:role/circleci-role
      - aws-s3/copy:
          arguments: |
              --recursive \
              --exclude ".git*" \
              --exclude ".circleci*" \
              --exclude "README.md"
          from: ./
          to: s3://www.abc.com

When running it with the --exclude arguments, I get the following error:

+ aws s3 cp ./ s3://www.abc.com --profile default --recursive '\
--exclude' '"*.git*"' '\
--exclude' '"*.circleci*"' '\
--exclude' '"*README.md"'

Unknown options: \
--exclude,"*.git*",\
--exclude,"*.circleci*",\
--exclude,"*README.md"

Exited with code exit status 252

Any idea what I am doing wrong? When I leave the --exclude arguments out, it runs fine.

Try placing single quotes around the values rather than double quotes.

This is a pure guess, but the output you have provided seems to start placing single quotes around the double quotes twice which is either an error with the parser or the print output function.

1 Like

Thank you. I tried your suggestion, but no luck. It complained just the same.

--exclude' ''\''.git*'\''' '\
--exclude' ''\''.circleci*'\''' '\
--exclude' ''\''README.md'\'''

Unknown options: \
--exclude,'.git*',\
--exclude,'.circleci*',\
--exclude,'README.md'

I ended up running it via the aws-cli command which worked fine. Odd.

      - run:
          name: Copy to S3 Bucket Using AWS CLI 
          command: aws s3 cp ./ s3://www.abc.com --recursive --include "*" --exclude ".git*" --exclude ".circleci*"  --exclude "README.md"

Iā€™m getting this error too. A bug either in the documentation or in the orb itself, seemingly both. Can we get a fix for this.