I am creating pipeline for Apex code using Bitbucket
My code is in apex language
.yml File is as below:
image: gcc:6.5
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: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- sonar
script:
- export SONAR_SCANNER_VERSION=4.7.0.2747
- export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
- export BW_OUTPUT=$HOME/.sonar/bw-output
- mkdir -p $BW_OUTPUT
- curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- export PATH=$SONAR_SCANNER_HOME/bin:$PATH
- curl --create-dirs -sSLo $HOME/.sonar/sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
- unzip -o $HOME/.sonar/sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
- build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT sfdx force:apex:test:run --testlevel RunLocalTests --codecoverage --resultformat tap --wait 2
- sonar-scanner -Dsonar.cfamily.build-wrapper-output=$BW_OUTPUT
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
master:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
Error I am facing :
+ build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT sfdx force:apex:test:run --testlevel RunLocalTests --codecoverage --resultformat tap --wait 2
build-wrapper: execvp: No such file or directory
Skipping cache upload for failed step
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.
It’s not clear to me why you’re using the build-wrapper with Apex. The two don’t go together. Just skip the build-wrapper step and go straight to analysis.
When I tried to integrate Salesforce Bitbucket repository, Sonar cloud provided some steps to follow. I followed those.
Want to integrate it to check code quality and test code coverage of Salesforce org.
I checked that documentation. But for Apex the sufficient details are not available is what I can see.
I am referring page: Apex | SonarCloud Docs
However if you can check the same for language JAVA, you can see detailed steps are given on link: Java | SonarCloud Docs
I am struggling in creating .yml file for my pipeline
With respect, you’re overcomplicating this. The docs are more elaborate for Java because they need to be. For Apex they don’t. Just check out the code and run SonarScanner. That’s really it.
As per attachment, I am creating Bitbucket Pipeline.
3rd step is to create a bitbucket-pipelines.yml file. There I have doubts. What code I need to add there if I want to analyze Apex code.
For rest all languages I can see sample snippet for .yml file but its not there for Apex.
Yes, Java/Maven/Grade has a different script. C/C++/Objective-C have a different script. C# has a different script. All the rest have exactly the same script.
You are overcomplicating this. Why do you so distrust the instructions given to you by the UI and by me repeatedly?
Can you create a new thread for the problem retrieving Quality Gate status, and provide all the details, including your pipeline code and the fact that it’s exactly what was provided by the onboarding?