pull/12/head
Nicolas Arenas 2024-10-23 00:53:48 +02:00
parent 7bbf84cc21
commit c8e0fe69c6
1 changed files with 65 additions and 55 deletions

120
Jenkinsfile vendored
View File

@ -24,63 +24,73 @@ pipeline {
}
}
}
stage(('Prepare Docker Composer')) {
stage ("Delete Image") {
steps {
sh """
sed 's|ogcore-php:static|${DOCKER_IDENTITY}|g; s|ogcore-nginx:static|${DOCKER_IDENTITY_NGINX}|g' ${DOCKER_COMPOSE_TEMPLATE} > ${DOCKER_COMPOSE_FILE}
"""
script {
sh "docker rmi ${DOCKER_IDENTITY}"
sh "docker rmi ${DOCKER_IDENTITY_NGINX}"
}
}
}
stage('Run containers') {
steps {
sh "docker compose -f ${DOCKER_COMPOSE_FILE} up -d"
}
}
stage('Install dependencies') {
steps {
// Install dependencies
sh """
docker compose exec php composer install
docker compose exec php php bin/console lexik:jwt:generate-keypair --overwrite
docker compose exec php php bin/console doctrine:migrations:migrate --no-interaction
docker compose exec php php bin/console doctrine:fixtures:load --no-interaction
// Create report directory
docker compose exec php mkdir -p /report
"""
}
}
stage('Tests') {
steps {
// Run tests
sh """
docker compose exec php bin/phpunit --log-junit /report/phpunit.xml
docker compose cp php:/report/phpunit.xml ./phpunit.xml
"""
}
// post {
// success {
// script {
// docker.withRegistry('https://index.docker.io/v1/', "${DOCKER_CREDENTIALS}") {
// docker.image("${DOCKER_IDENTITY}").push()
// docker.image("${DOCKER_IDENTITY_NGINX}").push()
// }
// }
// }
// }
}
}
post {
always {
// Publicar los resultados de las pruebas de PHPUnit
xunit (
thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ],
tools: [ PHPUnit(pattern: 'phpunit.xml') ]
)
// Remove containers
sh 'docker compose -f ${DOCKER_COMPOSE_FILE} down'
sh 'docker compose -f ${DOCKER_COMPOSE_FILE} rm -f'
}
}
// stage(('Prepare Docker Composer')) {
// steps {
// sh """
// sed 's|ogcore-php:static|${DOCKER_IDENTITY}|g; s|ogcore-nginx:static|${DOCKER_IDENTITY_NGINX}|g' ${DOCKER_COMPOSE_TEMPLATE} > ${DOCKER_COMPOSE_FILE}
// """
// }
// }
// stage('Run containers') {
// steps {
// sh "docker compose -f ${DOCKER_COMPOSE_FILE} up -d"
// }
// }
// stage('Install dependencies') {
// steps {
// // Install dependencies
// sh """
// docker compose exec php composer install
// docker compose exec php php bin/console lexik:jwt:generate-keypair --overwrite
// docker compose exec php php bin/console doctrine:migrations:migrate --no-interaction
// docker compose exec php php bin/console doctrine:fixtures:load --no-interaction
// // Create report directory
// docker compose exec php mkdir -p /report
// """
// }
// }
// stage('Tests') {
// steps {
// // Run tests
// sh """
// docker compose exec php bin/phpunit --log-junit /report/phpunit.xml
// docker compose cp php:/report/phpunit.xml ./phpunit.xml
// """
// }
// // post {
// // success {
// // script {
// // docker.withRegistry('https://index.docker.io/v1/', "${DOCKER_CREDENTIALS}") {
// // docker.image("${DOCKER_IDENTITY}").push()
// // docker.image("${DOCKER_IDENTITY_NGINX}").push()
// // }
// // }
// // }
// // }
// }
// }
// post {
// always {
// // Publicar los resultados de las pruebas de PHPUnit
// xunit (
// thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ],
// tools: [ PHPUnit(pattern: 'phpunit.xml') ]
// )
// // Remove containers
// sh 'docker compose -f ${DOCKER_COMPOSE_FILE} down'
// sh 'docker compose -f ${DOCKER_COMPOSE_FILE} rm -f'
// }
// }
}