工作停顿(结束)

job stalls with (END)

我正在尝试在 travis 上设置两个数据库,但它只是在 before_install 声明的一半停止:

(END)

No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated

https://travis-ci.org/B3Partners/brmo/builds/85746119

我的 yml 如下:

language: java

sudo: false

branches:
  only:
    - travis-integration

addons:
  postgresql: "9.3"

jdk:
#  - openjdk6
#  - openjdk7
  - oraclejdk7
#  - oraclejdk8

matrix:
  fast_finish: true

cache:
  directories:
  - $HOME/.m2

before_install:
  # STAGING
  - psql --version
  - psql -U postgres -c 'create database staging'
  - psql -U postgres -c 'create database rsgb'
  - psql -U postgres --list
  # set up RSGB
  - psql -U postgres -d rsgb -c 'create extension postgis'
  - psql -U postgres -d rsgb -f ./datamodel/generated_scripts/datamodel_postgresql.sql --single-transaction --echo-all
  # - psql -f ./datamodel/utility_scripts/111a_update_gemeente_geom.sql -U postgres -d rsgb --single-transaction
  # - psql -f ./datamodel/utility_scripts/113a_update_wijk_geom.sql -U postgres -d rsgb --single-transaction

install:
  # install all dependencies + artifacts without any testing
  - mvn install -Dmaven.test.skip=true -B -V -fae -q

before_script:
  # dit dient na afloop van de 'install' gedaan te worden omdat de staging DB sql gegenereerd wordt door Hibernate
  - psql -U postgres -d staging -f ./brmo-persistence/target/ddlscripts/create-brmo-persistence-postgresql.sql --single-transaction
  - psql -U postgres -d staging -f ./brmo-persistence/db/01_create_indexes.sql
  - psql -U postgres -d staging -f ./brmo-persistence/db/02_insert_default_user.sql
  - psql -U postgres -d staging -f ./brmo-persistence/db/03_update_status_enum_value.sql

# run tests
script:
  # run unit tests
  - mvn -e test -B
  # run integration tests
  - mvn -e verify -B

after_success:

after_failure:

after_script:

notifications:
  email: false
  #  on_success: [always|never|change] # default: change
  #  on_failure: [always|never|change] # default: always

正如您在日志中看到的那样,它只是在几次 psql 调用后停止。

0.01s$ psql --version
psql (PostgreSQL) 9.3.5
before_install.2
0.02s$ psql -U postgres -c 'create database staging'
CREATE DATABASE
before_install.3
0.22s$ psql -U postgres -c 'create database rsgb'
CREATE DATABASE
before_install.4
1.04s$ psql -U postgres -d rsgb -c 'create extension postgis'
CREATE EXTENSION
$ psql -U postgres --list
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 rsgb      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 staging   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 travis    | travis   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
(6 rows)
(END)
No output has been received in the last 10 minutes, this potentially indicates a stalled build or something wrong with the build itself.
The build has been terminated

我只花了大约 3 个小时来解决同样的问题,一旦您理解了原因,问题就非常简单了。 psql 只是试图对输出进行分页。有多种方法可以禁用寻呼机,但我采用的解决方案是在 .travis.yml 中设置 PAGER=cat 环境变量,如下所示:

env: - PGUSER=postgres PAGER=cat