teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

5

しゅうせい

2020/09/20 06:56

投稿

keisuke.F
keisuke.F

スコア19

title CHANGED
File without changes
body CHANGED
@@ -5,25 +5,11 @@
5
5
 
6
6
  #エラー文 circleCIより
7
7
  ```
8
- Config Processing Erorr(Don't rerun)
9
- #!/bin/sh -eo pipefail
8
+ #!/bin/bash -eo pipefail
10
- # Unable to parse YAML
11
- # while parsing a block mapping
12
- # in 'string', line 32, column 11:
13
- # name: install dependencies
14
- # ^
15
- # expected <block end>, but found '<scalar>'
16
- # in 'string', line 35, column 13:
17
- # gem install bundler -v 1.17.3
18
- # ^
19
- #
20
- # -------
21
- # Warning: This configuration was auto-generated to show you the message above.
22
- # Don't rerun this job. Rerunning will have no effect.
23
- false
24
-
25
- Exited with code exit status 1
26
- CircleCI received exit code 1
9
+ bundle exec rake db:create
10
+ Unknown MySQL server host 'db' (-2)
11
+ Couldn't create 'LuggageMGT_test' database. Please check your configuration.
12
+ rake aborted!
27
13
  ```
28
14
 
29
15
  #試した事

4

修正

2020/09/20 06:56

投稿

keisuke.F
keisuke.F

スコア19

title CHANGED
File without changes
body CHANGED
@@ -39,58 +39,62 @@
39
39
  docker:
40
40
  - image: circleci/ruby:2.5.3-node-browsers
41
41
  environment:
42
- - BUNDLER_VERSION: 1.17.3
43
- - RAILS_ENV: 'test'
42
+ RAILS_ENV: 'test'
43
+
44
44
  - image: circleci/mysql:5.6.47
45
45
  environment:
46
- - MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
46
+ MYSQL_ROOT_PASSWORD: "password"
47
- - MYSQL_ROOT_HOST: '%'
47
+ MYSQL_ROOT_HOST: "%"
48
48
 
49
- working_directory: ~/repo
49
+ working_directory: ~/app_name
50
-
50
+
51
51
  steps:
52
52
  - checkout
53
+ - restore_cache: # キャッシュを読み込む
54
+ keys:
55
+ - gem-cache-v1-{{ checksum "Gemfile.lock" }}
56
+ - gem-cache-v1-
53
57
 
54
- - restore_cache:
55
- keys:
58
+ - run:
56
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
57
- - v1-dependencies-
59
+ name: Bundle Install
60
+ command: bundle check --path vendor/bundle || bundle install --deployment
58
61
 
62
+ - save_cache: # キャッシュを保存する
63
+ key: gem-cache-v1-{{ checksum "Gemfile.lock" }}
64
+ paths:
65
+ - vendor/bundle
66
+
59
67
  - run:
60
- name: install dependencies
68
+ name: Wait for DB
61
- command: |
62
- gem install bundler -v 1.17.3
63
- bundle install --jobs=4 --retry=3 --path vendor/bundle
64
-
65
- - save_cache:
66
- paths:
67
- - ./vendor/bundle
68
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
69
+ command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
69
-
70
- - run: mv config/database.yml.ci config/database.yml
71
-
72
70
  - run: bundle exec rake db:create
73
71
  - run: bundle exec rake db:schema:load
74
72
  - run:
75
73
  name: run tests
76
74
  command: |
77
75
  mkdir /tmp/test-results
78
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
76
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
79
- circleci tests split --split-by=timings)"
80
-
81
- bundle exec rspec \
77
+ bundle exec rspec --format progress \
78
+ --out /tmp/test-results/rspec.xml \
82
- --format progress \
79
+ --format progress \
83
- --format RspecJunitFormatter \
84
- --out /tmp/test-results/rspec.xml \
85
- --format progress \
86
- $TEST_FILES
80
+ $TEST_FILES
87
-
88
81
  - store_test_results:
89
82
  path: /tmp/test-results
90
83
  - store_artifacts:
91
84
  path: /tmp/test-results
92
85
  destination: test-results
93
86
 
