elifesciences / elife-xpub

eLife is an open-access journal and technology provider that publishes promising research in the life and biomedical sciences. This is their implementation of a submission and peer review system based on Coko PubSweet and xPub.
https://elifesciences.org/
MIT License
32 stars 5 forks source link

Failing migration doesn't cause CI to fail #2291

Open erezmus opened 5 years ago

erezmus commented 5 years ago

The migration for #2275 had a syntax error but it didn't cause the CI to go red.

from pipeline.log

error: Error while running migrations: CREATE TABLE survey_response (
[2019-07-11T10:07:31.978Z]   response_id UUID PRIMARY KEY,
[2019-07-11T10:07:31.978Z]   submission_id UUID NOT NULL,
[2019-07-11T10:07:31.978Z]   response JSONB NOT NULL,
[2019-07-11T10:07:31.978Z]   created TIMESTAMP WITH TIMEZONE NOT NULL DEFAULT current_timestamp; 
[2019-07-11T10:07:31.978Z] );
[2019-07-11T10:07:31.978Z]  - syntax error at or near "WITH" error: syntax error at or near "WITH"
[2019-07-11T10:07:31.978Z]     at Function.raw (/home/xpub/node_modules/pubsweet/node_modules/knex/lib/util/make-knex.js:48:30)
[2019-07-11T10:07:31.978Z]     at Object.up (/home/xpub/node_modules/pubsweet/node_modules/@pubsweet/db-manager/src/helpers/umzug.js:13:15)
[2019-07-11T10:07:31.978Z]     at <anonymous>
erezmus commented 5 years ago

/cc @giorgiosironi

giorgiosironi commented 5 years ago

The pull request is https://github.com/elifesciences/elife-xpub/pull/2289 The build that should have failed is: https://alfred.elifesciences.org/blue/organizations/jenkins/pull-requests-projects%2Felife-xpub/detail/PR-2289/1/pipeline/39 I imagine

IMAGE_TAG=5b231c2da82945db74de6d7c37cb9ebb734b58c2 NODE_ENV=production NODE_CONFIG_ENV=unit-test docker-compose -f docker-compose.yml -f docker-compose.ci.yml run --rm --name elife-xpub_app_test app npx pubsweet migrate

is returning a 0 exit code, will try to reproduce.

giorgiosironi commented 5 years ago

Confirmed:

$ NODE_ENV=production NODE_CONFIG_ENV=unit-test docker-compose -f docker-compose.yml -f docker-compose.ci.yml run --rm --name elife-xpub_app_test app npx pubsweet migrate
Starting elife-xpub_sftp_1      ... done
Starting elife-xpub_fakes3_1    ... done
Starting elife-xpub_postgres_1  ... done
error: Error while running migrations: CREATE TABLE survey_response (
  response_id UUID PRIMARY KEY,
  submission_id UUID NOT NULL,
  response JSONB NOT NULL,
  created TIMESTAMP WITH TIMEZONE NOT NULL DEFAULT current_timestamp; 
);
 - syntax error at or near "WITH" error: syntax error at or near "WITH"
    at Function.raw (/home/xpub/node_modules/pubsweet/node_modules/knex/lib/util/make-knex.js:48:30)
    at Object.up (/home/xpub/node_modules/pubsweet/node_modules/@pubsweet/db-manager/src/helpers/umzug.js:13:15)
    at <anonymous>
[09:39:35][giorgio@Newton:~/code/elife-xpub]$ echo $?
0

Problem is inside npx pubsweet migrate.

diversemix commented 5 years ago

Raised https://gitlab.coko.foundation/pubsweet/pubsweet/issues/450