[RUBY] [Circle CI] A story I was addicted to at Start Building

Premise

I'm new to CircleCI.

Rails 6.0.3.1



#### **`ruby 2.6.3`**

Bundler version 2.1.4



***


 By referring to the following article, I was trying to introduce circleCI to the original application in cooperation with github.
 [[CircleCI] Run rubocop and rspec tests in cooperation with github with Rails app](https://qiita.com/AK4747471/items/b2161784065f21cd1645)
 Then the following error ...

#!/bin/bash -eo pipefail bundle -v Traceback (most recent call last):

2: from /usr/local/bin/bundle:23:in `<main>'

1: from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'

/usr/local/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/circleci/project/Gemfile.lock. (Gem::GemNotFoundException)

To update to the latest version installed on your system, run bundle update --bundler.

To install the missing version, run gem install bundler:2.1.4

Exited with code exit status 1 CircleCI received exit code 1


 For now, let's take a look at the contents of ``` .circleci / config.yml```.


#### **`.circleci/config.yml`**

version: 2.1 orbs: ruby: circleci/[email protected]

jobs: build: docker: - image: circleci/ruby:2.6.3-stretch-node executor: ruby/default steps: - checkout - run: name: Which bundler? command: bundle -v - ruby/bundle-install


 That is different from what I set in the ``` docker``` branch ...
 It wasn't merged properly.
 An ordinary mistake.
 Rewrite it properly and then try again
```set up priject```→```start building```Let's do it!

 By the way, I referred to the following article for how to write ``` config.yml```.
 [Create an environment where you can execute system specifications with CircleCI while converting an existing Rails 6 application to Docker](https://qiita.com/kenzoukenzou104809/items/e3d970b59bf106cab19e)



#### **`.circleci/config.yml`**

version: 2 jobs: build: working_directory: ~/my-app docker: - image: circleci/ruby:2.6.3-node-browsers environment: BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle BUNDLER_VERSION: 2.1.4
DATABASE_URL: postgres://postgres:password@localhost:5432/myapp_test RAILS_ENV: test - image: circleci/postgres:11-alpine steps: - checkout - restore_cache: keys: - my-app-bundle-v1-{{ checksum "Gemfile.lock" }} - my-app-bundle-v1- - run: name: Bundler install command: | gem update --system gem install bundler -v 2.1.4 - run: name: Bundle Install command: bundle check || bundle install - save_cache: key: my-app-bundle-v1-{{ checksum "Gemfile.lock" }} paths: - vendor/bundle - restore_cache: keys: - rails-demo-yarn-{{ checksum "yarn.lock" }} - rails-demo-yarn- - run: name:Install Yarn command: yarn install --cache-folder ~/.cache/yarn - run: name: Wait for DB command: dockerize -wait tcp://127.0.0.1:5432 -timeout 1m - run: name: Database setup command: bin/rails db:create db:schema:load --trace - run: bundle exec bin/webpack - run: name: execute rspec command: bundle exec rspec - store_test_results: path: /tmp/test-results


 As a caveat, bundle install seems to fail if it is ``` ** bundle 2.0.1 or higher` ``, so you need to explicitly specify it in the environment.
 Excerpt below.


#### **`.circleci/config.yml`**

#abridgement docker: - image: circleci/ruby:2.6.3-node-browsers environment: BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle #Specify the version BUNDLER_VERSION: 2.1.4
DATABASE_URL: postgres://postgres:password@localhost:5432/myapp_test RAILS_ENV: test #abridgement


 Along with that, specify the version for oysters


#### **`.circleci/config.yml`**

 The above is now `` `Success```.

 Reference article
 > [[CircleCI] "You must use Bundler 2 or greater with this lock file." Error](https://haayaaa.hatenablog.com/entry/2019/10/05/223705)
 [[CircleCI] Run rubocop and rspec tests in cooperation with github with Rails app](https://qiita.com/AK4747471/items/b2161784065f21cd1645)
 [[CircleCI] Easy individual CI introduction method starting from CircleCI 2.0-until cooperation with github](https://www.tweeeety.blog/entry/2018/02/09/195345)




Recommended Posts

[Circle CI] A story I was addicted to at Start Building
A story I was addicted to in Rails validation settings
A story I was addicted to before building a Ruby and Rails environment using Ubuntu (20.04.1 LTS)
A story I was addicted to when testing the API using MockMVC
A story I was addicted to when getting a key that was automatically tried on MyBatis
The story I was addicted to when setting up STS
I was addicted to starting sbt
A story I was addicted to with implicit type conversion of ActiveRecord during unit testing
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
A story addicted to JDBC Template placeholders
I was addicted to rewriting to @SpringApplicationConfiguration-> @SpringBootTest
I was addicted to the roll method
I was addicted to the Spring-Batch test
I was addicted to a simple test of Jedis (Java-> Redis library)
Problems I was addicted to when building the digdag environment with docker
I was a little addicted to running old Ruby environment and old Rails
I was a little addicted to ssh connection from mac to linux (ubuntu)
A story that I was addicted to twice with the automatic startup setting of Tomcat 8 on CentOS 8
I was addicted to using RXTX on Sierra
A story addicted to EntityNotFoundException of getOne of JpaRepository
I was addicted to installing Ruby/Tk on MacOS
I was addicted to doing onActivityResult () with DialogFragment
I was a little addicted to the S3 Checksum comparison, so I made a note.
SpringSecurity I was addicted to trying to log in with a hashed password (solved)
I was addicted to the NoSuchMethodError in Cloud Endpoints
What I was addicted to when developing a Spring Boot application with VS Code
I was addicted to the record of the associated model
A memo that I was addicted to when making batch processing with Spring Boot
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
What I was addicted to when introducing the JNI library
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
What I was addicted to while using rspec on rails
I was addicted to setting default_url_options with Rails devise introduction
I was addicted to looping the Update statement on MyBatis
A story addicted to toString () of Interface proxied with JdkDynamicAopProxy
I was addicted to the setting of laradock + VSCode + xdebug
What I was addicted to with the Redmine REST API
I was addicted to using Java's Stream API in Scala
I made a Dockerfile to start Glassfish 5 using Oracle Java
A story that I struggled to challenge a competition professional with Java
I tried to summarize what was asked at the site-java edition-
I get a Ruby version error when I try to start Rails.
What I was addicted to when implementing google authentication with rails
About the matter that I was addicted to how to use hashmap
I tried to summarize devise which was difficult at first glance
I was addicted to the API version min23 setting of registerTorchCallback
[Circle CI 2.0] Set to support JavaScript
The story I wanted to unzip
Android memo-I was addicted to Permission
A memo that was soberly addicted to the request of multipart / form-data
CodeStar Banzai! CI / CD pipeline to start with just a few clicks
Memorandum: What I was addicted to when I hit the accounting freee API
[Rails] I was addicted to the nginx settings when using Action Cable.
I was in trouble at work, so I made a plugin for IntelliJ
My.cnf configuration problem that I was addicted to when I was touching MySQL 8.0 like 5.7
Recorded because I was addicted to the standard input of the Scanner class
It was a life I wanted to reset the thread-safe associative counter
I was addicted to scrollview because I couldn't tap the variable size UIView
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
I was addicted to unit testing with the buffer operator in RxJava
A story that was embarrassing to give anison file to the production environment