Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

migrate fails on Travis CI #24

Closed
davidcelis opened this issue Dec 24, 2014 · 6 comments
Closed

migrate fails on Travis CI #24

davidcelis opened this issue Dec 24, 2014 · 6 comments

Comments

@davidcelis
Copy link

Hi; I have a little API I'm writing and trying to test on Travis using a test database. Migrations that run locally don't seem to work on Travis, but no descriptive error ends up being output. Here's a log from Travis:

Using worker: worker-linux-14-2.bb.travis-ci.com:travis-linux-18
system_info
Build system information
Build language: go
Build image provisioning date and time
Sun Dec 14 02:51:49 UTC 2014
lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:    12.04
Codename:   precise
Cookbooks Version
4f2272c https://github.com/travis-ci/travis-cookbooks/tree/4f2272c
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.33
Pre-installed Go versions
go1
go1.0
go1.0.3
go1.1
go1.1.2
go1.2
go1.2.2
go1.3
go1.3.3
go1.4
Redis version
redis-server 2.8.18
riak version
1.4.12
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
Cassandra version
2.0.9
RabbitMQ Version
3.4.2
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.4
Default Sphinx version
2.1.9
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T20:58:10+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_72, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-042stab090.5", arch: "amd64", family: "unix"
Installing an SSH key from: default repository key
Key fingerprint: 98:43:1a:5f:72:81:49:76:42:a3:37:84:d0:b4:86:ff
git.checkout
0.33s$ git clone --depth=50 --branch=master git@github.com:davidcelis/api.rubbi.sh.git davidcelis/api.rubbi.sh
Cloning into 'davidcelis/api.rubbi.sh'...
Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts.
remote: Counting objects: 32, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 32 (delta 7), reused 29 (delta 6)
Receiving objects: 100% (32/32), 5.38 KiB | 0 bytes/s, done.
Resolving deltas: 100% (7/7), done.
Checking connectivity... done.
$ cd davidcelis/api.rubbi.sh
$ git checkout -qf 67594971c68b00e5d185de65f00caef0d4f2e726
postgresql
Starting PostgreSQL v9.3
1.36s$ sudo service postgresql stop
 * Stopping PostgreSQL 9.1 database server        * Stopping PostgreSQL 9.2 database server        * Stopping PostgreSQL 9.3 database server       2.24s$ sudo service postgresql start 9.3
 * Starting PostgreSQL 9.3 database server       
gvm.get
0.31s$ gvm get
Your branch is up-to-date with 'origin/master'.
Already up-to-date.
gvm.update
1.17s$ gvm update && source $HOME/.gvm/scripts/gvm
pulling from https://go.googlecode.com/hg/
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files
(run 'hg update' to get a working copy)
gvm.install
0.07s$ gvm install go1.3.3 --binary || gvm install go1.3.3
Already installed!
0.03s$ gvm use go1.3.3
Now using version go1.3.3
$ export GOPATH=$HOME/gopath:$GOPATH
$ export PATH=$HOME/gopath/bin:$PATH
$ mkdir -p $HOME/gopath/src/github.com/davidcelis/api.rubbi.sh
$ rsync -az ${TRAVIS_BUILD_DIR}/ $HOME/gopath/src/github.com/davidcelis/api.rubbi.sh/
$ export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/davidcelis/api.rubbi.sh
$ cd $HOME/gopath/src/github.com/davidcelis/api.rubbi.sh
$ gvm version
Go Version Manager v1.0.22 installed at /home/travis/.gvm
$ go version
go version go1.3.3 linux/amd64
go.env
$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/travis/gopath:/home/travis/.gvm/pkgsets/go1.3.3/global"
GORACE=""
GOROOT="/home/travis/.gvm/gos/go1.3.3"
GOTOOLDIR="/home/travis/.gvm/gos/go1.3.3/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
install
1.46s$ go get -t -v ./...
github.com/lib/pq (download)
github.com/lib/pq/oid
github.com/lib/pq
github.com/davidcelis/api.rubbi.sh/data
github.com/davidcelis/api.rubbi.sh/cmd/rubbish-api
before_script.1
0.02s$ createuser -s -l -d rubbish
before_script.2
0.23s$ createdb -U rubbish -O rubbish rubbish_test
before_script.3
5.78s$ go get github.com/mattes/migrate
0.98s$ migrate -url 'postgres://rubbish@localhost/rubbish_test?sslmode=disable' -path ./migrations up
> 0001_create_containers.up.sql
> 0002_add_coordinate_constraints_to_containers.up.sql
0.9699 seconds
The command "migrate -url 'postgres://rubbish@localhost/rubbish_test?sslmode=disable' -path ./migrations up" failed and exited with 1 during .
Your build has been stopped.

So it appears that the migrations finish, but then something causes the command to exit 1 without any usable output. Not sure how I should further debug this.

@mattes
Copy link
Owner

mattes commented Dec 25, 2014

I recently made change to the exit statement. Maybe it is related. Tests in master branch seem to work on travis though? What are you doing exactly?

@davidcelis
Copy link
Author

Sorry I've been quiet on this; the repo in question is private right now while I spec it out but I'm gonna switch it over to public soon. I'll link to it here once that happens.

@dkolbly
Copy link

dkolbly commented Jan 13, 2015

We've also started to see migrate return non-zero status, but even in success cases and not just in error cases (the code linked above looks like it is intended to return RC 1 in case of error). Is this intended, or a side-effect/bug of something else?

$ migrate -path db -url postgres://xxx:xxx@localhost/database up

0.0684 seconds
$ echo "RC $?"
RC 1
$ migrate -path db -url postgres://xxx:xxx@localhost/database down
< 0001_create_tables.down.sql

0.0333 seconds
$ echo "RC $?"
RC 1
$ migrate -path db -url postgres://xxx:xxx@localhost/database down

0.0239 seconds
$ echo "RC $?"
RC 1

@dkolbly
Copy link

dkolbly commented Jan 13, 2015

Hmm, I wonder if this line should be returning okFlag instead of false. Looks like writePipe will always signal an error, unless pipe happens to be nil.

dkolbly pushed a commit to dkolbly/migrate that referenced this issue Jan 13, 2015
@dimas-cyriaco
Copy link

@dkolbly solution resolves the problem.

@mattes
Copy link
Owner

mattes commented Feb 4, 2015

I merged #27 which should fix this. Sorry for the delay.

@mattes mattes closed this as completed Feb 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants