我正在尝试将图片上传到Amazon S3。
模型Card.rb有
CardTest#test_uses_image_validation_as_default:
ArgumentError: missing required :bucket option
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/storage/s3.rb:218:in `bucket_name'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/storage/s3.rb:251:in `s3_bucket'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/storage/s3.rb:255:in `s3_object'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/storage/s3.rb:297:in `exists?'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/attachment.rb:557:in `block in queue_all_for_delete'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/attachment.rb:556:in `map'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/attachment.rb:556:in `queue_all_for_delete'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/has_attached_file.rb:92:in `block in add_active_record_callbacks'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:443:in `instance_exec'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:443:in `block in make_lambda'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:161:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:161:in `block in halting'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `block in call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `each'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:501:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:86:in `run_callbacks'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/callbacks.rb:292:in `destroy'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/transactions.rb:263:in `block in destroy'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/transactions.rb:208:in `transaction'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/transactions.rb:263:in `destroy'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/associations/has_one_association.rb:81:in `remove_target!'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/associations/has_one_association.rb:35:in `block in replace'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/associations/has_one_association.rb:101:in `transaction_if'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/associations/has_one_association.rb:34:in `replace'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/associations/has_one_association.rb:73:in `set_new_record'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/protected_attributes-1.0.9/lib/active_record/mass_assignment_security/associations.rb:121:in `build'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/associations/builder/singular_association.rb:18:in `build_card'
/var/lib/jenkins/jobs/PunchhServer/workspace/test/models/card_test.rb:14:in `test_uses_image_validation_as_default'
并且凭据存储在.env文件中。
所有测试在localhost上都是绿色的,但在CI Jenkins服务器上有些失败。
CI服务器上的一个测试用例的跟踪是:
Api::V1::CardsControllerTest#test_index:
ArgumentError: missing required :bucket option
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/storage/s3.rb:218:in `bucket_name'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/storage/s3.rb:173:in `block in extended'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/interpolations.rb:34:in `block (2 levels) in interpolate'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/interpolations.rb:33:in `gsub'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/interpolations.rb:33:in `block in interpolate'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/interpolations.rb:32:in `each'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/interpolations.rb:32:in `inject'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/interpolations.rb:32:in `interpolate'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/url_generator.rb:13:in `for'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/paperclip-4.2.1/lib/paperclip/attachment.rb:143:in `url'
/var/lib/jenkins/jobs/PunchhServer/workspace/app/models/card.rb:131:in `marketing_image_url'
/var/lib/jenkins/jobs/PunchhServer/workspace/app/serializers/api_cardmeta.rb:121:in `marketing_image_url'
(eval):29:in `_fast_attributes'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/serializer.rb:467:in `rescue in attributes'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/serializer.rb:455:in `attributes'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/serializer.rb:479:in `_serializable_hash'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/serializer.rb:361:in `serializable_hash'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/array_serializer.rb:89:in `block in _serializable_array'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/array_serializer.rb:79:in `map'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/array_serializer.rb:79:in `_serializable_array'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/array_serializer.rb:73:in `serializable_array'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/array_serializer.rb:53:in `as_json'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/json/encoding.rb:34:in `encode'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/json/encoding.rb:21:in `encode'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/active_model/array_serializer.rb:63:in `to_json'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/renderers.rb:96:in `block in <module:Renderers>'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/active_model_serializers-0.8.2/lib/action_controller/serialization.rb:46:in `_render_option_json'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/renderers.rb:39:in `block in _handle_render_options'
/usr/local/lib/ruby/2.2.0/set.rb:283:in `each_key'
/usr/local/lib/ruby/2.2.0/set.rb:283:in `each'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/renderers.rb:36:in `_handle_render_options'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/renderers.rb:32:in `render_to_body'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/abstract_controller/rendering.rb:25:in `render'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/rendering.rb:16:in `render'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/local/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/core_ext/benchmark.rb:12:in `ms'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:43:in `render'
/var/lib/jenkins/jobs/PunchhServer/workspace/app/controllers/api/v1/cards_controller.rb:8:in `index'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/abstract_controller/base.rb:189:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/rendering.rb:10:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:113:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:113:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:552:in `block (2 levels) in compile'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:502:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:502:in `call'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/callbacks.rb:86:in `run_callbacks'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/rescue.rb:29:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/notifications.rb:159:in `block in instrument'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activesupport-4.1.10/lib/active_support/notifications.rb:159:in `instrument'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/activerecord-4.1.10/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/abstract_controller/base.rb:136:in `process'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionview-4.1.10/lib/action_view/rendering.rb:30:in `process'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/test_case.rb:595:in `process'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/apipie-rails-0.3.2/lib/apipie/extractor/recorder.rb:153:in `process_with_api_recording'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/test_case.rb:64:in `process'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/devise-3.3.0/lib/devise/test_helpers.rb:19:in `block in process'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/devise-3.3.0/lib/devise/test_helpers.rb:72:in `catch'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/devise-3.3.0/lib/devise/test_helpers.rb:72:in `_catch_warden'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/devise-3.3.0/lib/devise/test_helpers.rb:19:in `process'
/var/lib/jenkins/jobs/PunchhServer/workspace/vendor/bundle/ruby/2.2.0/gems/actionpack-4.1.10/lib/action_controller/test_case.rb:495:in `get'
/var/lib/jenkins/jobs/PunchhServer/workspace/test/controllers/api/v1/cards_controller_test.rb:60:in `test_index'
还有一个
white-space: pre-line;
如何删除此错误?