jakejarvis / s3-sync-action

🔄 GitHub Action to sync a directory with a remote S3 bucket 🧺
https://github.com/marketplace/actions/s3-sync
MIT License
1.04k stars 476 forks source link

AWS_S3_BUCKET is not set. Quitting. #53

Open adam-snetiker opened 3 years ago

adam-snetiker commented 3 years ago

My AWS bucket is in fact set, but I keep getting this error message so my action won't work to completion. Should I include the static website endpoint instead or in addition to the bucket name? I know the bucket is correct, but it's not being recognized at all.

Screen Shot 2021-02-03 at 12 09 58 PM
andre-lx commented 3 years ago

Can you paste your step please?

aljones15 commented 3 years ago

Here are mine:

  update-s3-bucket:
    runs-on: ubuntu-latest
    steps:
      - name: 'S3 Bucket sync'
        uses: jakejarvis/s3-sync-action@master
        with:
          args: --acl public-read
        env:
          AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: ${{ secrets.AWS_REGION }} # optional: defaults to us-east-1
          SOURCE_DIR: 'reports'      # optional: defaults to entire repository

getting the same error

error is coming from here: https://github.com/jakejarvis/s3-sync-action/blob/7ed8b112447abb09f1da74f3466e4194fc7a6311/entrypoint.sh#L5-L8

andre-lx commented 3 years ago

Hi @aljones15.

I have the same configuration as you.

Can you try to set manually the bucket name in the action?

It looks like the secret is not being pulled.

aljones15 commented 3 years ago

did that now getting: AWS_ACCESS_KEY_ID is not set. Quitting.

yeah this is weird. any idea why the secrets are not showing up? They are definitely set.

  update-s3-bucket:
    runs-on: ubuntu-latest
    steps:
      - name: 'S3 Bucket sync'
        uses: jakejarvis/s3-sync-action@master
        with:
          args: --acl public-read
        env:
          AWS_S3_BUCKET: 's3://vaxcert-interop-reports'
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: ${{ secrets.AWS_REGION }} # optional: defaults to us-east-1
          SOURCE_DIR: 'reports'      # optional: defaults to entire repository
~                                                                                  

The secrets are set as Environment secrets perhaps they need to be Repository secrets or Organization secrets?

andre-lx commented 3 years ago

Not a clue. But it's definitely something with your secrets.

Try to delete the secrets and add it again. Are you using organisational secrets or repository ones? Try on the repo itself.

aljones15 commented 3 years ago

Thank you for the help. I was using environment secrets. I think the issue with those was that I was not telling it what environment to use. Using the repo level secrets did work, but now it can't find the dir I want to sync with the bucket.

andre-lx commented 3 years ago

The reports dir? What error did you get now?

aljones15 commented 3 years ago
The user-provided path ./reports does not exist.

I checked and I seem to be in an empty docker container, not sure how to get the dir that results from the test run to be available to the aws cli docker.

name: Node.js CI

on: [push]

jobs:
  test-node: 
    runs-on: ubuntu-latest
    timeout-minutes: 35
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm install
      - name: Run test with Node.js ${{ matrix.node-version }}
        run: npm run test-node
        continue-on-error: true
  update-s3-bucket:
    runs-on: ubuntu-latest
    needs: [test-node]
    steps:
      - name: 'Dir check'
        run: ls -la
      - name: 'S3 Bucket sync'
        uses: jakejarvis/s3-sync-action@master
        with:
          args: --acl public-read
        env:
          AWS_S3_BUCKET: 's3://vaxcert-interop-reports'
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: ${{ secrets.AWS_REGION }} # optional: defaults to us-east-1
          SOURCE_DIR: './reports'      # optional: defaults to entire repository
andre-lx commented 3 years ago

Why are you using two separated jobs?

You can add to the test-node (where you do the checkout) the 'S3 Bucket sync' step. Or, do the checkout again in the update-s3-bucket job. Since you are doing the checkout on the first job, and not the second one, you get the empty dir.

aljones15 commented 3 years ago

I'm a total noob with github actions. Thanks for the help and it is working. Just updated my s3 bucket/ website with fresh reports for the w3c. Thanks for your time and effort.

vitalykarasik commented 3 years ago

+1 - the same issue:

Screen Shot 2021-07-15 at 19 16 32
TriangleJuice commented 2 years ago

We have the same issue. Our code is nothing fancy and used to work. It stopped working when upgrading the Node version of our script from 10 to 14, but this should not be the culprit, since it is a different part of the script.

Update: we found the issue. Right before it stopped working the repo was deleted and then restored. The GitHub secret was set at organisation level with custom access. The binding was lost after the deletion/restore. Everything is working fine again now.

wtondossantos commented 6 months ago

name: Node.js CI

on: [push]

jobs: test-node: runs-on: ubuntu-latest timeout-minutes: 35 strategy: matrix: node-version: [14.x] steps:

image

needs: [test-node]
steps:
  - name: 'Dir check'
    run: ls -la
  - name: 'S3 Bucket sync'
    uses: jakejarvis/s3-sync-action@master
    with:
      args: --acl public-read
    env:
      AWS_S3_BUCKET: 's3://vaxcert-interop-reports'
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      AWS_REGION: ${{ secrets.AWS_REGION }} # optional: defaults to us-east-1
      SOURCE_DIR: './reports'      # optional: defaults to entire repository