Skip to content

Commit

Permalink
sonarqube code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Gross cogross authored and Cloud User committed Nov 27, 2024
1 parent 0057245 commit d4faa35
Show file tree
Hide file tree
Showing 40 changed files with 964 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<threadCountClasses>1</threadCountClasses>
<threadCountMethods>0</threadCountMethods>
<threadCountSuites>0</threadCountSuites>
<argLine>-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dfile.encoding=UTF8 -Duser.timezone=GMT -Xmx1024m -Dapple.awt.UIElement=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc=</argLine>
<argLine>@{argLine} -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dfile.encoding=UTF8 -Duser.timezone=GMT -Xmx1024m -Dapple.awt.UIElement=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc=</argLine>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>random</runOrder>
</configuration>
Expand Down
315 changes: 315 additions & 0 deletions coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-parent</artifactId>
<version>7.11.0-SNAPSHOT</version>
</parent>
<artifactId>coverage</artifactId>
<name>Datawave Code Coverage Aggregate Report</name>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<dependencies>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-accumulo-extensions</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-data-dictionary-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-edge-dictionary-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-index-stats</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ingest-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ingest-csv</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ingest-json</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ingest-nyctlc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ingest-wikipedia</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-metrics-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ops-tools-config-compare</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-ops-tools-index-validation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave</groupId>
<artifactId>datawave-query-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>accumulo-api</artifactId>
<version>${version.datawave.accumulo-api}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>accumulo-utils</artifactId>
<version>${version.datawave.accumulo-utils}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>audit-api</artifactId>
<version>${version.datawave.audit-api}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>authorization-api</artifactId>
<version>${version.datawave.authorization-api}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>base-rest-responses</artifactId>
<version>${version.datawave.base-rest-responses}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>common-utils</artifactId>
<version>${version.datawave.common-utils}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>dictionary-api</artifactId>
<version>${version.datawave.dictionary-api}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>mapreduce-query-api</artifactId>
<version>${version.datawave.mapreduce-query-api}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>metadata-utils</artifactId>
<version>${version.datawave.metadata-utils}</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>metrics-reporter</artifactId>
<version>${version.datawave.metrics-reporter}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>query-api</artifactId>
<version>${version.datawave.query-api}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>query-api</artifactId>
<version>${version.datawave.query-api}</version>
<classifier>jboss</classifier>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>query-metric-api</artifactId>
<version>${version.datawave.query-metric-api}</version>
<exclusions>
<exclusion>
<groupId>gov.nsa.datawave</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>accumulo-utils</artifactId>
</exclusion>
<exclusion>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>type-utils</artifactId>
<version>${version.datawave.type-utils}</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-accumulo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-atom</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-cached-results</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-common-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-dictionary</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-map-reduce</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-map-reduce-embedded</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-map-reduce-status</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-modification</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-query</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.webservices</groupId>
<artifactId>datawave-ws-security</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>gov.nsa.datawave.microservice</groupId>
<artifactId>base-rest-responses</artifactId>
<version>${version.datawave.base-rest-responses}</version>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<goals>
<goal>report-aggregate</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
56 changes: 56 additions & 0 deletions docker/sonarqube/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
## SonarQube

## Preliminary Steps
(you *will* need to run this daily before attempting to start sonarqube - use precompose.sh script in case other things are needed)
sudo sysctl -w vm.max_map_count=262144
sudo sysctl -w fs.file-max=131072

sudo vi /etc/sysctl.conf
vm.max_map_count=262144
fs.file-max=131072

You need to run in older versions of maven. 3.8.6 works, 3.9.6 does NOT.

## Start SonarQube
In docker/sonarqube directory, run:
```bash
./precompose.sh
docker-compose up -d
```

## Setup SonarQube
go to https://localhost:7777 to view the sonarqube app
admin/admin is the default password (change it when you first access it)

How do you want to create your project? Manually

Set project name to DataWave
(leave project key as DataWave)
Set main branch to integration
Click Set Up

How do you want to analyze your repository? Locally

Leave the token name as "Analyze DataWave"
Set the expiration to Never Expires
Click Generate

Copy the token (spq_...), save it locally in a file called sonarqubeToken in your home directory.

Click Continue

Click Maven

Create a sonar.sh script, add it to your ~/bin dir (or anywhere that is on your configured path)
```bash
mvn clean verify && mvn -e sonar:sonar -Dsonar.projectKey=Datawave -Dsonar.host.url=http://localhost:7777 -Dsonar.login=<TOKEN>
```

Run the new sonar.sh script in your checked out datawave repository. When it is done, return to the browser and you can see the results of your scan.

## Stop SonarQube
In docker/sonarqube directory, run:
```bash
docker-compose stop
```
You should do this before closing down for the day, or if you are done trying to do analysis.
11 changes: 11 additions & 0 deletions docker/sonarqube/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/bash

docker volume rm sonarqube_data
docker volume rm sonarqube_extensions
docker volume rm sonarqube_logs
docker volume rm sonarqube_postgresql
docker volume rm sonarqube_postgresql_data
docker volume rm sonarqube_sonarqube_data
docker volume rm sonarqube_sonarqube_extensions
docker volume rm sonarqube_sonarqube_logs

Loading

0 comments on commit d4faa35

Please sign in to comment.