Unable to build SonarSource/sonarcloud-github-action on linux/arm64

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps): Github
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI: Github Actions
  • Scanner command used when applicable (private details masked):
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
  • Languages of the repository: Go
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
Build container for action use: '/opt/actions-runner/_work/_actions/SonarSource/sonarcloud-github-action/master/Dockerfile'.
  /usr/bin/docker build -t 047d28:f819941c429e498eb1a273a806fb2870 -f "/opt/actions-runner/_work/_actions/SonarSource/sonarcloud-github-action/master/Dockerfile" "/opt/actions-runner/_work/_actions/SonarSource/sonarcloud-github-action/master"
  #0 building with "default" instance using docker driver
  
  #1 [internal] load build definition from Dockerfile
  #1 transferring dockerfile: 1.19kB done
  #1 DONE 0.0s
  
  #2 [internal] load metadata for docker.io/sonarsource/sonar-scanner-cli:11.1
  #2 DONE 0.7s
  
  #3 [internal] load .dockerignore
  #3 transferring context: 2B done
  #3 DONE 0.0s
  
  #4 [1/6] FROM docker.io/sonarsource/sonar-scanner-cli:11.1@sha256:0b90dedf01ef875d69a5a151f73d72b8288a319b39cdfd2ee32a729027a00785
  #4 DONE 0.0s
  
  #5 [internal] load build context
  #5 transferring context: 65B done
  #5 DONE 0.0s
  
  #6 [2/6] WORKDIR /opt
  #6 CACHED
  
  #7 [3/6] COPY entrypoint.sh /entrypoint.sh
  #7 CACHED
  
  #8 [4/6] RUN chmod +x /entrypoint.sh
  #8 0.172 exec /bin/sh: exec format error
  #8 ERROR: process "/bin/sh -c chmod +x /entrypoint.sh" did not complete successfully: exit code: 1
  ------
   > [4/6] RUN chmod +x /entrypoint.sh:
  0.172 exec /bin/sh: exec format error
  ------
  Dockerfile:28
  --------------------
    26 |     # Prepare entrypoint
    27 |     COPY entrypoint.sh /entrypoint.sh
    28 | >>> RUN chmod +x /entrypoint.sh
    29 |     COPY cleanup.sh /cleanup.sh
    30 |     RUN chmod +x /cleanup.sh
  --------------------
  ERROR: failed to solve: process "/bin/sh -c chmod +x /entrypoint.sh" did not complete successfully: exit code: 1
  Warning: Docker build failed with exit code 1, back off 5.783 seconds before retry.
  • Steps to reproduce
  • Potential workaround

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Up, we are facing the same issue

Hi,

Welcome to the community!

Could you both share your pipeline & build configuration, please?

 
Thx,
Ann

Hi, below is the Github Actions workflow with configuration

jobs:
  code-quality:
    timeout-minutes: 45
    runs-on: [ self-hosted,linux,arm64,ubuntu,public ]
    steps:
...
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        if: ${{ inputs.enable-sonarcloud-check == true && steps.filter.outputs.changed == 'true' }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        with:
          projectBaseDir: ${{ inputs.target }}
          args: >
            -Dsonar.branch.name=${GIT_BRANCH}
            -Dsonar.verbose=true
            -Dsonar.go.coverage.reportPaths=coverage.out

I think the image sonarsource/sonar-scanner-cli:11.1 does not have linux/arm64 supported (https://hub.docker.com/r/sonarsource/sonar-scanner-cli), I can see this error below when pulling it in my Mac M1 machine

 sonarcloud-github-action git:(master) docker pull --platform linux/arm64 docker.io/sonarsource/sonar-scanner-cli:11.1
11.1: Pulling from sonarsource/sonar-scanner-cli
9a0f8ca95549: Already exists
f6c81cf32813: Already exists
ef33d0945dc7: Already exists
30102dc55d4b: Already exists
4a7c91ac5b9c: Already exists
4f4fb700ef54: Already exists
Digest: sha256:0b90dedf01ef875d69a5a151f73d72b8288a319b39cdfd2ee32a729027a00785
Status: Downloaded newer image for sonarsource/sonar-scanner-cli:11.1

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview docker.io/sonarsource/sonar-scanner-cli:11.1
image with reference docker.io/sonarsource/sonar-scanner-cli:11.1 was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64
1 Like

Hi,

Thanks for those details. I’ve flagged this for the team.

 
Ann

Hi G Ann Campbell, is there any update?

Hi,

We would both see it at the same time, here in this thread.

 
Ann

Hello @lam.tran ,

Our plan is to move away from docker-based GitHub Actions into composite actions. This change should solve your issue.

Feel free to track the ticket’s progress to stay up to date.

1 Like

Hi @lam.tran,

We have just released sonarqube-scan-action@v4.1.0. Version v4.0.0 of the GitHub action removes Docker, moving to composite actions. v4.1.0 brings a series of improvements over v4.0.0 and unifies the GitHub actions for SonarQube Server and Cloud into a single action that works for both.

You can read more about:

Would you mind trying this new version and coming back to us in case of issues?
We hope it addresses your problem.

Best regards,
Antonio

1 Like

Thanks so much Antonio

2 Likes