7 Commits

Author SHA1 Message Date
cdbacfebb5 ci: validate end-to-end deployment
All checks were successful
Tests / Backend - Tests passed: 8
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good
2026-08-15 08:39:14 +00:00
825fedf118 fix: initialize npm cache permissions in Jenkins
All checks were successful
Tests / Backend - Tests passed: 8
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good
2026-08-14 23:07:42 +00:00
61296dda0c fix: correct Jenkinsfile pipeline syntax
Some checks failed
Tests / Backend - Tests No test results found
THE-TIP-TOP-MULTIBRANCH/pipeline/head There was a failure building this commit
2026-08-14 22:56:32 +00:00
2bbd2d16e4 ci: migrate deployments to VPS HTTPS infrastructure
Some checks failed
THE-TIP-TOP-MULTIBRANCH/pipeline/head There was a failure building this commit
2026-08-14 22:45:59 +00:00
b15d8458c8 refactor: centralize server IP configuration
All checks were successful
Tests / Backend - Tests passed: 8
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good
2026-08-10 19:23:52 +00:00
100b75a05a ci: publish JUnit and coverage reports
All checks were successful
Tests / Backend - Tests passed: 8
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good
2026-08-08 01:07:31 +00:00
d57b26c8c8 test: generate JUnit reports for Jenkins
All checks were successful
THE-TIP-TOP-MULTIBRANCH/pipeline/head This commit looks good
2026-08-08 00:24:43 +00:00
7 changed files with 210 additions and 84 deletions

48
Jenkinsfile vendored
View File

