-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use the plugin in Bitbucket pipeline to generate the report? (SonarQube version: 25.2.0.102705) #436
Comments
Using sonar-cnes-report in Bitbucket Pipelines To generate a report using sonar-cnes-report in a Bitbucket Pipeline, follow these steps: 1. Run SonarQube AnalysisBefore generating a report, ensure that SonarQube analysis is performed. image: maven:3.8.6-openjdk-11
pipelines:
default:
- step:
name: SonarQube Analysis
services:
- docker
script:
- echo "Running SonarQube scan..."
- mvn sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN 2. Install sonar-cnes-report and Generate ReportAfter SonarQube analysis is complete, install sonar-cnes-report and generate the report. image: node:18
pipelines:
default:
- step:
name: SonarQube Analysis
services:
- docker
script:
- echo "Running SonarQube scan..."
- mvn sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN
- step:
name: Generate Sonar Report
image: python:3.9
script:
- echo "Installing sonar-cnes-report..."
- pip install sonar-cnes-report
- echo "Generating report..."
- sonar-cnes-report -s $SONAR_HOST_URL -t $SONAR_TOKEN -p my_project_key -f html,json
- ls -l
- echo "Uploading report as artifact..."
artifacts:
- cnes-report/*.html
- cnes-report/*.json 3. Configure Environment VariablesEnsure the following environment variables are set in Bitbucket Repository Settings → Repository variables:
4. Expected Outcome
Now, you can download the reports from the Bitbucket Pipelines UI. |
Fixing "Could not find a version that satisfies the requirement sonar-cnes-report" in Bitbucket Pipelines If your Bitbucket Pipeline shows the error: ERROR: Could not find a version that satisfies the requirement sonar-cnes-report It means that sonar-cnes-report is not available on PyPI and needs to be manually downloaded. 🔹 Possible Causes & Solutions 1️⃣ Package is Not on PyPI The sonar-cnes-report tool is a standalone CLI tool available on GitHub, not a Python package. ✅ Solution: Download and execute it manually: wget https://github.com/cnescatlab/sonar-cnes-report/releases/latest/download/sonar-cnes-report.jar Then, run the tool using: java -jar sonar-cnes-report.jar -s $SONAR_HOST_URL -t $SONAR_TOKEN -p my_project_key -f html,json 2️⃣ Python Version Compatibility If you still need pip install, first verify your Python version in the pipeline: python --version sonar-cnes-report might not support older versions. ✅ Solution: Upgrade Python in the Bitbucket pipeline: image: python:3.9 3️⃣ Check for Private Index (Custom Repository) If your company has a private PyPI repository, sonar-cnes-report might be hosted there. ✅ Solution: Try installing from an alternative repository: pip install --index-url=https://your-private-repo/simple sonar-cnes-report 🔹 Final Working Bitbucket Pipeline Example Here’s how you can correctly integrate sonar-cnes-report in Bitbucket Pipelines: image: openjdk:11 pipelines:
✅ Key Takeaways 🚫 You can't install sonar-cnes-report via pip. 📥 Download the .jar file instead and run it using java -jar. 🛠 Ensure your pipeline has Java installed. 🔍 If needed, check for a private PyPI repository. |
I have this problem This SonarQube version is not supported by this cnesreport version.
This is the pipeline step
|
Find the latest release that supports SonarQube 25.x. |
I am using version 5.0.1 but the warning persists. this command download the last version
warning
artifacts are also not generated |
how to use the plugin in Bitbucket pipeline to generate the report?
The text was updated successfully, but these errors were encountered: