我在嘗試在我的Rails 5.1
項目上嘗試設置Gitlab CI時遇到了一個奇怪的問題,該項目使用apartment
gem來支持多租戶。 我有docker-compose設置來構建我的容器並運行測試。他們通過我的本地機器,但Gitlab管道保持失敗,出現此錯誤。Gitlab-CI和Apartment Gem
$ bundle exec rspec
/builds/demiurge/new_world/spec/models/char/skill_spec.rb:5: warning: toplevel constant Skill referenced by Char::Skill
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
An error occurred in a `before(:suite)` hook.
Failure/Error: Apartment::Tenant.create slug
ActiveRecord::StatementInvalid:
PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SET search_path TO "public", "shared_extensions"
# ./app/models/world.rb:36:in `create_tenant'
# ./spec/rails_helper.rb:52:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# PG::UndefinedObject:
# ERROR: type "hstore" does not exist
# LINE 1: ...har_id" integer, "type" character varying, "data" hstore, "p...
# ^
# ./db/schema.rb:292:in `block in <top (required)>'
Finished in 0.58676 seconds (files took 5 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
我的搬運工,撰寫的設置很簡單:
cache:
image: redis:alpine
ports:
- 6379:6379
db:
image: postgres:9.6-alpine
volumes:
- ./data/db/data:/var/lib/postgresql/data
ports:
- 5432:5432
而且我gilab-ci.yml樣子this。而且我還有一個lib/tasks/apartment.rake
任務,如this,它應該可以在數據庫創建時啓用hstore。任務傳遞給CI,但它仍然返回相同的錯誤。
您可以發佈您'database.yml'嗎? – Aschen