ruby-on-rails - CircleCI 2.0 - 退出代码 127,找不到捆绑命令
问题描述
我正在尝试让 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
感谢所有帮助,谢谢!
解决方案
您的命令正在 postgres 容器上运行,因为它首先列出。如果您先制作 ruby 容器,那么您将可以访问 bundle。然后当你 SSH 时,你将在 ruby 容器内。
https://circleci.com/docs/2.0/configuration-reference/#docker--machine--macosexecutor
文件中列出的第一个映像定义了将运行所有步骤的主容器映像。
推荐阅读
- nagios - Nagios 配置文件语法
- python - 每当窗口大小发生变化时,如何让 textInput 调整以适应静态小部件
- clojure - Clojure-您将如何从链接中提取天气数据,然后计算出每个日历月中最热的一天
- c++ - c++使用remove方法,其中包含动态文件名
- c++ - C++如何实现回调?
- javascript - 重新加载
- 带有事件处理函数
- c# - C# for 循环:检查 DateTimePicker 是周末还是在数据库中
- r - 通过单击数据表行和操作按钮向数据框添加新行
- python - 从另一个字典的特定值创建新的 Python 字典
- python - 我想在嵌套列表 Python 中追加列表