-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reproduce reported issue by smoke test
- Loading branch information
Showing
8 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!target/sonar-findbugs-plugin.jar | ||
!src/smoke-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: '3' | ||
services: | ||
sonarqube-lts: | ||
build: | ||
context: . | ||
dockerfile: src/smoke-test/sonarqube-lts | ||
expose: | ||
- 9000 | ||
networks: | ||
lts: | ||
aliases: | ||
- sonarqube | ||
sonarqube-latest: | ||
build: | ||
context: . | ||
dockerfile: src/smoke-test/sonarqube-latest | ||
expose: | ||
- 9000 | ||
networks: | ||
latest: | ||
aliases: | ||
- sonarqube | ||
test-lts: | ||
build: | ||
context: . | ||
dockerfile: src/smoke-test/sonarqube-client | ||
volumes: | ||
- '~/.m2:/root/.m2' | ||
depends_on: | ||
- sonarqube-lts | ||
networks: | ||
lts: | ||
test-latest: | ||
build: | ||
context: . | ||
dockerfile: src/smoke-test/sonarqube-client | ||
volumes: | ||
- '~/.m2:/root/.m2' | ||
depends_on: | ||
- sonarqube-latest | ||
networks: | ||
latest: | ||
|
||
networks: | ||
lts: | ||
latest: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# Copied from https://github.com/SonarSource/docker-sonarqube/tree/master/7.1 under LGPL | ||
|
||
set -e | ||
|
||
if [ "${1:0:1}" != '-' ]; then | ||
exec "$@" | ||
fi | ||
|
||
chown -R sonarqube:sonarqube $SONARQUBE_HOME | ||
exec gosu sonarqube \ | ||
java -jar lib/sonar-application-$SONAR_VERSION.jar \ | ||
-Dsonar.log.console=true \ | ||
-Dsonar.jdbc.username="$SONARQUBE_JDBC_USERNAME" \ | ||
-Dsonar.jdbc.password="$SONARQUBE_JDBC_PASSWORD" \ | ||
-Dsonar.jdbc.url="$SONARQUBE_JDBC_URL" \ | ||
-Dsonar.web.javaAdditionalOpts="$SONARQUBE_WEB_JVM_OPTS -Djava.security.egd=file:/dev/./urandom" \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
# 1st param... The git URL to clone | ||
# 2nd param... The tag name to check out | ||
function download_target_project() { | ||
DIR_NAME=$(mktemp -d) | ||
cd /$DIR_NAME | ||
git clone "$1" target_repo | ||
cd target_repo | ||
git checkout "$2" | ||
} | ||
|
||
function run_smoke_test() { | ||
echo -n waiting SonarQube | ||
until $(curl --output /dev/null -s --fail http://sonarqube:9000); do | ||
echo -n '.' | ||
sleep 5 | ||
done | ||
echo SonarQube has been launched. | ||
|
||
count=0 | ||
until mvn compile org.eclipse.jetty:jetty-jspc-maven-plugin:jspc org.sonarsource.scanner.maven:sonar-maven-plugin:3.5.0.1254:sonar -B -Dmaven.test.skip -Dsonar.profile="FindBugs + FB-Contrib" -Dsonar.host.url=http://sonarqube:9000 -Dsonar.login=admin -Dsonar.password=admin; do | ||
count=$[ $count + 1 ] | ||
if [ $count -ge 5 ]; then | ||
echo Sonar fails to scan 5 times! | ||
exit 1 | ||
fi | ||
echo SonarQube is not ready to scan project, wait 5 sec | ||
sleep 5 | ||
done | ||
} | ||
|
||
# Use the project that uses Maven and contains .jsp file | ||
download_target_project 'https://github.com/spring-projects/spring-petclinic.git' 'e9f5f7b54108e35e660a9c9311a682ddce0633bc' | ||
run_smoke_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM maven:3.6.0-jdk-8 | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
bash \ | ||
git \ | ||
nodejs \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY src/smoke-test/smoke-test.sh /tmp/smoke-test.sh | ||
ENTRYPOINT /tmp/smoke-test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copied from https://github.com/SonarSource/docker-sonarqube/tree/master/7.1 under LGPL | ||
FROM openjdk:8 | ||
|
||
ENV SONAR_VERSION=7.4 \ | ||
SONARQUBE_HOME=/opt/sonarqube \ | ||
# Database configuration | ||
# Defaults to using H2 | ||
SONARQUBE_JDBC_USERNAME=sonar \ | ||
SONARQUBE_JDBC_PASSWORD=sonar \ | ||
SONARQUBE_JDBC_URL= | ||
|
||
# Http port | ||
EXPOSE 9000 | ||
|
||
RUN groupadd -r sonarqube && useradd -r -g sonarqube sonarqube | ||
|
||
# grab gosu for easy step-down from root | ||
RUN set -x \ | ||
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.10/gosu-$(dpkg --print-architecture)" \ | ||
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.10/gosu-$(dpkg --print-architecture).asc" \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
&& (gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ | ||
|| gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4) \ | ||
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ | ||
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \ | ||
&& chmod +x /usr/local/bin/gosu \ | ||
&& gosu nobody true | ||
|
||
RUN set -x \ | ||
|
||
# pub 2048R/D26468DE 2015-05-25 | ||
# Key fingerprint = F118 2E81 C792 9289 21DB CAB4 CFCA 4A29 D264 68DE | ||
# uid sonarsource_deployer (Sonarsource Deployer) <[email protected]> | ||
# sub 2048R/06855C1D 2015-05-25 | ||
&& (gpg --keyserver ha.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE \ | ||
|| gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys F1182E81C792928921DBCAB4CFCA4A29D26468DE) \ | ||
|
||
&& cd /opt \ | ||
&& curl -o sonarqube.zip -fSL https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip \ | ||
&& curl -o sonarqube.zip.asc -fSL https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-$SONAR_VERSION.zip.asc \ | ||
&& gpg --batch --verify sonarqube.zip.asc sonarqube.zip \ | ||
&& unzip sonarqube.zip \ | ||
&& mv sonarqube-$SONAR_VERSION sonarqube \ | ||
&& chown -R sonarqube:sonarqube sonarqube \ | ||
&& rm sonarqube.zip* \ | ||
&& rm -rf $SONARQUBE_HOME/bin/* | ||
|
||
VOLUME "$SONARQUBE_HOME/data" | ||
|
||
WORKDIR $SONARQUBE_HOME | ||
COPY src/smoke-test/run.sh $SONARQUBE_HOME/bin/ | ||
ENTRYPOINT ["./bin/run.sh"] | ||
|
||
# modified for smoke-test | ||
COPY target/sonar-findbugs-plugin.jar $SONARQUBE_HOME/extensions/plugins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM sonarqube:6.7.5 | ||
ENV SONAR_JAVA_VERSION=5.2.0.13398 | ||
|
||
RUN wget -P $SONARQUBE_HOME/extensions/plugins/ --no-verbose http://central.maven.org/maven2/org/sonarsource/java/sonar-java-plugin/$SONAR_JAVA_VERSION/sonar-java-plugin-$SONAR_JAVA_VERSION.jar | ||
COPY target/sonar-findbugs-plugin.jar $SONARQUBE_HOME/extensions/plugins/ |