Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.travis.yml version setting for postgresql ignored

Tags:

travis-ci

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
like image 213
Olivier Lacan Avatar asked Sep 30 '15 17:09

Olivier Lacan


1 Answers

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 [email protected] if you have any other questions

like image 139
solarce Avatar answered Sep 28 '22 01:09

solarce