87
+ - add_ssh_keys:
88
+ fingerprints:
89
+ - "1f:d5:4b:1c:ed:c1:92:6e:47:a1:e0:18:a0:ff:27:ca"
90
+
91
+ - deploy:
92
+ name: Capistrano deploy
93
+ command: |
94
+ if [ "${CIRCLE_BRANCH}" != "master" ]; then
95
+ exit 0
96
+ fi
97
+ bundle exec cap production deploy unicorn:restart
94
98
  ```
95
99
 
96
100
  dockerfile

3

修正

2020/09/20 06:55

投稿

keisuke.F
keisuke.F

スコア19

title CHANGED
File without changes
body CHANGED
@@ -162,4 +162,53 @@
162
162
  ```
163
163
  name@mbp リポジトリ名 % bundler -v
164
164
  Bundler version 1.17.3
165
+ ```
166
+
167
+
168
+ 追記です。
169
+
170
+ config.yml内の
171
+ ```
172
+ - run: mv config/database.yml.ci config/database.yml
173
+ ```
174
+
175
+ を削除したら、circleCIのエラーが変わりました。
176
+ 下記がエラーです。
177
+ ```
178
+ #!/bin/bash -eo pipefail
179
+ bundle exec rake db:create
180
+ Unknown MySQL server host 'db' (-2)
181
+ Couldn't create 'LuggageMGT_test' database. Please check your configuration.
182
+ rake aborted!
183
+ Mysql2::Error::ConnectionError: Unknown MySQL server host 'db' (-2)
184
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `connect'
185
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:90:in `initialize'
186
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `new'
187
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `mysql2_connection'
188
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:830:in `new_connection'
189
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:874:in `checkout_new_connection'
190
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `try_to_checkout_new_connection'
191
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:814:in `acquire_connection'
192
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:538:in `checkout'
193
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
194
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:1033:in `retrieve_connection'
195
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
196
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/connection_handling.rb:90:in `connection'
197
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/mysql_database_tasks.rb:6:in `connection'
198
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/mysql_database_tasks.rb:14:in `create'
199
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/database_tasks.rb:119:in `create'
200
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current'
201
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
202
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/database_tasks.rb:313:in `each'
203
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
204
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/tasks/database_tasks.rb:138:in `create_current'
205
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.4/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>'
206
+ /home/circleci/repo/vendor/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
207
+ /usr/local/bundle/bin/bundle:23:in `load'
208
+ /usr/local/bundle/bin/bundle:23:in `<main>'
209
+ Tasks: TOP => db:create
210
+ (See full trace by running task with --trace)
211
+
212
+ Exited with code exit status 1
213
+ CircleCI received exit code 1
165
214
  ```

2

修正

2020/09/19 08:37

投稿

keisuke.F
keisuke.F

スコア19

title CHANGED
File without changes
body CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  #エラー文 circleCIより
7
7
  ```
8
+ Config Processing Erorr(Don't rerun)
8
9
  #!/bin/sh -eo pipefail
9
10
  # Unable to parse YAML
10
11
  # while parsing a block mapping

1

修正

2020/09/19 08:30

投稿

keisuke.F
keisuke.F

スコア19

title CHANGED
File without changes
body CHANGED
@@ -3,6 +3,28 @@
3
3
  現在docker環境でcircleCIで自動デプロイ 、自動テストに挑戦しています。
4
4
  いろいろな記述方法を行う中で、とうとうciecleCIで出たエラーに詰まってしまいました。
5
5
 
6
+ #エラー文 circleCIより
7
+ ```
8
+ #!/bin/sh -eo pipefail
9
+ # Unable to parse YAML
10
+ # while parsing a block mapping
11
+ # in 'string', line 32, column 11:
12
+ # name: install dependencies
13
+ # ^
14
+ # expected <block end>, but found '<scalar>'
15
+ # in 'string', line 35, column 13:
16
+ # gem install bundler -v 1.17.3
17
+ # ^
18
+ #
19
+ # -------
20
+ # Warning: This configuration was auto-generated to show you the message above.
21
+ # Don't rerun this job. Rerunning will have no effect.
22
+ false
23
+
24
+ Exited with code exit status 1
25
+ CircleCI received exit code 1
26
+ ```
27
+
6
28
  #試した事
7
29
  bundlerのバージョン指定でエラーが出ている様で、bundlerをuninstallし、新たにインストールしました。
8
30