ci: refs #6695 update docker-compose to use dynamic image tags
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-02-21 13:54:37 +01:00
parent e0d0830793
commit 64549603ca
2 changed files with 52 additions and 53 deletions

101
Jenkinsfile vendored
View File

@ -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 }

View File

@ -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}'