@@ -8,7 +8,7 @@ pipeline {
}
environment {
REGISTRY = "localhost:5000"
REGISTRY = "registry.wk-archi-o24a-4-5-g4.fr"
BACKEND_IMAGE = "${REGISTRY}/the-tip-top/backend"
FRONTEND_IMAGE = "${REGISTRY}/the-tip-top/frontend"
@@ -48,7 +48,7 @@ pipeline {
env.COMPOSE_PROJECT = 'tiptop-dev'
env.DEPLOY_NETWORK = 'tiptop-dev'
env.FRONTEND_API_URL = 'http://192.168.1.23:5001'
env.FRONTEND_API_URL = "https://api-dev.dsp5-archi-o24a-4-5-g4.fr"
} else if (env.BRANCH_NAME.startsWith('release-')) {
env.DEPLOY_ENABLED = 'true'
@@ -58,7 +58,7 @@ pipeline {
env.COMPOSE_PROJECT = 'tiptop-preprod'
env.DEPLOY_NETWORK = 'tiptop-preprod'
env.FRONTEND_API_URL = 'http://192.168.1.23:5002'
env.FRONTEND_API_URL = "https://api-preprod.dsp5-archi-o24a-4-5-g4.fr"
} else if (env.BRANCH_NAME == 'main') {
env.DEPLOY_ENABLED = 'true'
@@ -68,7 +68,7 @@ pipeline {
env.COMPOSE_PROJECT = 'tiptop-prod'
env.DEPLOY_NETWORK = 'tiptop-prod'
env.FRONTEND_API_URL = 'http://192.168.1.23:5003'
env.FRONTEND_API_URL = "https://api.dsp5-archi-o24a-4-5-g4.fr"
} else {
env.DEPLOY_ENABLED = 'false'
@@ -84,6 +84,7 @@ pipeline {
echo "Tag Docker : ${env.IMAGE_TAG}"
echo "Environnement : ${env.DEPLOY_ENV}"
echo "Déploiement activé : ${env.DEPLOY_ENABLED}"
echo "API frontend : ${env.FRONTEND_API_URL}"
}
}
}
@@ -136,6 +137,10 @@ pipeline {
sleep 2
done
docker run --rm \
-v tiptop-npm-cache-backend:/npm-cache \
alpine \
sh -c 'chown -R 1000:1000 /npm-cache'
docker run --rm \
--network "${CI_NETWORK}" \
@@ -162,12 +167,32 @@ pipeline {
"
'''
}
post {
always {
junit(
testResults: 'backend/test-results/*.xml',
allowEmptyResults: true
)
archiveArtifacts(
artifacts: 'backend/coverage/**',
fingerprint: true,
allowEmptyArchive: true
)
}
}
}
stage('Frontend - Lint et Build') {
steps {
sh '''
docker run --rm \
-v tiptop-npm-cache-frontend:/npm-cache \
alpine \
sh -c 'chown -R 1000:1000 /npm-cache'
docker run --rm \
--volumes-from furious-jenkins \
-v tiptop-npm-cache-frontend:/npm-cache \
--user "$(id -u):$(id -g)" \
@@ -218,12 +243,26 @@ pipeline {
}
steps {
withCredentials([
usernamePassword(
credentialsId: 'registry-credentials',
usernameVariable: 'REGISTRY_USER',
passwordVariable: 'REGISTRY_PASSWORD'
)
]) {
sh '''
echo "${REGISTRY_PASSWORD}" | \
docker login "${REGISTRY}" \
-u "${REGISTRY_USER}" \
--password-stdin
docker push "${BACKEND_IMAGE}:${IMAGE_TAG}"
docker push "${FRONTEND_IMAGE}:${IMAGE_TAG}"
'''
}
}
}
stage('Validation production') {
when {
@@ -317,6 +356,7 @@ pipeline {
post {
always {
sh '''
docker logout "${REGISTRY}" 2>/dev/null || true
docker rm -f "${CI_DATABASE}" 2>/dev/null || true
docker network rm "${CI_NETWORK}" 2>/dev/null || true
'''

View File

@@ -1,26 +1,33 @@
module.exports = {
testEnvironment: "node",
// Dossier des tests
testMatch: ["**/tests/**/*.test.js"],
// Nettoyage des mocks entre les tests
clearMocks: true,
// Timeout (utile pour Prisma / DB)
testTimeout: 10000,
// Affichage des logs de test
verbose: true,
// Couverture de code (optionnel mais bon pour soutenance)
collectCoverage: true,
coverageDirectory: "coverage",
coverageReporters: [
"text",
"lcov",
"html"
],
// Fichiers à ignorer
testPathIgnorePatterns: ["/node_modules/"],
reporters: [
"default",
[
"jest-junit",
{
outputDirectory: "./test-results",
outputName: "junit.xml"
}
]
],
// Configuration pour Jest avec Supertest
//setupFilesAfterEnv: ["<rootDir>/tests/setup.js"]
testPathIgnorePatterns: ["/node_modules/"]
};

View File

@@ -25,6 +25,7 @@
"cross-env": "^10.1.0",
"dotenv": "^17.4.2",
"jest": "^30.4.2",
"jest-junit": "^17.0.0",
"nodemon": "^3.1.14",
"supertest": "^7.2.2"
}
@@ -4457,6 +4458,22 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/jest-junit": {
"version": "17.0.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-17.0.0.tgz",
"integrity": "sha512-RYWCkq4j59gUXj5DsgbIE7xFBZzu1gtibPhyjSjMmGaOTLnqlXhg7x9zuGCwgbCuMAyoyvk0Mi8wSrRR5uOeLA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"mkdirp": "^1.0.4",
"strip-ansi": "^6.0.1",
"uuid": "^14.0.0",
"xml": "^1.0.1"
},
"engines": {
"node": ">=20.0.0"
}
},
"node_modules/jest-leak-detector": {
"version": "30.4.1",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-30.4.1.tgz",
@@ -5375,6 +5392,19 @@
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true,
"license": "MIT",
"bin": {
"mkdirp": "bin/cmd.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@@ -6836,6 +6866,20 @@
"browserslist": ">= 4.21.0"
}
},
"node_modules/uuid": {
"version": "14.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.1.tgz",
"integrity": "sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==",
"dev": true,
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist-node/bin/uuid"
}
},
"node_modules/v8-to-istanbul": {
"version": "9.3.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
@@ -6942,6 +6986,13 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
}
},
"node_modules/xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==",
"dev": true,
"license": "MIT"
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",

View File

@@ -32,6 +32,7 @@
"cross-env": "^10.1.0",
"dotenv": "^17.4.2",
"jest": "^30.4.2",
"jest-junit": "^17.0.0",
"nodemon": "^3.1.14",
"supertest": "^7.2.2"
},

View File

@@ -9,7 +9,7 @@ services:
POSTGRES_DB: the_tip_top_db
volumes:
- tiptop_postgres_dev_data:/var/lib/postgresql/data
- tiptop_dev_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tiptop -d the_tip_top_db"]
@@ -30,14 +30,10 @@ services:
environment:
PORT: 5000
NODE_ENV: development
DATABASE_URL: postgresql://tiptop:tiptop_dev_password@postgres:5432/the_tip_top_db
JWT_SECRET: dev_secret_change_me
APP_URL: http://192.168.1.23:5001
MAIL_HOST: smtp.gmail.com
MAIL_PORT: 587
MAIL_USER: ""
MAIL_PASS: ""
MAIL_FROM: "The Tip Top <no-reply@tiptop.local>"
APP_URL: https://api-dev.dsp5-archi-o24a-4-5-g4.fr
command: >
sh -c "
@@ -46,11 +42,18 @@ services:
npm start
"
ports:
- "5001:5000"
networks:
- tiptop-dev
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.tiptop-dev-api.rule=Host(`api-dev.dsp5-archi-o24a-4-5-g4.fr`)"
- "traefik.http.routers.tiptop-dev-api.entrypoints=websecure"
- "traefik.http.routers.tiptop-dev-api.tls=true"
- "traefik.http.routers.tiptop-dev-api.tls.certresolver=letsencrypt"
- "traefik.http.services.tiptop-dev-api.loadbalancer.server.port=5000"
frontend:
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
@@ -59,17 +62,26 @@ services:
depends_on:
- backend
ports:
- "5173:80"
networks:
- tiptop-dev
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.tiptop-dev.rule=Host(`dev.dsp5-archi-o24a-4-5-g4.fr`)"
- "traefik.http.routers.tiptop-dev.entrypoints=websecure"
- "traefik.http.routers.tiptop-dev.tls=true"
- "traefik.http.routers.tiptop-dev.tls.certresolver=letsencrypt"
- "traefik.http.services.tiptop-dev.loadbalancer.server.port=80"
volumes:
tiptop_postgres_dev_data:
external: true
name: the-tip-top_tiptop_postgres_dev_data
tiptop_dev_postgres_data:
name: tiptop_dev_postgres_data
networks:
tiptop-dev:
name: tiptop-dev
proxy:
external: true

View File

@@ -12,11 +12,7 @@ services:
- tiptop_preprod_postgres_data:/var/lib/postgresql/data
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U tiptop_preprod -d the_tip_top_preprod"
]
test: ["CMD-SHELL", "pg_isready -U tiptop_preprod -d the_tip_top_preprod"]
interval: 10s
timeout: 5s
retries: 10
@@ -37,12 +33,7 @@ services:
NODE_ENV: preproduction
DATABASE_URL: postgresql://tiptop_preprod:tiptop_preprod_password@postgres:5432/the_tip_top_preprod
JWT_SECRET: preprod_secret_change_me
APP_URL: http://192.168.1.23:5002
MAIL_HOST: smtp.gmail.com
MAIL_PORT: 587
MAIL_USER: ""
MAIL_PASS: ""
MAIL_FROM: "The Tip Top Preprod <no-reply@tiptop.local>"
APP_URL: https://api-preprod.dsp5-archi-o24a-4-5-g4.fr
command: >
sh -c "
@@ -51,11 +42,18 @@ services:
npm start
"
ports:
- "5002:5000"
networks:
- tiptop-preprod
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.tiptop-preprod-api.rule=Host(`api-preprod.dsp5-archi-o24a-4-5-g4.fr`)"
- "traefik.http.routers.tiptop-preprod-api.entrypoints=websecure"
- "traefik.http.routers.tiptop-preprod-api.tls=true"
- "traefik.http.routers.tiptop-preprod-api.tls.certresolver=letsencrypt"
- "traefik.http.services.tiptop-preprod-api.loadbalancer.server.port=5000"
frontend:
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
@@ -64,11 +62,18 @@ services:
depends_on:
- backend
ports:
- "5174:80"
networks:
- tiptop-preprod
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.tiptop-preprod.rule=Host(`preprod.dsp5-archi-o24a-4-5-g4.fr`)"
- "traefik.http.routers.tiptop-preprod.entrypoints=websecure"
- "traefik.http.routers.tiptop-preprod.tls=true"
- "traefik.http.routers.tiptop-preprod.tls.certresolver=letsencrypt"
- "traefik.http.services.tiptop-preprod.loadbalancer.server.port=80"
volumes:
tiptop_preprod_postgres_data:
@@ -77,3 +82,6 @@ volumes:
networks:
tiptop-preprod:
name: tiptop-preprod
proxy:
external: true

View File

@@ -12,11 +12,7 @@ services:
- tiptop_prod_postgres_data:/var/lib/postgresql/data
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U tiptop_prod -d the_tip_top_prod"
]
test: ["CMD-SHELL", "pg_isready -U tiptop_prod -d the_tip_top_prod"]
interval: 10s
timeout: 5s
retries: 10
@@ -37,13 +33,7 @@ services:
NODE_ENV: production
DATABASE_URL: postgresql://tiptop_prod:tiptop_prod_password@postgres:5432/the_tip_top_prod
JWT_SECRET: prod_secret_change_me
APP_URL: http://192.168.1.23:5003
MAIL_HOST: smtp.gmail.com
MAIL_PORT: 587
MAIL_USER: ""
MAIL_PASS: ""
MAIL_FROM: "The Tip Top <no-reply@tiptop.local>"
APP_URL: https://api.dsp5-archi-o24a-4-5-g4.fr
command: >
sh -c "
@@ -52,11 +42,18 @@ services:
npm start
"
ports:
- "5003:5000"
networks:
- tiptop-prod
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.tiptop-prod-api.rule=Host(`api.dsp5-archi-o24a-4-5-g4.fr`)"
- "traefik.http.routers.tiptop-prod-api.entrypoints=websecure"
- "traefik.http.routers.tiptop-prod-api.tls=true"
- "traefik.http.routers.tiptop-prod-api.tls.certresolver=letsencrypt"
- "traefik.http.services.tiptop-prod-api.loadbalancer.server.port=5000"
frontend:
image: ${REGISTRY}/the-tip-top/frontend:${IMAGE_TAG}
@@ -65,11 +62,18 @@ services:
depends_on:
- backend
ports:
- "5175:80"
networks:
- tiptop-prod
- proxy
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.tiptop-prod.rule=Host(`dsp5-archi-o24a-4-5-g4.fr`) || Host(`www.dsp5-archi-o24a-4-5-g4.fr`)"
- "traefik.http.routers.tiptop-prod.entrypoints=websecure"
- "traefik.http.routers.tiptop-prod.tls=true"
- "traefik.http.routers.tiptop-prod.tls.certresolver=letsencrypt"
- "traefik.http.services.tiptop-prod.loadbalancer.server.port=80"
volumes:
tiptop_prod_postgres_data:
@@ -78,3 +82,6 @@ volumes:
networks:
tiptop-prod:
name: tiptop-prod
proxy:
external: true