Как исправить «Не удалось найти ____ ни в одном из источников» на CI проекта Rails? - PullRequest
0 голосов
/ 11 июня 2019

Я использую Circle CI для запуска тестов перед развертыванием. Все работало нормально, до обновления Nokogiri до 1.10.3. Теперь мой первый тест всегда терпит неудачу, хотя в моей локальной среде все работает нормально.

Точная ошибка:

bundle exec rails test test/controllers -f RAILS_ENV=test

Could not find Ascii85-1.0.0 in any of the sources
Run `bundle install` to install missing gems.

Я попробовал следующее, чтобы попытаться исправить:

  1. Установка Ascii85 вручную как часть сборки CI
  2. Добавление Ascii85 в мой Gemfile
  3. Полностью отключить любое кэширование зависимостей
  4. Изменение образа док-станции Circle на ruby:2.6.1-stretch-node-browsers
  5. Обновление до ruby ​​2.6.3 и обновление гемов
  6. ssh'd в работающий экземпляр Circle. bundle install показывает все драгоценные камни, но выполнение любой команды rails, которая требует их, выдает ту же ошибку, что и выше.

Ничего из этого не сработало. Что мне здесь не хватает? Драгоценный камень Ascii85 - это зависимость от используемого мной PDF-ридера.

Содержимое .circleci/config.yml:

# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2

jobs:
  build:
    docker:
      # documented at https://circleci.com/docs/2.0/circleci-images/
       - image: circleci/ruby:2.6.1-stretch-node-browsers
       - image: circleci/mysql:5.7.25
         command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb-large-prefix=1 --innodb-file-format=Barracuda --innodb-file-per-table=1
         environment:
           MYSQL_ALLOW_EMPTY_PASSWORD: yes
           MYSQL_ROOT_PASSWORD: ''
           MYSQL_DATABASE: circleci
           RAILS_ENV: test
           BUNDLER_VERSION: 2.0.1

    working_directory: ~/repo

    steps:
      - run: sudo apt update; sudo apt install pdftk
      - checkout
      - run: cp config/database.yml.circleci config/database.yml

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "Gemfile.lock" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - restore_cache:
          name: Restore yarn cache
          key: myapp-yarn-{{ checksum "yarn.lock" }}

      # - run: gem install Ascii85-1.0.3
      - run:
          name: install dependencies
          command: |
            bundle install --jobs=4 --retry=3 --path vendor/bundle

      - run:
          name: install yarn dependencies
          command: yarn install

      - save_cache:
          paths:
            - ./vendor/bundle
          key: v1-dependencies-{{ checksum "Gemfile.lock" }}

      - save_cache:
          paths:
            - ~/.yarn-cache
          key: myapp-yarn-{{ checksum "yarn.lock" }}

      - run: bundle exec rake db:setup RAILS_ENV=test

      - run:
          name: Test controllers
          command: |
            bundle exec rails test test/controllers -f RAILS_ENV=test

      - run:
          name: Test models
          command: |
            bundle exec rails test test/models -f RAILS_ENV=test

      - run:
          name: Run integration tests
          command: |
            bundle exec rails test test/integration --exclude "/quote|order|pdf|Pdf|job/i" RAILS_ENV=test


workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build

Обновление

Я обнаружил, что запуск bundle exec rake test:models будет работать - без ошибок. Но использовать тестер bundle exec rails test:models не удастся. Итак, некоторый прогресс, но на самом деле это не решение для меня, потому что мне нравится возможность использовать минимальные параметры для нового бегуна, такие как -n или -v.

...