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

aws command not found orb 3.1.1 #44

Closed rodolfoIOET closed 1 year ago

rodolfoIOET commented 1 year ago

Orb version 3.1.1

Describe the bug I'm getting "/bin/bash: line 14: aws: command not found" when using "aws-s3/sync"

To Reproduce

my_job: docker:

Expected behavior

successfully set up aws-cli, because "install-aws-cli" param is default to true

Additional context I think this is because the Shebang used in the orb source: #!/bin/sh and this might be related https://github.com/CircleCI-Public/aws-s3-orb/issues/4

kelvintaywl commented 1 year ago

Hi @rodolfoIOET

would your project on CircleCI be a private repository? If so, can you submit a support ticket here @ https://circleci.zendesk.com/hc/en-us/requests/new ? From there, we (Support team) can dig deeper and look at your CircleCI build to advise further.

Thank you!

qops1981 commented 1 year ago

I am running into the same thing. For me! it looks like when you pass the when: parameter in IT IS NOT passing to the "Install AWS CLI - latest" AND "Configure AWS Access Key ID" steps. These steps are notably missing when the step before fails.

      - run:
          name: "Check the pre-existence of the deploy"
          command: |
            echo "${DEPLOY_PATH}"
            sideshow staging is_deployed ${DEPLOY_PATH}
      - when:
          condition:
            equal: [ master, << pipeline.git.branch >> ]
          steps:
            - backup_deploy:
                bucket: staging
                current: "${DEPLOY_PATH}"
                when: on_success
      - aws-s3/copy:
          arguments: |
            --cache-control "public, max-age=15" \
            --acl bucket-owner-full-control
          from: build/code-snippet.js # build/${FILENAME}
          to: "s3://staging/sideshow/${DEPLOY_PATH}"
          when: always

image

kelvintaywl commented 1 year ago

hi @qops1981 @rodolfoIOET, thanks for reporting this.

I believe the issue is because:

To solve this, i think we would need to propagate the when parameter value to aws-cli/setup. We would then expect the aws-cli/setup to also respect this when value.

However, this is tricky too, since the aws-cli/setup command does not currently accept a when parameter: https://circleci.com/developer/orbs/orb/circleci/aws-cli#commands-setup

This likely requires some coordination on our team (CircleCI) to update both Orbs.

In the meantime, to unblock your cases, we can pre-emptively install the AWS CLI first. As such, can you try to modify your .circleci/config.yml as shown below?

# snippet; incomplete .circleci/config.yml

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

jobs:
  example:
    docker:
      - image: cimg/python:3.10
    steps:
+     - aws-cli/setup
      - run: echo "some required commands that may fail"
      - aws-s3/copy:
-         install-aws-cli: true
+         install-aws-cli: false
           # or, when: always
           when: on_fail
          ...
rodolfoIOET commented 1 year ago

@kelvintaywl, sorry I forgot to update. To solve this, I used aws-cli solely as a workaround (without aws-s3). I haven't tried the suggested solution by @kelvintaywl

qops1981 commented 1 year ago

@kelvintaywl This worked to unblock me! Thank you very much.

brivu commented 1 year ago

Hey All!

We've come out with a new standard for all AWS orbs where a user will be required to authenticate first. This means that you'll have to run the aws-cli/setup command first to authenticate first before using any of the S3 commands.

Thanks @kelvintaywl for your guidance!

Best, Brian