sonatype / nexus-ruby-support

26 stars 7 forks source link

Upload gem failure on open_ssl #61

Open sheehacm opened 8 years ago

sheehacm commented 8 years ago

I have been working on automating the upload of a custom gem to nexus. In order to do so I have created a rake tasks which builds the gem and then runs the command 'gem nexus test-gem-1.0.0'. The task creates the credentials file and stores the url and the authorization within this file the same way the gem would.

When I try running 'gem nexus test-gem-1.0.0' I receive the following error:

Exception LoadError' at /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- rubygems/commands/nexus_command ExceptionLoadError' at /opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132 - cannot load such file -- rubygems/commands/nexus_command Uploading gem to Nexus... PUT https://test-test.com/nexus/content/repositories/hostedgems/gems/test-0.1.64.gem use authorization Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /opt/chefdk/embedded/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block something went wrong

Any idea what could be causing this?

mkristian commented 8 years ago

is it possible to try without ssl, i.e. with http://test-test.com/ ? just to make sure it is a SSL problem.

sheehacm commented 8 years ago

There is not a way for me to do this. I am assuming this has to related to the way I created the credential file and stored the information. This was done in a rake task. `if File.exist?('/var/lib/jenkins/.gem/nexus') puts "credentials file already exists" else credentials = File.new('/var/lib/jenkins/.gem/nexus', "w+") credentials.close end

token = "#{username}:#{password}" auth = "Basic #{Base64.encode64(token).gsub(/\s+/, '')}" @all = { :url => url, :authorization => auth }

File.open('/var/lib/jenkins/.gem/nexus', 'w') {|f| f.write @all.to_yaml} File.chmod(0100600, '/var/lib/jenkins/.gem/nexus') rescue nil system "gem nexus test-gem-1.0.0.gem"`

mkristian commented 8 years ago

the ~/.gem/nexus files looks OK

something went wrong is an error on the nexus server, something like the gem file-name 'test-gem-1.0.0.gem' does not match what the specification of the gem would produce. did you build the gem with gem build test-gem.gemspec ?

looking at the server logs can reveal something

sheehacm commented 8 years ago

after looking at the logs I noticed that the jvm is out of heap space. After clearing this up it should work. Thanks for the help!

sheehacm commented 8 years ago

I'm not exactly sure how the credentials should be handled. Right now I have created the ~/.gem/nexus file myself and provide the credentials. I am doing this in order to skip the step of being asked for the information. I am unsure if the gem will except these in the way they are provided. Is there anything I am missing from the script I provided above?

mkristian commented 8 years ago

something went wrong should produce a server side log entry. no the script looks good from here