缺少必需的参数:aws_access_key_id,aws_secret_access_key - Travis

时间:2017-01-21 20:51:22

标签: ruby-on-rails ruby amazon-s3 carrierwave

我在运行travis Intent i = new Intent(getApplicationContext(), NextActivity.class); startActivity(i); 时收到此错误。它停止了我的构建。我使用carrierwave进行文件上传并将其存储在S3上。这很奇怪,因为它实际上将它们存储在我的S3桶中,所以我知道我的aws键是正确的。附:我使用费加罗。

这是我的代码。

AVATAR UPLOADER:

ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key

Storage.rb

 class AvatarUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick

  # Choose what kind of storage to use for this uploader:
  storage :fog

  def extension_whitelist
    %w(jpg jpeg gif png)
  end

  process :resize_to_limit => [50, 50]

  def default_url(*args)
    ActionController::Base.helpers.asset_path("fallback/" + [version_name, "pete.png"].compact.join('_'))
  end
end

这里的主要问题是我的travis构建在运行 CarrierWave.configure do |config| config.fog_credentials = { provider: 'AWS', aws_access_key_id: ENV["aws_access_id"], aws_secret_access_key: ENV["aws_access_secret_key"], region: 'us-west-2' } config.storage = :fog config.fog_directory = "lockdown-bucket" config.fog_public = false end 时停止并且我在标题中收到错误。有人知道我做错了吗?

1 个答案:

答案 0 :(得分:0)

首先,您需要安装gem:gem install travis

之后:

travis encrypt aws_access_id=Your_aws_s3_key --add

travis encrypt aws_access_secret_key=Your_aws_s3_secret --add

它会自动添加到您的.travis.yml file

它会是这样的: language: ruby rvm: - 2.4.0 env: global: - secure: dwnrYRL4pm0JIU4Qq4mp... - secure: e+rtcUZ8mWVMRq6NP540qtu/ZwYpQ5JT... matrix: - DB: postgresql script: - RAILS_ENV=test bundle exec rake db:migrate --trace - bundle exec rake db:test:prepare - bundle exec rspec spec before_script: - psql -c 'create database DB_NAME_test' -U postgres - cp config/database.travis.yml config/database.yml

DB_NAME - 您的数据库名称

Your_aws_s3_key&amp;&amp; Your_aws_s3_secret必须没有等待。