Sonarcloud and circle ci integration not working

  • CI system used Circle CI
  • Languages of the repository : kotlin, springboot 2.x

I setup sonarcloud and circle ci based on sonarcloud guide

after setting, I test ci integration, but get an error
I don’t understand why sonar-scanner error occured in ci.

#!/bin/bash -eo pipefail
set -e
VERSION=5.0.1.3006
SONAR_TOKEN=$SONAR_TOKEN
SCANNER_DIRECTORY=/tmp/cache/scanner
export SONAR_USER_HOME=$SCANNER_DIRECTORY/.sonar
OS=“linux”
echo $SONAR_USER_HOME

if [[ ! -x “$SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/bin/sonar-scanner” ]]; then
curl -Ol https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$VERSION-$OS.zip
unzip -qq -o sonar-scanner-cli-$VERSION-$OS.zip -d $SCANNER_DIRECTORY
fi

chmod +x $SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/bin/sonar-scanner
chmod +x $SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/jre/bin/java

cd .
$SCANNER_DIRECTORY/sonar-scanner-$VERSION-$OS/bin/sonar-scanner

/tmp/cache/scanner/.sonar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 44.9M 100 44.9M 0 0 156M 0 --:–:-- --:–:-- --:–:-- 156M
/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 2

CircleCI received exit code 2

Hey there.

Can you help me understand why you’re configuring your build this way and not using the CircleCI orb? CircleCI Developer Hub - sonarsource/sonarcloud