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:
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@@ -284,8 +284,10 @@ pipeline {
|
|||||||
e2e_compose_fail_logs
|
e2e_compose_fail_logs
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# --entrypoint "" se pierde en sh/Jenkins (Docker toma "backend" como entrypoint, rompe o ignora CWD/ini)
|
# Cuerpo de -c en variable: las comillas dobles inline en "if ! e2e_compose run ..." se colaban en
|
||||||
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
|
# 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)"
|
echo "ERROR: falló alembic upgrade head (job previo al stack completo)"
|
||||||
e2e_compose_fail_logs
|
e2e_compose_fail_logs
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user