aws-actions / setup-sam

Action to set up AWS SAM CLI and add it to the PATH
Apache License 2.0
151 stars 23 forks source link

Intermittant Setup-Sam Failures #91

Closed Bhutania closed 9 months ago

Bhutania commented 10 months ago

Hi 👋🏽 ,

Not sure if this is the right place to post this issue or in actions/runner (or runner-images), but I figured I would post here first to rule out issues with the action itself.

I am experiencing somewhat intermittent failures when trying to setup sam on an ubuntu-22.04 runner from github.

Action Setup:

name: Setup sam.

description: Sets up AWS SAM with retries.

runs:
  using: "composite"
  steps:
    - uses: aws-actions/setup-sam@v2
      id: setup1
      continue-on-error: true
      with:
        use-installer: true

    - run: echo "SAM Setup Failed, 10 Second Timeout" && sleep 10
      if: ${{ steps.setup1.outcome == 'failure' }}
      shell: bash

    - uses: aws-actions/setup-sam@v2
      id: setup2
      continue-on-error: true
      if: ${{ steps.setup1.outcome == 'failure' }}
      with:
        use-installer: true

    - run: echo "SAM Setup Failed, 10 Second Timeout" && sleep 10
      if: ${{ steps.setup2.outcome == 'failure' }}
      shell: bash

    - uses: aws-actions/setup-sam@v2
      id: setup3
      if: ${{ steps.setup2.outcome == 'failure' }}
      with:
        use-installer: true

Here is a copy of the runner info for the last failure:

  Image: ubuntu-22.04
  Version: 20231205.1.0

Error message and retries:

Run aws-actions/setup-sam@v2
Error: Error:
/usr/bin/unzip -o -q /home/runner/work/_temp/5416c708-9217-4057-8852-a01b225e1e32
Run echo "SAM Setup Failed, 10 Second Timeout" && sleep 10
SAM Setup Failed, 10 Second Timeout
Run aws-actions/setup-sam@v2
Error: Error:
/usr/bin/unzip -o -q /home/runner/work/_temp/4dc53d00-a7c1-471e-bd54-f43ae8e8dd0e
Run echo "SAM Setup Failed, 10 Second Timeout" && sleep 10
SAM Setup Failed, 10 Second Timeout
Run aws-actions/setup-sam@v2
Error: Error:
/usr/bin/unzip -o -q /home/runner/work/_temp/d4efffda-8428-4661-9417-b86ad0e9ab7b

Unfortunately because of the issue's intermittent nature, I haven't been able to reproduce with debug logging. I'll keep trying though.

Normally the setup task is fine and has an output like this: image

I would appreciate it someone had any insight into this issue, or could point me in the right direction.

Thanks, Arnav

juho9000 commented 10 months ago

We're running into the same issue. Installing with Python seems to work, but we'd prefer not to do that. Running with debug logging does not give any more information, it shows you the unzip process and then the exact same failure. It seems to be able to unzip all files in the archive too based on the output.

GavinZZ commented 9 months ago

Hi @Bhutania and @juho9000 , thanks for cutting an issue. After some investigation, this seems to be due to a recent change to support caching when not specifying the SAM CLI version number. I'll need to look into it a bit more to figure out the exact issue.

If the intermittant failure is bugging you, please specify a version for now as a workaround until I push a fix.

with:
    use-installer: true
    version: "1.105.0"
GavinZZ commented 9 months ago

Pushed a fix in this PR. https://github.com/aws-actions/setup-sam/pull/93

When I enable caching when version is not specified in https://github.com/aws-actions/setup-sam/pull/91, I accidentally set the state to failed when failing to get latest SAM CLI release tag. Should just log the error and continue instead.

After the PR is merged, you do not need to use the workaround I mentioned above. Apologize for any inconvenience.

GavinZZ commented 9 months ago

Going to close this issue as I believe it's fixed. Feel free to open another issue if this is still happening.