Skip to content

Commit

Permalink
Merge pull request #350 from cnescatlab/feature-update-to-sq-lts9
Browse files Browse the repository at this point in the history
SonarQube LTS9 support
  • Loading branch information
diegorodriguez31 authored May 2, 2023
2 parents 93feddd + 6f5c475 commit 51cc2bf
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/java-continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11' ]
java: [ '11' ]
name: Java ${{ matrix.Java }} CI
steps:
- name: Check out repository code
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
run: mvn -B clean package
- name: Test cnes-report
env:
SONARQUBE_VERSION: 8.9-community
SONARQUBE_VERSION: 9.9-community
run: |
version=$(cat pom.xml | grep "<version>.*</version>" | head -1 |awk -F'[><]' '{print $3}');
echo "Starting docker";
Expand Down
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ This tool can be used in standalone as a JAR executable (with the command line)
- Run an analysis with sonar-scanner, maven, gradle, msbuild, etc.
- Execute cnesreport:
- In standalone, thanks to command line
- Give your jar read permissions for others (chmod o+r `myfile.jar`)
- In plugin mode, copy jar in `/opt/sonarqube/extensions/plugins`, restart sonarqube, then click on "More" > "CNES Report".

#### Installation
##### Standalone mode
**cnesreport** does not need any installation. It is a portable Java application you can copy and run according to following examples. The only requirement is an **up-to-date JRE (>=1.8)**.

##### Plugin mode (Since 2.2.0)
- Copy the sonar-cnes-report.jar in the plugin folder of sonarqube (On linux path should be like `/opt/sonarqube/extensions/plugins`)
- Copy the sonar-cnes-report.jar with read rights for others in the plugin folder of sonarqube (On linux path should be like `/opt/sonarqube/extensions/plugins`)
- Restart sonarqube (On linux: `sudo service sonar restart`)

#### Get help
Expand Down Expand Up @@ -71,7 +72,7 @@ java -jar sonar-cnes-report.jar -p projectId
If you have installed cnes-report in your sonarqube: open web interface, click on "CNES Report" then choose a project.

