.travis.yml 忽略 postgresql 的版本设置

.travis.yml version setting for postgresql ignored

my .travis.yml 中有以下内容:

addons:
  postgresql: "9.3"
before_script:
  - psql --version
  - psql -c 'SELECT version();' -U postgres

我得到以下输出:

$ psql --version
$ psql (PostgreSQL) 9.4.0
$ psql -c 'SELECT version();' -U postgres

PostgreSQL 9.1.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit

显然这里有问题,但我不确定如何告诉 Travis 实际使用我指定的 postgres 版本。我关注了the instructions in Travis Docs。这似乎是一个错误。

这是一个问题,因为我使用的是新的 json 列类型,因此出现以下错误:

PG::UndefinedObject: ERROR:  type "json" does not exist

我看了一下,您遇到的本质上是我们的 YAML 解析处理重复键的方式中的 错误。我们正在努力解决我们处理这个问题的方式。

您的 .travis.yml 文件中有两个 addons: 密钥

  1. https://github.com/orientation/orientation/blob/f9850e86a97eff77298f54ce68ca0a07c173e81a/.travis.yml#L6-L7
  2. https://github.com/orientation/orientation/blob/f9850e86a97eff77298f54ce68ca0a07c173e81a/.travis.yml#L39-L41

发生的事情是 last 键获胜并且你的 postgres 东西被默默地丢弃

如果您像下面这样组合它们,它将按预期工作。

addons: postgres: "9.3" code_climate: repo_token: 75408d377a0b3c1ab512bf3fb634617bccf2a1065f8c513e352139427ec8e1fb

有关此示例,请参阅 https://github.com/solarce/orientation/commit/8dd4c1c10b8470ff3529af1d6591d619f211354d and https://travis-ci.org/solarce/orientation/jobs/83220170

如果您有任何其他问题,请随时联系 support@travis-ci.com