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