image: amazon/aws-cli:latest
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &mobile-sonarqube-analysis
name: SonarCloud Analysis Mobile App
caches:
- sonar
script:
- pipe: sonarsource/sonarcloud-scan:1.4.0
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
EXTRA_ARGS: '-Dsonar.projectKey=Together_testreactnativeproj -Dsonar.organization=we-are-nova'
- pipe: sonarsource/sonarcloud-quality-gate:0.1.6
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
EXTRA_ARGS: '-Dsonar.projectKey=Together_testreactnativeproj -Dsonar.organization=we-are-nova'
pipelines:
default:
- step: *mobile-sonarqube-analysis
pull-requests:
'**':
- step: *mobile-sonarqube-analysis
branches:
"**":
- step: *mobile-sonarqube-analysis
****ERROR** LOGS**
+ umask 000
+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="master" https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...
+ git reset --hard d4508fbb54b5ec3833808a8c2d1e55bd645eb399
HEAD is now at d4508fb rmd
+ git config user.name bitbucket-pipelines
+ git config user.email commits-noreply@bitbucket.org
+ git config push.default current
+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/
+ git remote set-url origin http://bitbucket.org/$BITBUCKET_REPO_FULL_NAME
+ git reflog expire --expire=all --all
+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude
+ chmod 777 $BUILD_DIR
Cache "sonar": Downloading
Cache "sonar": Not found
Images used:
build : docker.io/amazon/aws-cli@sha256:a009caddf90b3834fcb85dd9648dd0429e55702dd55b2707587fb16d8070a220
+ docker container run \
--volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \
--volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \
--volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan \
--workdir=$(pwd) \
--label=org.bitbucket.pipelines.system=true \
--env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \
--env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \
--env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \
--env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \
--env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \
--env=CI="$CI" \
--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \
--env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \
--env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \
--env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \
--env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \
--env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \
--env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \
--env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \
--env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \
--env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \
--env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \
--env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \
--env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \
--env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \
--env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \
--env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \
--env=DOCKER_HOST="tcp://host.docker.internal:2375" \
--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan" \
--env=EXTRA_ARGS="-Dsonar.projectKey=Together_testreactnativeproj -Dsonar.organization=we-are-nova" \
--env=SONAR_TOKEN="${SONAR_TOKEN}" \
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
sonarsource/sonarcloud-scan:1.4.0
Unable to find image 'sonarsource/sonarcloud-scan:1.4.0' locally
1.4.0: Pulling from sonarsource/sonarcloud-scan
743f2d6c1f65: Pulling fs layer
5c14188d0980: Pulling fs layer
84a54a21b0f2: Pulling fs layer
d9d1bc98b287: Pulling fs layer
c99e982badff: Pulling fs layer
50c6b4dfde57: Pulling fs layer
a561eaec2f8f: Pulling fs layer
ea88b09234a3: Pulling fs layer
83613aeae58d: Pulling fs layer
5d476eee175a: Pulling fs layer
3d3951d29cc9: Pulling fs layer
a561eaec2f8f: Waiting
ea88b09234a3: Waiting
83613aeae58d: Waiting
5d476eee175a: Waiting
3d3951d29cc9: Waiting
d9d1bc98b287: Waiting
c99e982badff: Waiting
50c6b4dfde57: Waiting
84a54a21b0f2: Download complete
5c14188d0980: Download complete
c99e982badff: Verifying Checksum
c99e982badff: Download complete
743f2d6c1f65: Verifying Checksum
743f2d6c1f65: Download complete
d9d1bc98b287: Verifying Checksum
d9d1bc98b287: Download complete
ea88b09234a3: Verifying Checksum
ea88b09234a3: Download complete
a561eaec2f8f: Verifying Checksum
a561eaec2f8f: Download complete
5d476eee175a: Verifying Checksum
5d476eee175a: Download complete
50c6b4dfde57: Verifying Checksum
50c6b4dfde57: Download complete
83613aeae58d: Verifying Checksum
83613aeae58d: Download complete
3d3951d29cc9: Verifying Checksum
3d3951d29cc9: Download complete
743f2d6c1f65: Pull complete
5c14188d0980: Pull complete
84a54a21b0f2: Pull complete
d9d1bc98b287: Pull complete
c99e982badff: Pull complete
50c6b4dfde57: Pull complete
a561eaec2f8f: Pull complete
ea88b09234a3: Pull complete
83613aeae58d: Pull complete
5d476eee175a: Pull complete
3d3951d29cc9: Pull complete
Digest: sha256:8b3690666e34b17bbab84370e569151742f06f21575fbe05e5c066c160b7c968
Status: Downloaded newer image for sonarsource/sonarcloud-scan:1.4.0
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.3 Oracle Corporation (64-bit)
INFO: Linux 5.13.0-1022-aws amd64
INFO: Bitbucket Cloud Pipelines detected, no host variable set. Defaulting to sonarcloud.io.
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.0.0.29939
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=583ms
INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=139ms
INFO: Load/download plugins (done) | time=33285ms
INFO: Loaded core extensions: developer-scanner
INFO: Found an active CI vendor: 'Bitbucket Pipelines'
INFO: Detected project key 'Together_testreactnativeproj' from 'Bitbucket Cloud Pipelines'
INFO: Detected organization key 'we-are-nova' from 'Bitbucket Cloud Pipelines'
INFO: Load project settings for component key: 'Together_testreactnativeproj'
INFO: Load project settings for component key: 'Together_testreactnativeproj' (done) | time=110ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=1ms
INFO: Project key: Together_testreactnativeproj
INFO: Base dir: /opt/atlassian/pipelines/agent/build
INFO: Working dir: /opt/atlassian/pipelines/agent/build/.scannerwork
INFO: Load project branches
INFO: Load project branches (done) | time=116ms
INFO: Check ALM binding of project 'Together_testreactnativeproj'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project 'Together_testreactnativeproj' (done) | time=104ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=105ms
INFO: Load branch configuration
INFO: Detected analysis for branch 'master'
INFO: Auto-configuring branch master
INFO: Load branch configuration (done) | time=2ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=149ms
INFO: Load active rules
INFO: Load active rules (done) | time=4081ms
INFO: Organization key: we-are-nova
INFO: Branch name: master, type: long-lived
INFO: Load project repositories
INFO: Load project repositories (done) | time=115ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Excluded sources: **/build-wrapper-dump.json
INFO: 106 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for c: Sonar way
INFO: Quality profile for cpp: Sonar way
INFO: Quality profile for java: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for json: Sonar way
INFO: Quality profile for objc: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: Quality profile for yaml: Sonar way
INFO: ------------- Run sensors on module Together_testreactnativeproj
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=114ms
INFO: Sensor JavaSensor [java]
INFO: Configured Java source version (sonar.java.source): none
INFO: JavaClasspath initialization
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 47.416s
INFO: Final Memory: 32M/134M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75)
at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:319)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:205)
at org.sonar.java.JavaFrontend.<init>(JavaFrontend.java:96)
at org.sonar.plugins.java.JavaSensor.execute(JavaSensor.java:112)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:66)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:48)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:446)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:442)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:400)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:58)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:52)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
e[31m✖ SonarCloud analysis failed. (exit code = 1)e[0m
Skipping cache upload for failed step
Searching for files matching artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/**
Artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/** matched 1 files with a total size of 6.7 KiB
Compressed files matching artifact pattern .bitbucket/pipelines/generated/pipeline/pipes/** to 2 KiB in 0 seconds
Uploading artifact of 2 KiB
Successfully uploaded artifact in 0 seconds
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.
Hey there.
Please note that it’s not appropriate to simply paste configuration/logs. It’s expected that you discuss what you’re trying to do, what you’ve tried, what has/hasn’t worked… this is a community forum, not a ticketing system.
Based on your logs, it seems your repository contains a lot of different languages.
You’ll want to adjust your analysis scope to only include the files you want to analyzed – which sounds like the Javascript files.
For example, are those files isolated to a specific folder in your repository?