.travis.yml version setting for postgresql ignored

二次信任 提交于 2019-12-22 07:05:08

问题


With the following in my .travis.yml:

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

I get the following output:

$ 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

Obviously there's something wrong here but I'm not sure how to tell Travis to actually use the postgres version I specified. I followed the instructions in Travis Docs. This seems like a bug.

This is an issue because I'm using the new json column type and therefore getting the following error:

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

回答1:


I took a look and what you're encountering is essentially a bug in how our YAML parsing handles duplicate keys. Fixing how we handle this is something we're working.

You have two addons: keys in your .travis.yml files

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

What happens is that the last key wins and your postgres stuff is silently discarded.

If you combine them like the following, it will work as desired.

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

See https://github.com/solarce/orientation/commit/8dd4c1c10b8470ff3529af1d6591d619f211354d and https://travis-ci.org/solarce/orientation/jobs/83220170 for an example of this

Please feel free to also reach out to support@travis-ci.com if you have any other questions



来源:https://stackoverflow.com/questions/32872000/travis-yml-version-setting-for-postgresql-ignored

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!