From 4e60935a1fc097d49822879ec34e8aec8106761f Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Tue, 3 Dec 2024 14:51:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Added=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..317783c --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Code Analysis Docker Image + +This Docker image is designed for code analysis using SonarQube on CodeFirst. It includes Python 3.12 and the SonarQube scanner. + +## Prerequisites + +- Access to Drone CI +- SonarQube token + +## Usage + +### Example Configuration + +Here is an example configuration for using this Docker image in a CI pipeline: + +```yaml +steps: + - name: code-analysis + image: hub.codefirst.iut.uca.fr/alix.jeudi--lemoine/codefirst-dronesonarplugin-python312 + commands: + # - Generate the report here + - /opt/sonar-scanner/bin/sonar-scanner -Dsonar.login=$PLUGIN_SONAR_TOKEN -Dsonar.projectKey=YOUR_PROJECT_KEY -Dsonar.host.url=$PLUGIN_SONAR_HOST -Dsonar.coverageReportPaths="coveragereport/SonarQube.xml" -Dsonar.coverage.exclusions="tests/**" -Dsonar.python.version=3 + settings: + sonar_host: https://codefirst.iut.uca.fr/sonar/ + sonar_token: + from_secret: SECRET_SONAR_TOKEN +``` + +### Drone Secret + +- `SECRET_SONAR_TOKEN`: Must be set on your project on Drone CI, you can create it here : https://codefirst.iut.uca.fr/sonar/account/security (select "User Token" type) + +### Environment Variables + +- `PLUGIN_SONAR_TOKEN`: Automaticaly set by Drone (sonar_token => PLUGIN_SONAR_TOKEN / xxx => PLUGIN_XXX). + +## Notes + +- Ensure that the SonarQube server URL and project key are correctly set. +- The Docker image includes the necessary dependencies for running the SonarQube scanner. \ No newline at end of file