Rails и использование структуры.sql вместо shecma.rb и не удалось выполнить gitlab-ci - PullRequest
0 голосов
/ 07 декабря 2018

У меня есть приложение rails, и из-за пользовательских типов в postgres я использую structure.sql вместо schema.rb.

Это мои коды в gitlab-ci.yml файле:

image: starefossen/ruby-node:2-8

stages:
  - test

cache:
  key: libs
  paths:
    - vendor/bundle
    - vendor/apt

before_script:
  - export LANG=C.UTF-8
  - export LANGUAGE=C.UTF-8
  - export LC_ALL=C.UTF-8
  - echo $RAILS_ENV
  - mkdir -p vendor/apt
  - apt-get update -qq && apt-get -o Dir::Cache::Archives="vendor/apt" install -y build-essential -qq libpq-dev cmake ghostscript libmagic-dev openssh-client
  - ruby -v && node -v
  - which ruby
  - gem install bundler:1.16.2 rake --no-doc
  - bundle install --deployment --without production --jobs $(nproc) "${FLAGS[@]}"

test:
  stage: test
  services:
    - postgres:10.1
    - redis:4.0.2
  tags:
    - docker
  variables:
    RAILS_ENV: test
    RACK_ENV: test
    POSTGRES_DB: dashboard_test
    POSTGRES_USER: runner
    POSTGRES_PASSWORD: ""
  script:
    - find ./config -name "*.yml.sample" -exec sh -c 'mv "$1" "${1%.yml.sample}.yml"' _ {} \;
    - bundle exec rake db:reset --trace
    - bundle exec rspec spec -f d -t ~js

И это моя ошибка в gitlab

$ bundle exec rake db:reset --trace
** Invoke db:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Invoke db:check_protected_environments (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config 
** Execute db:check_protected_environments
** Execute db:drop
** Invoke db:drop:_unsafe (first_time)
** Invoke db:load_config 
** Execute db:drop:_unsafe
** Invoke db:setup (first_time)
** Invoke db:schema:load_if_ruby (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config 
** Execute db:create
** Invoke environment 
** Execute db:schema:load_if_ruby
** Invoke db:structure:load_if_sql (first_time)
** Invoke db:create 
** Invoke environment 
** Execute db:structure:load_if_sql
** Invoke db:structure:load (first_time)
** Invoke environment 
** Invoke db:load_config 
** Invoke db:check_protected_environments 
** Execute db:structure:load
Dropped database 'dashboard_test'
Created database 'dashboard_test'
rake aborted!
failed to execute:
psql -v ON_ERROR_STOP=1 -q -f /builds/zakaria-fatahi/dashboard/db/structure.sql dashboard_test

Please check the output above for any errors and make sure that `psql` is installed in your PATH and has proper permissions.

и я надеваюНе знаю, могу ли я это исправить.

...