rhysd / actionlint

:octocat: Static checker for GitHub Actions workflow files
https://rhysd.github.io/actionlint/
MIT License
2.58k stars 154 forks source link

Shellcheck errors when running from actionlint Docker container #153

Open politician opened 2 years ago

politician commented 2 years ago

Worfklow file:

name: deploy-docs

on:
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - run: yarn install

      - run: |
          git config --global user.name "GitHub Actions"
          git config --global user.email "actions@github.com"

      - run: echo test

If I run actionlint directly, no problem. However, if I run via Docker:

docker run -v $PWD:/project --workdir /project rhysd/actionlint:latest -verbose

Then I get the following:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
verbose: Linting all workflow files in repository: .
verbose: Detected project: /project
verbose: Collected 1 YAML files
verbose: Linting .github/workflows/deploy-docs.yaml
verbose: Using project at /project
verbose: Found 0 parse errors in 6 ms for .github/workflows/deploy-docs.yaml
`/usr/bin/shellcheck --norc -f json -x --shell bash -e SC1091,SC2194,SC2050,SC2154,SC2157 -` did not run successfully while checking script at line:10,col:9: /usr/bin/shellcheck was terminated. stderr: ""

Note: If I remove - run: echo test it works

SoumayaMauthoorMOJ commented 1 year ago

Hello any update on this issue? I get the same error when running through megalinter: https://github.com/oxsecurity/megalinter/issues/1136

rhysd commented 1 year ago

What is the platform of host machine? I haven't seen this issue. It seems that the Docker image expects linux/amd64 but it is actually linux/arm64.

The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

rhysd commented 1 year ago

I get the same error when running through megalinter

I don't know megalinter. So I can say nothing until it can be reproduced with only actionlint.

SoumayaMauthoorMOJ commented 1 year ago

Thanks for getting to me! I'm using a Mac M1. Does rhysd/actionlint support multi-arch?

SoumayaMauthoorMOJ commented 1 year ago

So just ran docker run --rm -v $(pwd):/repo --workdir /repo rhysd/actionlint:latest -color and everything working as expected so this is a problem with megalinter running on M1, not with the actionlint docker image itself

rhysd commented 1 year ago

Does rhysd/actionlint support multi-arch?

actionlint itself supports darwin/arm64. However I don't know shellcheck supports it or not. Does the following command run successfully?

n docker run --rm -v $(pwd):/repo --workdir /repo rhysd/actionlint:latest -color -shellcheck=

-shellcheck= disables shellcheck integration. If it runs successfully, this seems a problem of shellcheck.

SoumayaMauthoorMOJ commented 1 year ago

-shellcheck= worked perfectly thanks :-)