Compare commits

..

4 Commits

Author SHA1 Message Date
f2e332f35b Merge pull request 'dev' (#37) from dev into main
All checks were successful
Tests / CI / Run tests passed: 206
expenses_manager/pipeline/head This commit looks good
Reviewed-on: #37
2026-09-30 14:09:54 +00:00
73264a9685 Merge branch 'main' into dev
All checks were successful
Tests / CI / Run tests passed: 206
expenses_manager/pipeline/head This commit looks good
2026-09-30 14:09:41 +00:00
442b5fbf0b Merge branch 'dev' of https://gitea.kuijper.es/jkuijperm/expenses_manager into dev
All checks were successful
Tests / CI / Run tests passed: 206
expenses_manager/pipeline/head This commit looks good
2026-09-30 16:08:52 +02:00
20e6ff797d Updated Jenkinsfile 2026-09-30 16:08:46 +02:00

View File

@ -207,22 +207,24 @@ pipeline {
# edit plus "docker-compose up -d web". # edit plus "docker-compose up -d web".
ssh ${SSH_OPTS} ${NAS_USER}@${NAS_HOST} \ ssh ${SSH_OPTS} ${NAS_USER}@${NAS_HOST} \
"echo WEB_IMAGE=${IMAGE}:${SHA} > ${COMPOSE_DIR}/.env \ "echo WEB_IMAGE=${IMAGE}:${SHA} > ${COMPOSE_DIR}/.env \
&& cd ${COMPOSE_DIR} \ && cd ${COMPOSE_DIR} \
&& sudo ${NAS_COMPOSE} up -d web" && sudo ${NAS_COMPOSE} up -d web"
''' '''
script { script {
// Confirm the application actually answers. A container that // The Host header must match ALLOWED_HOSTS or Django answers
// starts and immediately crashes would otherwise pass as a // 400 regardless of health. A 301 is the expected reply here:
// successful deployment. // SECURE_SSL_REDIRECT sends plain HTTP to HTTPS, and reaching
// that redirect already proves the app processed the request.
def code = sh(returnStdout: true, script: ''' def code = sh(returnStdout: true, script: '''
ssh ${SSH_OPTS} ${NAS_USER}@${NAS_HOST} \ ssh ${SSH_OPTS} ${NAS_USER}@${NAS_HOST} \
"sleep 10 && curl -s -o /dev/null -w '%{http_code}' \ "sleep 10 && curl -s -o /dev/null -w '%{http_code}' \
-H 'Host: finanzas.kuijper.es' \
http://127.0.0.1:8001/" http://127.0.0.1:8001/"
''').trim() ''').trim()
echo "Respuesta HTTP: ${code}" echo "Respuesta HTTP: ${code}"
if (!(code in ['200', '302'])) { if (!(code in ['200', '301', '302'])) {
error("La aplicacion no responde correctamente (HTTP ${code})") error("La aplicacion no responde correctamente (HTTP ${code})")
} }
} }