##### Advanced usage (standalone)
If you are using a secured instance of SonarQube, you can provide a SonarQube authentication token thanks to `-t` option and specify the url of the SonarQube instance with `-s`. The internal template for the text report can be replaced by the one given through `-r` option.
If you are using a secured instance of SonarQube, you can provide a SonarQube user token (https://docs.sonarqube.org/latest/user-guide/user-account/generating-and-using-tokens/) thanks to `-t` option and specify the url of the SonarQube instance with `-s`. The internal template for the text report can be replaced by the one given through `-r` option.
````
java -jar sonar-cnes-report.jar -t xuixg5hub345xbefu -s https://example.org:9000 -p projectId -r ./template.docx
````
Expand Down Expand Up @@ -115,30 +116,43 @@ For legacy versions, check the wiki page here : [Note on legacy versions](https:
<table>
<tr>
<td><b>cnesreport <br>\<br> SonarQube</b></td>
<td><b>3.0.x<br/>Standalone + Plugin</b></b></td>
<td><b>3.1.0<br/>Standalone + Plugin</b></b></td>
<td><b>3.2.x<br/>Standalone + Plugin</b></b></td>
<td><b>3.3.x<br/>Standalone + Plugin</b></b></td>
<td><b>4.0.0<br/>Standalone + Plugin</b></b></td>
<td><b>4.1.x<br/>Standalone + Plugin</b></b></td>
<td><b>3.0.x<br/>Standalone + Plugin</td>
<td><b>3.1.0<br/>Standalone + Plugin</td>
<td><b>3.2.x<br/>Standalone + Plugin</td>
<td><b>3.3.x<br/>Standalone + Plugin</td>
<td><b>4.0.0<br/>Standalone + Plugin</td>
<td><b>4.1.x<br/>Standalone + Plugin</td>
<td><b>4.2.x<br/>Standalone + Plugin</td>
</tr>
<tr>
<td><b>7.9.x (former LTS)</b></td>
<td><b>7.9.x</b></td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td><b>8.9.x (LTS)</b></td>
<td><b>8.9.x</b></td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>-</td>
</tr>
<tr>
<td><b>9.9.x (LTS)</b></td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>X</td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sonar-cnes-report-plugin",
"license": "GPL-3.0",
"version": "4.1.2",
"version": "4.2.0",
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/plugin-proposal-class-properties": "^7.8.3",
Expand Down
93 changes: 48 additions & 45 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.cnes.sonar</groupId>
<artifactId>cnesreport</artifactId>
<version>4.1.3</version>
<version>4.2.0</version>
<packaging>sonar-plugin</packaging>

<name>SonarQube CNES Report</name>
Expand All @@ -29,13 +29,15 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.min.version>1.8</jdk.min.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.13.2</junit.version>
<jacoco.version>0.8.7</jacoco.version>
<sonar.apiVersion>8.9.0.43852</sonar.apiVersion>
<sonar-packaging-maven-plugin.version>1.20.0.405</sonar-packaging-maven-plugin.version>
<jdk.min.version>11</jdk.min.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<junit.version>5.9.2</junit.version>
<jacoco.version>0.8.8</jacoco.version>
<sonar.apiVersion>9.8.0.203</sonar.apiVersion>
<sonar.testingHarnessVersion>9.5.0.56709</sonar.testingHarnessVersion>
<sonar.Version>9.9.0.65466</sonar.Version>
<sonar-packaging-maven-plugin.version>1.21.0.505</sonar-packaging-maven-plugin.version>
<sonar.pluginKey>cnesreport</sonar.pluginKey>
<sonar.pluginUrl>https://github.com/cnescatlab/sonar-cnes-report</sonar.pluginUrl>
<sonar.pluginOrganizationName>CNES</sonar.pluginOrganizationName>
Expand Down Expand Up @@ -67,6 +69,10 @@
<id>louisjdmartin</id>
<name>Louis Martin</name>
</developer>
<developer>
<id>rodrigd</id>
<name>Diego Rodriguez</name>
</developer>
<developer>
<id>ErwanGauduchon</id>
<name>Erwan Gauduchon</name>
Expand All @@ -77,7 +83,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.8</version>
<version>1.10.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -87,27 +93,27 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${sonar.apiVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-ws</artifactId>
<version>${sonar.apiVersion}</version>
<version>${sonar.Version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-core</artifactId>
<version>${sonar.apiVersion}</version>
<version>${sonar.Version}</version>
</dependency>
<dependency>
<!-- network use -->
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<version>4.5.14</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -147,13 +153,13 @@
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<version>31.1-jre</version>
</dependency>
<dependency>
<!-- json parsing -->
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -185,15 +191,20 @@
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-testing-harness</artifactId>
<version>${sonar.apiVersion}</version>
<version>${sonar.testingHarnessVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.2</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
Expand All @@ -203,7 +214,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.12.4</version>
<version>5.1.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -234,7 +245,7 @@

<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -268,32 +279,31 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<source>${jdk.min.version}</source>
<target>${jdk.min.version}</target>
</configuration>
</plugin>

<plugin>
<!-- UTF-8 bundles are not supported by Java, so they must be converted during build -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<executions>
<execution>
<?m2e execute onConfiguration?>
<goals>
<goal>native2ascii</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- UTF-8 bundles are not supported by Java, so they must be converted during build -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.1.2</version>
<version>3.4.2</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
Expand All @@ -302,14 +312,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>3.0.0-M5</version>
</dependency>
</dependencies>
<version>3.0.0-M8</version>
</plugin>

<plugin>
Expand Down Expand Up @@ -349,7 +352,7 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.11.3</version>
<version>1.9.1</version>
<executions>
<execution>
<phase>generate-resources</phase>
Expand All @@ -358,8 +361,8 @@
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<nodeVersion>v14.16.1</nodeVersion>
<yarnVersion>v1.22.10</yarnVersion>
<nodeVersion>v16.14.0</nodeVersion>
<yarnVersion>v1.22.5</yarnVersion>
</configuration>
</execution>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class ServerFactory {

/** List of SonarQube versions which are supported by cnesreport. */
private static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
"8.9", "8.9.*");
"8.9", "8.9.*", "9.9", "9.9.*");

/** Url of the SonarQube server. */
private String url;
Expand Down
2 changes: 1 addition & 1 deletion src/main/js/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getJSON, postJSON, post } from "sonar-request";

// Function used to get current SonarQube Server version
export function isCompatible() {
const COMPATIBILITY_PATTERN = /8.9(?:\..*)?(?:-.*)?/;
const COMPATIBILITY_PATTERN = /[8-9]\.9(\.[0-9])*/;

return getJSON("/api/system/status").then(response => {
return response.version.match(COMPATIBILITY_PATTERN) != null;
Expand Down
5 changes: 3 additions & 2 deletions src/main/js/conf/env.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* Script taken from https://github.com/SonarSource/sonar-custom-plugin-example
* Used to handle environment variable
*/
* Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
* injected into the application via DefinePlugin in Webpack configuration.
*/

const REACT_APP = /^REACT_APP_/i;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ut/java/fr/cnes/sonar/report/CommonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract class CommonTest {
/**
* Branch name.
*/
protected static final String BRANCH = "master";
protected static final String BRANCH = "main";
/**
* Quality Gate name.
*/
Expand Down

0 comments on commit 51cc2bf

Please sign in to comment.