Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions apps/sonar-plugin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Dockerfile to build a SonarQube plugin with Maven and run it in SonarQube

ARG MAVEN_BUILDER=3-openjdk-17-slim
ARG SONARQUBE_VERSION=25.9.0.112764-community

# STEP 1 : build the SonarQube plugin with Maven
#FROM maven:${MAVEN_BUILDER} AS builder

#USER root
#
#RUN apt-get update && \
# apt-get install -y curl && \
# curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
# apt-get install -y nodejs
#
#RUN echo "node -version :" && node --version
#RUN echo "npm -version :" && npm --version
#
#RUN corepack enable && corepack prepare [email protected] --activate
#RUN echo "pnpm -version :" && pnpm --version

#COPY . /usr/src/creedengo
#
#WORKDIR /usr/src/creedengo
#COPY src src/
#COPY pom.xml tool_build.sh ./
#
#RUN echo "********** --- ********** Contenu du dossier - ETAPE 1 :" && ls -l
#RUN echo "********** --- ********** Contenu du dossier 'target' - ETAPE 2 :" && ls -l target
#RUN echo "********** --- ********** Contenu du dossier 'node' - ETAPE 3 :" && ls -l node
#RUN echo "********** --- ********** Contenu du dossier 'node_modules' - ETAPE 4 :" && ls -l node_modules
#RUN echo "********** --- ********** Contenu du dossier 'node_modules/@creedengo' - ETAPE 4 :" && ls -l node_modules/@creedengo
#RUN echo "node -version :" && node --version
#RUN echo "pnpm -version :" && pnpm --version
#
#RUN mvn clean package -DskipTests,docker

# STEP 2 : create a SonarQube image with the plugin installed
FROM sonarqube:${SONARQUBE_VERSION}

#COPY --from=builder /usr/src/creedengo/target/creedengo-*.jar /opt/sonarqube/extensions/plugins/

USER sonarqube
57 changes: 57 additions & 0 deletions apps/sonar-plugin/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Docker Compose file for SonarQube service for Creedengo Dashboard

name: sonarqube_creedengo_dashboard

services:
sonar:
build: .
container_name: sonar_creedengo_dashboard
ports:
- ":9000"
networks:
- sonarnet
depends_on:
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:
- "extensions:/opt/sonarqube/extensions"
- "logs:/opt/sonarqube/logs"
- "data:/opt/sonarqube/data"

db:
image: postgres:12
container_name: postgresql_creedengo_dashboard
networks:
- sonarnet
volumes:
- pg_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: sonar
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:
driver: bridge

volumes:
data:
logs:
extensions:
pg_data:
2 changes: 1 addition & 1 deletion apps/sonar-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<packaging>sonar-plugin</packaging>

<name>Creedengo Dashboard plugin</name>
<name>Creedengo Dashboard</name>

<description>Provides a Creedengo Sustainability Dashboard to have an overview of the status and the main sustainability issue of the projects</description>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Creedengo Dashboard plugin - Provides a Creedengo Sustainability Dashboard to have an overview of the status and the main sustainability issue of the projects
* Creedengo Dashboard - Provides a Creedengo Sustainability Dashboard to have an overview of the status and the main sustainability issue of the projects
* Copyright © 2025 Green Code Initiative (https://green-code-initiative.org)
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -22,8 +22,6 @@

public class DashboardPlugin implements Plugin {

public static final String NAME = "Creedengo";

@Override
public void define(Context context) {
context.addExtension(DashboardPageDefinition.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Creedengo Dashboard plugin - Provides a Creedengo Sustainability Dashboard to have an overview of the status and the main sustainability issue of the projects
* Creedengo Dashboard - Provides a Creedengo Sustainability Dashboard to have an overview of the status and the main sustainability issue of the projects
* Copyright © 2025 Green Code Initiative (https://green-code-initiative.org)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -27,9 +27,11 @@ public class DashboardPageDefinition implements PageDefinition {

@Override
public void define(Context context) {
context.addPage(Page.builder("creedengo/view")
.setName("Creedengo")
.setScope(COMPONENT)
.build());
context
.addPage(Page.builder("creedengodashboard/view")
.setName("Creedengo")
.setScope(COMPONENT)
.build())
;
}
}
6 changes: 4 additions & 2 deletions apps/sonar-plugin/src/main/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import "@creedengo/vue-dashboard/stylesheet"
function start(options) {
const rootNode = options.el;
rootNode.innerHTML = `
<div id="app"</div>

This comment was marked as resolved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah je vois que tu l'as corrigé

<H1>Creedengo Dashboard - TOTO 1</H1>
<div id="app"></div>
<H1>Creedengo Dashboard - TOTO 2</H1>
`;
return () => stop(rootNode)
}
Expand All @@ -17,4 +19,4 @@ function stop(rootNode) {
rootNode.innerHTML = ''
}

window.registerExtension('creedengo/view', start, true)
window.registerExtension('creedengodashboard/view', start, true)
3 changes: 3 additions & 0 deletions apps/sonar-plugin/tool_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

mvn clean package -DskipTests
3 changes: 3 additions & 0 deletions apps/sonar-plugin/tool_docker-clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

docker-compose down --volumes
9 changes: 9 additions & 0 deletions apps/sonar-plugin/tool_docker-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

# docker-compose up --build -d

# pour avoir les logs de ce qui se passe dans le container lors de sa construction et deploiement
# Build avec logs visibles
docker-compose build --progress=plain --no-cache
# Puis lancer en détaché
docker-compose up -d
19 changes: 19 additions & 0 deletions apps/sonar-plugin/tool_docker-install-plugin.sh
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

si on garde ce fichier, il faudra le traduire ;-)

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env sh

NOM_CONTAINER=sonar_creedengo_dashboard
REPERTOIRE_EXTENSIONS=/opt/sonarqube/extensions/plugins/.

echo "********** AVANT installation du plugin (répertoire '') :"
docker exec $NOM_CONTAINER ls $REPERTOIRE_EXTENSIONS

echo "********** Installation du plugin 'creedengo-dashboard' :"
docker cp target/creedengo-dashboard-plugin-*.jar $NOM_CONTAINER:$REPERTOIRE_EXTENSIONS

echo "********** Installation du plugin 'creedengo-python' :"
docker cp ../creedengo-python-plugin-*.jar $NOM_CONTAINER:$REPERTOIRE_EXTENSIONS

echo "********** APRES installation du plugin :"
docker exec $NOM_CONTAINER ls $REPERTOIRE_EXTENSIONS

echo "********** Redémarrage du container pour prise en compte du nouveau plugin"
docker restart $NOM_CONTAINER
3 changes: 3 additions & 0 deletions apps/sonar-plugin/tool_docker-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

docker-compose logs -f
6 changes: 4 additions & 2 deletions apps/sonar-plugin/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ export default defineConfig({
rollupOptions: {
external: [],
output: {
entryFileNames: `assets/view.js`,
assetFileNames: `assets/view.css`
// entryFileNames: `assets/view.js`,
// assetFileNames: `assets/view.css`
entryFileNames: `assets/static/view.js`,
assetFileNames: `assets/static/view.css`
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions tool_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

pnpm install
pnpm build
Loading