From 64549603caeadb77dede55688c52e43cd5a494dd Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 21 Feb 2025 13:54:37 +0100 Subject: [PATCH] ci: refs #6695 update docker-compose to use dynamic image tags --- Jenkinsfile | 101 ++++++++++++++++---------------- test/cypress/docker-compose.yml | 4 +- 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6f7f18b57..8efc2f880 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -80,59 +80,58 @@ pipeline { } steps { sh 'pnpm install --prefer-offline' - echo CHANGE_TARGET } } - // stage('Test') { - // when { - // expression { !PROTECTED_BRANCH } - // } - // environment { - // NODE_ENV = '' - // CI = 'true' - // TZ = 'Europe/Madrid' - // } - // parallel { - // stage('Unit') { - // steps { - // sh 'pnpm run test:unit:ci' - // } - // post { - // always { - // junit( - // testResults: 'junit/vitest.xml', - // allowEmptyResults: true - // ) - // } - // } - // } - // stage('E2E') { - // environment { - // CREDENTIALS = credentials('docker-registry') - // COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" - // COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." - // } - // steps { - // script { - // def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs') - // sh "docker-compose ${env.COMPOSE_PARAMS} up -d" - // image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") { - // sh 'cypress run --browser chromium' - // } - // } - // } - // post { - // always { - // sh "docker-compose ${env.COMPOSE_PARAMS} down" - // junit( - // testResults: 'junit/e2e.xml', - // allowEmptyResults: true - // ) - // } - // } - // } - // } - // } + stage('Test') { + when { + expression { !PROTECTED_BRANCH } + } + environment { + NODE_ENV = '' + CI = 'true' + TZ = 'Europe/Madrid' + } + parallel { + stage('Unit') { + steps { + sh 'pnpm run test:unit:ci' + } + post { + always { + junit( + testResults: 'junit/vitest.xml', + allowEmptyResults: true + ) + } + } + } + stage('E2E') { + environment { + CREDENTIALS = credentials('docker-registry') + COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}" + COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ." + } + steps { + script { + def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs') + sh "docker-compose ${env.COMPOSE_PARAMS} up -d" + image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") { + sh 'cypress run --browser chromium' + } + } + } + post { + always { + sh "docker-compose ${env.COMPOSE_PARAMS} down" + junit( + testResults: 'junit/e2e.xml', + allowEmptyResults: true + ) + } + } + } + } + } stage('Build') { when { expression { PROTECTED_BRANCH } diff --git a/test/cypress/docker-compose.yml b/test/cypress/docker-compose.yml index 9d51ee345..bf22c5877 100644 --- a/test/cypress/docker-compose.yml +++ b/test/cypress/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: back: - image: registry.verdnatura.es/salix-back:dev + image: 'registry.verdnatura.es/salix-back:${CHANGE_TARGET:-dev}' volumes: - ./test/cypress/storage:/salix/storage - ./test/cypress/back/datasources.json:/salix/loopback/server/datasources.json @@ -18,4 +18,4 @@ services: - TZ dns_search: . db: - image: registry.verdnatura.es/salix-db:dev + image: 'registry.verdnatura.es/salix-db:${CHANGE_TARGET:-dev}'