peterkimzz / aws-ssm-send-command

Github Actions for using AWS SSM Send-Command
MIT License
61 stars 32 forks source link

unable to fork/exec /usr/bin/sh #18

Open slipcon opened 2 years ago

slipcon commented 2 years ago

Trying to use aws-ssm-send-command, simple examples are all failing.

name: Deploy using AWS SSM Send-Command 

on:
    push:
        branches: [main]

jobs:
    start:
        runs-on: ubuntu-latest 

        steps:
            - uses: actions/checkout@v2

            - name: AWS SSM Send Command
              uses: peterkimzz/aws-ssm-send-command@master
              id: ssm
              with:
                  aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID  }}
                  aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY  }}
                  aws-region: us-gov-east-1
                  instance-ids: ${{ secrets.INSTANCE_ID  }}
                  comment: Deploy the main branch
                  working-directory: /home/ec2-user/test-gh-repo
                  command: ls -l

The github action runs successfully, I get the command ID from the output, and view it using AWS CLI, and it always says:

            "CommandPlugins": [
                {
                    "Status": "Failed",
                    "ResponseStartDateTime": 1644522501.751,
                    "StandardErrorUrl": "",
                    "OutputS3BucketName": "",
                    "OutputS3Region": "us-gov-east-1",
                    "OutputS3KeyPrefix": "",
                    "ResponseCode": 1,
                    "Output": "\n----------ERROR-------\nfailed to run commands: fork/exec /usr/bin/sh: no such file or directory",
                    "ResponseFinishDateTime": 1644522501.785,
                    "StatusDetails": "Failed",
                    "StandardOutputUrl": "",
                    "Name": "aws:runShellScript"
                }

I can't figure out why its trying to run /usr/bin/sh - nor why thats failing - it exists on our instance and works fine.

any help?

akraxx commented 2 years ago

Hello,

Just got the same issue, for me, it's because the working directory does not exist