From 41bd5a424a925c63ffb81dc2e427b8eb44fd0a24 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 31 Jan 2025 12:55:43 +0100 Subject: [PATCH] build: refs #6695 try use stages --- Jenkinsfile | 54 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b0c1311df..fef88be2d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -94,31 +94,48 @@ pipeline { environment { CREDENTIALS = credentials('docker-registry') } - steps { - script { - def packageJson = readJSON file: 'package.json' - env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" + stages { + stage('Setup') { + steps { + script { + def packageJson = readJSON file: 'package.json' + env.VERSION = "${packageJson.version}-build${env.BUILD_ID}" + } + sh 'rm -rf salix' + sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git' + } + } + stage('Up Database') { + steps { + sh 'cd salix && pnpm i --prefer-offline @verdnatura/myt && npx myt run -t -d' + } + } + stage('Up Backend') { + steps { + sh 'docker build -f ./salix/back/Dockerfile -t back ./salix' + sh 'docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back' + } + } + stage('Up Frontend') { + steps { + sh 'quasar build' + sh 'docker-compose -f docker-compose.e2e.yml build front' + sh 'docker-compose -f docker-compose.e2e.yml up -d front' + } + } + stage('Run E2E') { + steps { + sh 'docker-compose -f docker-compose.e2e.yml build e2e' + sh 'docker-compose -f docker-compose.e2e.yml up e2e' + } } - sh 'rm -rf salix' - sh 'git clone https://gitea.verdnatura.es/verdnatura/salix.git' - // Db - sh 'cd salix && pnpm i --prefer-offline @verdnatura/myt && npx myt run -t -d' - // Backend - sh 'docker build -f ./salix/back/Dockerfile -t back ./salix' - sh 'docker run -d --name salix_e2e --net=host -v $(pwd)/test/cypress/storage:/salix/storage back' - // Frontend - sh 'quasar build' - sh 'docker-compose -f docker-compose.e2e.yml build front' - sh 'docker-compose -f docker-compose.e2e.yml up -d front' - // E2E - sh 'docker-compose -f docker-compose.e2e.yml build e2e' - sh 'docker-compose -f docker-compose.e2e.yml up e2e' } post { always { sh 'docker rm -f vn-database || true' sh 'docker rm -f salix_e2e || true' sh 'docker-compose -f docker-compose.e2e.yml down || true' + junit( testResults: 'junitresults.xml', allowEmptyResults: true @@ -126,6 +143,7 @@ pipeline { } } } + } }