Refactor Alembic command execution in Jenkinsfile for improved reliability

- Changed the Alembic upgrade command to use a variable for the command string, preventing issues with inline double quotes in the shell execution.
- Updated comments to clarify the changes made and their impact on the command execution context within the Docker environment.
This commit is contained in:
2026-04-24 14:00:28 -05:00
parent 607d3841f6
commit ae4644cb75

6
Jenkinsfile vendored
View File

@@ -284,8 +284,10 @@ pipeline {
e2e_compose_fail_logs
exit 1
fi
# --entrypoint "" se pierde en sh/Jenkins (Docker toma "backend" como entrypoint, rompe o ignora CWD/ini)
if ! e2e_compose run --rm --no-deps --entrypoint /bin/sh backend -c "set -eux; test -f /app/alembic.ini; cd /app; exec alembic -c /app/alembic.ini upgrade head"; then
# Cuerpo de -c en variable: las comillas dobles inline en "if ! e2e_compose run ..." se colaban en
# el shell de Jenkins y -c quedaba solo con "set"; el resto se ejecutaba en el host (no existe /app)
E2E_ALEMBIC_CMD='set -eux; test -f /app/alembic.ini; cd /app; exec alembic -c /app/alembic.ini upgrade head'
if ! e2e_compose run --rm --no-deps --entrypoint /bin/sh backend -c "$E2E_ALEMBIC_CMD"; then
echo "ERROR: falló alembic upgrade head (job previo al stack completo)"
e2e_compose_fail_logs
exit 1