diff --git a/Jenkinsfile b/Jenkinsfile index 553edd7..1c2dd88 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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' + // } + // } }