CircleCI 2.0-退出代码127,找不到捆绑包命令

时间:2018-11-10 21:43:13

标签: ruby-on-rails ruby circleci

我正在尝试使Rails应用程序在Circle CI上运行。使用以下配置,我似乎根本无法工作。 SSH时,我什至无法运行sudo

以下是错误输出:

install dependencies
$ #!/bin/bash -eo pipefail
bundler install --jobs=4 --retry=3 --path vendor/bundle
/bin/bash: bundler: command not found
Exited with code 127

我注意到assets/目录下只有vendor

这是我的配置文件:

version: 2
jobs:
  build:
    working_directory: ~/repo
    docker:
      - image: circleci/postgres:9.6-alpine-postgis-ram

      - image: circleci/ruby:2.3
        environment:
          PGHOST: 127.0.0.1
          PGUSER: staging
          RAILS_ENV: test

      - image: circleci/postgres:10.5
        environment:
          POSTGRES_USER: staging
          POSTGRES_DB: test
          POSTGRES_PASSWORD: ""

    steps:
      - checkout

      # 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-

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

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

      # Database setup
      - run: bundle exec rake db:create
      - run: bundle exec rake db:schema:load

      # run tests!
      - run:
          name: run tests
          command: |
            mkdir /tmp/test-results
            TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"

            bundle exec rspec --format progress \
                            --format RspecJunitFormatter \
                            --out /tmp/test-results/rspec.xml \
                            --format progress \
                            $TEST_FILES

      # collect reports
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results
          destination: test-results

感谢所有帮助,谢谢!

1 个答案:

答案 0 :(得分:1)

您的命令正在postgres容器上运行,因为它首先列出了。如果您首先制作红宝石容器,那么您将可以使用捆绑软件。然后,当您使用SSH时,您将位于ruby容器中。

https://circleci.com/docs/2.0/configuration-reference/#docker--machine--macosexecutor

  

文件中列出的第一张图片定义了将运行所有步骤的主要容器图片。