CircleCIで最後capistarnoによるデプロイ実行を行う際に下記エラーが発生してしまいます。
ローカルターミナルでbundle exec cap production deployを実行すると問題なくデプロイできます。
#!/bin/bash -eo pipefail bundle exec cap production deploy cap aborted! SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@EIP: Authentication failed for user ec2-user@EIP Caused by: Net::SSH::AuthenticationFailed: Authentication failed for user ec2-user@EIP Tasks: TOP => rbenv:validate (See full trace by running task with --trace) Exited with code exit status 1
.circleci/config
deploy: docker: - image: cimg/ruby:3.0.2-node auth: username: username password: password working_directory: ~/my_app steps: - checkout: path: ~/my_app - ruby/install-deps - add_ssh_keys: fingerprints: xx:xx:xx:... - run: name: 自動デプロイ command: bundle exec cap production deploy workflows: version: 2 build_and_test_and_deploy: jobs: - build - test: requires: - build - deploy: requires: - test filters: branches: only: master
試したこと
初めはcircleci のSSH KEYを設定せずに実行して上記エラーが発生したので
ec2ターミナルで下記の通り、private keyを確認し、SSH KEYとしてcircleciに追加しました。
[ec2-user@ip ~]$ cat ~/.ssh/id_rsa -----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
fingerprintsも下記の通り読み込まれていることを確認しました。
#installing addtional ssh keys Installed key xx:xx:xx....
この状態でgit pushしても結果は変わりませんでした。
回答1件
あなたの回答
tips
プレビュー