fix: share Jenkins workspace with CI containers

This commit is contained in:
2026-08-04 12:04:25 +00:00
parent f7f8afd484
commit 4b04bf48e9

17
Jenkinsfile vendored
View File

@@ -10,11 +10,7 @@ pipeline {
environment {
CI_NETWORK = "tiptop-ci-${BUILD_NUMBER}"
CI_DATABASE = "tiptop-ci-db-${BUILD_NUMBER}"
DATABASE_URL = "postgresql://tiptop_ci:tiptop_ci_password@${CI_DATABASE}:5432/the_tip_top_ci"
HOST_JENKINS_HOME = "/opt/furious-ducks/data/jenkins"
HOST_WORKSPACE = "${HOST_JENKINS_HOME}/workspace/${JOB_NAME}"
}
stages {
@@ -28,9 +24,10 @@ pipeline {
steps {
sh '''
echo "Workspace Jenkins : ${WORKSPACE}"
echo "Workspace hôte : ${HOST_WORKSPACE}"
ls -lah backend
ls -lah frontend
test -f backend/package.json
test -f backend/package-lock.json
test -f frontend/package.json
@@ -72,13 +69,13 @@ pipeline {
docker run --rm \
--network "${CI_NETWORK}" \
--volumes-from furious-jenkins \
--user "$(id -u):$(id -g)" \
-e HOME=/tmp \
-e DATABASE_URL="${DATABASE_URL}" \
-e JWT_SECRET=jenkins_ci_secret \
-e NODE_ENV=test \
-v "${HOST_WORKSPACE}/backend:/app" \
-w /app \
-w "${WORKSPACE}/backend" \
node:22-alpine \
sh -c "
npm ci &&
@@ -94,10 +91,10 @@ pipeline {
steps {
sh '''
docker run --rm \
--volumes-from furious-jenkins \
--user "$(id -u):$(id -g)" \
-e HOME=/tmp \
-v "${HOST_WORKSPACE}/frontend:/app" \
-w /app \
-w "${WORKSPACE}/frontend" \
node:22-alpine \
sh -c "
npm ci &&
@@ -111,8 +108,6 @@ pipeline {
stage('Docker Build') {
steps {
sh '''
cd "${WORKSPACE}"
docker compose \
-f docker-compose.dev.yml \
build