From 20e6ff797ded88ac7013196f8b87c9cc6b153d9f Mon Sep 17 00:00:00 2001 From: JKuijperM Date: Wed, 30 Sep 2026 16:08:46 +0200 Subject: [PATCH] Updated Jenkinsfile --- expenses_manager/Jenkinsfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/expenses_manager/Jenkinsfile b/expenses_manager/Jenkinsfile index 551b394..2465935 100644 --- a/expenses_manager/Jenkinsfile +++ b/expenses_manager/Jenkinsfile @@ -207,22 +207,24 @@ pipeline { # edit plus "docker-compose up -d web". ssh ${SSH_OPTS} ${NAS_USER}@${NAS_HOST} \ "echo WEB_IMAGE=${IMAGE}:${SHA} > ${COMPOSE_DIR}/.env \ - && cd ${COMPOSE_DIR} \ - && sudo ${NAS_COMPOSE} up -d web" + && cd ${COMPOSE_DIR} \ + && sudo ${NAS_COMPOSE} up -d web" ''' script { - // Confirm the application actually answers. A container that - // starts and immediately crashes would otherwise pass as a - // successful deployment. + // The Host header must match ALLOWED_HOSTS or Django answers + // 400 regardless of health. A 301 is the expected reply here: + // 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: ''' ssh ${SSH_OPTS} ${NAS_USER}@${NAS_HOST} \ "sleep 10 && curl -s -o /dev/null -w '%{http_code}' \ + -H 'Host: finanzas.kuijper.es' \ http://127.0.0.1:8001/" ''').trim() echo "Respuesta HTTP: ${code}" - if (!(code in ['200', '302'])) { + if (!(code in ['200', '301', '302'])) { error("La aplicacion no responde correctamente (HTTP ${code})") } } -- 2.45.2