0
我試圖讓AWS S3與使用費加羅的Travis一起工作,我完全陷入困境。Rails-無法讓Travis CI掌握我的S3憑證
這一切都在開發模式下正常工作:
picture.rb
class Picture < ApplicationRecord
acts_as_list
belongs_to :imageable, polymorphic: true
has_attached_file :image,
:storage => :s3,
:bucket => Figaro.env.s3_bucket,
:s3_region => 'eu-west-1',
:s3_credentials => {
:access_key_id => Figaro.env.aws_access_key_id,
:secret_access_key => Figaro.env.aws_secret_access_key
}
do_not_validate_attachment_file_type :image
end
application.yml
aws_access_key_id: 'xxx'
aws_secret_access_key: 'xxx'
aws_region: 'eu-west-1'
development:
s3_bucket: 'company-name-dev'
production:
s3_bucket: 'company-name-prod'
顯然特拉維斯需要訪問這些鍵:
.travis .yml
language: ruby
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
rvm:
- 2.4.0
bundler_args: "--jobs=2"
script:
- bundle exec rake db:setup
- bundle exec rake spec
cache: bundler
services:
- postgresql
addons:
postgresql: '9.4'
deploy:
provider: heroku
api_key:
secure: verlongherokukey
app: imkerij
on:
repo: MyGitHub/MyRepoName
skip_cleanup: true
env:
matrix:
- s3_bucket='company-name-dev'
global:
- secure: verylongkey
- secure: anotherverylongkey
我不斷獲取AWS缺少憑據錯誤或費加羅MissingKeys特拉維斯錯誤。
Figaro::MissingKeys: Missing required configuration keys: ["aws_access_key_id", "aws_secret_access_key"]
其中僅加入後BTW發生了:
Figaro.require_keys("aws_access_key_id", "aws_secret_access_key")
,我得到了AWS憑證丟失或東西,所有的時間之前。
似乎鑰匙沒有通過。 當使用ENV表單寫下它們時也不是。然後,即使在開發中,東西也不起作用。
任何幫助肯定是讚賞。讓我堅持了幾天。另一個解決方案,只是使用祕密,我將不勝感激。