diff --git a/.default.docker.env b/.default.docker.env new file mode 100644 index 0000000..01ee4f2 --- /dev/null +++ b/.default.docker.env @@ -0,0 +1,5 @@ +# Set default Sonarqube environment variables used by docker-compose +# You can override these envvars by creating a '.override.docker.env' file +# For available envvars list, see https://docs.sonarsource.com/sonarqube/latest/setup-and-upgrade/configure-and-operate-a-server/environment-variables/ + +SONAR_LOG_LEVEL_WEB=INFO diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ce62a8..855c493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,8 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [#49](https://github.com/green-code-initiative/ecoCode-java/pull/49) Add test to ensure all Rules are registered + ### Deleted +## [1.6.2] - 2024-07-21 + +### Changed + +- [#60](https://github.com/green-code-initiative/ecoCode-java/issues/60) Check + update for SonarQube 10.6.0 compatibility +- refactoring docker system +- upgrade ecocode-rules-specifications to 1.6.2 + ## [1.6.1] - 2024-05-15 ### Changed diff --git a/Dockerfile b/Dockerfile index a5a0fc7..421eacd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,16 @@ -FROM maven:3-openjdk-11-slim AS builder +ARG MAVEN_BUILDER=3-openjdk-17-slim +ARG SONARQUBE_VERSION=10.6.0-community + +FROM maven:${MAVEN_BUILDER} AS builder COPY . /usr/src/ecocode WORKDIR /usr/src/ecocode +COPY src src/ +COPY pom.xml tool_build.sh ./ + RUN ./tool_build.sh -FROM sonarqube:10.5.1-community +FROM sonarqube:${SONARQUBE_VERSION} COPY --from=builder /usr/src/ecocode/target/ecocode-*.jar /opt/sonarqube/extensions/plugins/ +USER sonarqube diff --git a/README.md b/README.md index 7fab3c0..a28c058 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Ready to use binaries are available [from GitHub](https://github.com/green-code- | Plugin version | SonarQube version | Java version | |----------------|---------------------|--------------| -| 1.5.+ | 9.4.+ LTS to 10.5.1 | 11 / 17 | +| 1.6.+ | 9.4.+ LTS to 10.6.0 | 11 / 17 | > Compatibility table of versions lower than 1.4.+ are available from the > main [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-plugins-version-compatibility). diff --git a/_TODOs_DDC.md b/_TODOs_DDC.md index d318d99..85e767d 100644 --- a/_TODOs_DDC.md +++ b/_TODOs_DDC.md @@ -7,4 +7,5 @@ - check usefulness - upgrade versions - enable github `dependabot` to create automatically PR with version upgrades of dependencides (when all dependencies will be ok) -- ménage dans les branches de dev (local et remote) \ No newline at end of file +- ménage dans les branches de dev (local et remote) +- docker-compose : ":9000" (génération port aléatoire pour l'IHM + repérage pour IHM) au lieu de "9000:9000" si erreur lors du démarrage "Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:9000 -> 0.0.0.0:0: listen tcp 0.0.0.0:9000: bind: address already in use" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index ee7dc87..e84e389 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,27 @@ -version: "3.3" +name: sonarqube_ecocode_java + services: sonar: - image: sonarqube:10.5.1-community + build: . container_name: sonar_ecocode_java ports: - - "9000:9000" + - ":9000" networks: - sonarnet depends_on: - - db + db: + condition: service_healthy environment: SONAR_JDBC_USERNAME: sonar SONAR_JDBC_PASSWORD: sonar SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonarqube SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: 'true' + env_file: + - path: ./.default.docker.env + required: true + - path: ./.override.docker.env + required: false volumes: - - type: bind - source: ./target/ecocode-java-plugin-1.6.2-SNAPSHOT.jar - target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.6.2-SNAPSHOT.jar - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" @@ -34,6 +38,11 @@ services: POSTGRES_PASSWORD: sonar POSTGRES_DB: sonarqube PGDATA: pg_data:/var/lib/postgresql/data/pgdata + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U sonar -d sonarqube" ] + interval: 5s + timeout: 5s + retries: 5 networks: sonarnet: diff --git a/pom.xml b/pom.xml index c6df47a..9283617 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.ecocode ecocode-java-plugin - 1.6.2-SNAPSHOT + 1.6.3-SNAPSHOT sonar-plugin @@ -67,7 +67,7 @@ 1.7 - 1.5.1 + 1.6.2