Hi,
We use the published CircleCI orb for performing the Sonarcloud scanning of our Lambda functions before deployment. We are in the process of migrating to the Arm64 architecture to take advantage of AWS cost savings and performance improvements. In order to properly compile the code, the CircleCI executor itself must also be Arm64. So we are now experiencing failures on the Sonarcloud step of our pipeline because it appears the downloaded binary is failing to execute.
The pipeline output shows:
/tmp/cache/scanner/.sonar
/tmp/cache/scanner/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner: 66: exec: /tmp/cache/scanner/sonar-scanner-5.0.1.3006-linux/jre/bin/java: Exec format error
Exited with code exit status 126
Can you please advise if there is a workaround for this or if a new version of the orb is on the way?
We have our own private orb called priv-code-analysis that wraps the sonarcloud orb with some other commands. I’ve trimmed our config file down to the relevant jobs/workflows and also included the orb source. The executor specified is the CircleCI published Arm64 version of their python3.9-node convenience image.
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
This orb provides functionality to perform testing and inspection of code quality
by using SonarCloud.
By default yarn test is executed, but any set of custom commands can be executed by providing
a list of steps to the test-command parameter.
Some additional parameters are supported to affect how test results are stored and integrated
with CircleCI, any SonarCloud specific configuration should be saved in a sonar-project.properties
file located in the root of the repository.
orbs:
aws-auth: xxxxx/aws-auth@1.2.0
aws-cli: circleci/aws-cli@2.0.6
slack: circleci/slack@4.2.0
sonarcloud: sonarsource/sonarcloud@2.0.0
executors:
default:
docker:
- image: cimg/node:14.17
jobs:
scan:
description: |
This job run test scripts, analyzes the results and sends them to SonarCloud
executor: << parameters.executor >>
parameters:
artifact-dest:
default: .
description: |
Testing artifacts found under the artifact-path parameter are moved
to this location under the ARTIFACTS tab of the job in CircleCI
type: string
artifact-path:
default: ""
description: |
The path that contains any testing artifacts created that can be attached
to the ARTIFACTS tab of the job in CircleCI
type: string
channel-name:
default: ""
description: |
The Slack channel to notify when the job fails. If left blank, no
notification will be sent.
type: string
executor:
default: default
description: |
Define executor to run this job
type: executor
resource-class:
default: medium
description: |
The CircleCI resource class to use when running the job
type: string
scan-prep:
default: []
description: |
A list of CircleCI steps to execute in preparation of testing/scanning
type: steps
test-command:
default:
- run: yarn test
description: |
A list of CircleCI steps to execute in order to run tests and generate
code coverage reports for SonarQube scanning.
type: steps
test-results-path:
default: ""
description: |
The path that contains any test results that you would like to be evaluated
under the TESTS tab of the job in CircleCI
type: string
workspace-path:
default: ~/workspace
description: |
Path to attach workspace
type: string
resource_class: << parameters.resource-class >>
steps:
- checkout
- aws-cli/install
- attach_workspace:
at: << parameters.workspace-path >>
- aws-auth/restore-credentials:
workspace-folder-name: aws-auth
- steps: << parameters.scan-prep >>
- steps: << parameters.test-command >>
- when:
condition: << parameters.artifact-path >>
steps:
- store_artifacts:
destination: << parameters.artifact-dest >>
path: << parameters.artifact-path >>
- when:
condition: << parameters.test-results-path >>
steps:
- store_test_results:
path: << parameters.test-results-path >>
- sonarcloud/scan
- when:
condition: << parameters.channel-name >>
steps:
- slack/notify:
channel: << parameters.channel-name >>
event: fail
mentions: <!here>
template: basic_fail_1