CircleCI-Public / aws-s3-orb

Integrate Amazon AWS S3 with your CircleCI CI/CD pipeline easily with the aws-s3 orb.
https://circleci.com/orbs/registry/orb/circleci/aws-s3
MIT License
10 stars 20 forks source link

Cannot find a definition for command named copy #47

Closed gavriguy closed 1 year ago

gavriguy commented 1 year ago

Orb Version circleci/aws-s3@3.1.1

Describe the bug I'm getting a build error when trying to run aws-s3/copy

To Reproduce

I added the following step (it's inside a custom command). All AWS env params are set.

 - aws-s3/copy:
                arguments: |
                  --acl public-read \
                  --cache-control "max-age=10"
                from: <FILE_LOCATION>
                to: <S3_LOCATION>

Expected behavior

Being able to run the copy command.

gavriguy commented 1 year ago

Also here are the list of orbs I'm currently using:

orbs:
  jq: circleci/jq@2.2.0
  gh: circleci/github-cli@2.2.0
  aws-ecr: circleci/aws-ecr@8.2.1
  aws-s3: circleci/aws-s3@3.1.1
kelvintaywl commented 1 year ago

hey folks,

I was also able to reproduce a similar issue here:

config:

version: 2.1

orbs:
  aws-cli: circleci/aws-cli@3.1.4
  aws-s3: circleci/aws-s3@3.1.1

jobs:
  cp:
    executor: aws-cli/default
    steps:
      - checkout
      - aws-cli/setup
      - aws-s3/copy:
          install-aws-cli: false
          arguments: |
            --cache-control "public, max-age=15" \
            --acl bucket-owner-full-control
          from: README.md
          to: "s3://aws-s3-orb-explore/source-code/"

workflows:
  main:
    jobs:
      - cp

failed build (public link): https://app.circleci.com/pipelines/github/kelvintaywl-cci/aws-s3-orb-explore/1/workflows/3563f4dd-3895-4a14-ad4f-8c35d36b9a88/jobs/2

error:

Unknown options: --cache-control public, max-age=15 --acl bucket-owner-full-control

I ended up abandoning the use of the Orb, and using the AWS CLI directly: https://github.com/kelvintaywl-cci/aws-s3-orb-explore/commit/d6eb30b781c94f4fd3e02ed44f7168a3a345b306

I believe there may be issues using the $@ for expanding the options here? https://github.com/CircleCI-Public/aws-s3-orb/blob/d76b756615b0c423b978a9fc0a329d952b5863a3/src/scripts/copy.sh#L6-L14

brivu commented 1 year ago

Hey @gavriguy - I just wanted to follow up here. I fixed this issue with PR #54 and tested it with your exact values:

--cache-control public, max-age=15 --acl bucket-owner-full-control

Just a note though, all argument values must be passed in a single line like you have above. Multi-line values will cause jobs to fail.

I'll cutting a new release soon with this fix available. Thanks for your patience on this!