Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy new gem with latest gems #574

Closed
chuwy opened this issue Jan 25, 2017 · 20 comments
Closed

Unable to deploy new gem with latest gems #574

chuwy opened this issue Jan 25, 2017 · 20 comments

Comments

@chuwy
Copy link

chuwy commented Jan 25, 2017

Having pretty standard configuration:

language: ruby
rvm:
 - 2.0.0
 - 2.4.0

install:
 - gem install bundler
 - bundle install
 - gem install rspec
 - gem install coveralls

script: rspec

deploy: 
 provider: rubygems
 api_key: $RUBYGEMS_API_KEY
 gemspec: my-new-gem.gemspec
 on: 
  tags: true

I couldn't push new gem to RubyGems.org. Travis gave me following error:

/home/travis/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/json/common.rb:155:in `parse': 757: unexpected token at 'This rubygem could not be found.' (JSON::ParserError)
	from /home/travis/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/json/common.rb:155:in `parse'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/gems-1.0.0/lib/gems/client.rb:27:in `info'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/gems-1.0.0/lib/gems.rb:17:in `method_missing'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/lib/dpl/provider/rubygems.rb:27:in `check_app'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/lib/dpl/provider.rb:135:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/lib/dpl/provider.rb:133:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.2.0/gems/dpl-1.8.31/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.2.0/bin/dpl:23:in `load'
	from /home/travis/.rvm/gems/ruby-2.2.0/bin/dpl:23:in `<main>'
	from /home/travis/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
	from /home/travis/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'

Seems that problem is in updated dpl >= 1.8.30 which transitively includes gems-1.0.0.

When I used this deployment script, my problem was solved:

#!/bin/sh

yes y | gem uninstall dpl
yes y | gem uninstall gems
gem install gems -v 0.8.3
gem install dpl -v 1.8.27
dpl --provider=rubygems --api-key=$RUBY_GEMS_API_KEY --gemspec=./my-new-gem.gemspec
@chuwy chuwy changed the title Unable to deploy new gem with lates gems Unable to deploy new gem with latest gems Jan 25, 2017
@BanzaiMan
Copy link
Contributor

Do you have a build log URL that shows the problem you are describing here?

@chuwy
Copy link
Author

chuwy commented Jan 25, 2017

Hello @BanzaiMan,

Yes, I do have a minimal example project and its failing logs - from 3rd-5th and 8th builds are failed due above problem, 9th succeeds when I removed and reinstalled both dpl and gems.

@BanzaiMan
Copy link
Contributor

The problem lies somewhere else. In https://travis-ci.org/travis-ci/dpl/jobs/195179681#L1084, you see that our dpl gem itself is able to use gems 1.0.0, dpl 1.8.31 and publish the gem correctly.

I don't know what the issue is exactly, though.

@chuwy
Copy link
Author

chuwy commented Jan 25, 2017

One more observation: while I was desperately trying all possible combinations, one of my builds succeeded (note that this is another dummy project with similar name). Only two differences I see are that it has specific gem name as gem option and I published one of previous pre-releases manually via gem push. Though same combination didn't work for me after that.

@sepulworld
Copy link
Contributor

I appear to be having a similar problem: https://travis-ci.org/sepulworld/deadman-check/jobs/213292029

@BanzaiMan
Copy link
Contributor

@chuwy Do you have a build that fails to deploy to rubygems.org with the gem option set in .travis.yml?

@chuwy
Copy link
Author

chuwy commented Mar 25, 2017

Hi @BanzaiMan, yes I think this build was with gem option. If I remember right (which is unlikely) at this point there was no "iglaoo-test" gem on RubyGems.org.

@BanzaiMan
Copy link
Contributor

Thanks for the pointer.

The error is coming from here: https://github.com/rubygems/gems/blob/v1.0.0/lib/gems/client.rb#L27

The response from rubygems.org API was not valid JSON; instead, it was This rubygem could not be found., which is what you get when you query the API about nonexistent gems:

$ curl https://rubygems.org/api/v1/gems/eyeiqueryzdhfdawe.json
This rubygem could not be found.

Once you have the gem registered, it should go fine. https://travis-ci.org/chuwy/iglaoo-test/builds/195116001#L288

I'm closing this.

@emilienh
Copy link

I am having the same issue even though my gem is registered and this same Travis deploy workflow was working before. Any ideas what could be wrong?

travis.yml:

language: ruby
cache: bundler
rvm:
- 2.1.9
- 2.2.6
- 2.3.3
before_install:
- gem install bundler
deploy:
  provider: rubygems
  api_key:
    secure: [...]
  gemspec: smartling.gemspec
  on:
    tags: true
    rvm: 2.1.9

Logs:

$ rvm use 2.1.9 --install --binary --fuzzy
ruby-2.1.9 is not installed - installing.
Searching for binary rubies, this might take some time.
Found remote file https://s3.amazonaws.com/travis-rubies/binaries/ubuntu/12.04/x86_64/ruby-2.1.9.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.1.9 - #configure
ruby-2.1.9 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.3M  100 21.3M    0     0  9150k      0  0:00:02  0:00:02 --:--:-- 9266k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.9 - #validate archive
ruby-2.1.9 - #extract
ruby-2.1.9 - #validate binary
ruby-2.1.9 - #setup
ruby-2.1.9 - #gemset created /home/travis/.rvm/gems/ruby-2.1.9@global
ruby-2.1.9 - #importing gemset /home/travis/.rvm/gemsets/global.gems................................................
ruby-2.1.9 - #generating global wrappers........
ruby-2.1.9 - #uninstalling gem rubygems-bundler-1.4.4.
ruby-2.1.9 - #gemset created /home/travis/.rvm/gems/ruby-2.1.9
ruby-2.1.9 - #importing gemset /home/travis/.rvm/gemsets/default.gems....................
ruby-2.1.9 - #generating default wrappers........
Using /home/travis/.rvm/gems/ruby-2.1.9
$ export BUNDLE_GEMFILE=$PWD/Gemfile
cache.1
Setting up build cache
$ export CASHER_DIR=$HOME/.casher
0.15s$ Installing caching utilities
0.00s
1.00sattempting to download cache archive
fetching v2.0.3/cache-linux-precise-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855--rvm-2.1.9--gemfile-Gemfile.tgz
found cache
cache.bundler
0.01s
2.64sadding /home/travis/build/Smartling/api-sdk-ruby/vendor/bundle to cache
creating directory /home/travis/build/Smartling/api-sdk-ruby/vendor/bundle
$ ruby --version
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]
$ rvm --version
rvm 1.26.10 (1.26.10) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ bundle --version
Bundler version 1.14.6
$ gem --version
2.4.8
before_install
0.60s$ gem install bundler
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
1 gem installed
install.bundler
2.26s$ bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.0.0
Using unf_ext 0.0.7.4
Using mime-types-data 3.2016.0521
Using multi_json 1.12.1
Using oj 3.0.9
Using power_assert 1.0.2
Using bundler 1.14.6
Using unf 0.1.4
Using mime-types 3.1
Using netrc 0.11.0
Using test-unit 3.2.3
Using domain_name 0.5.20170404
Using http-cookie 1.0.3
Using rest-client 2.0.2
Using smartling 2.0.3 from source at `.`
Bundle complete! 3 Gemfile dependencies, 15 gems now installed.
Bundled gems are installed into ./vendor/bundle.
1.48s$ bundle exec rake
Loaded suite tests/uri_test
Started
....
Finished in 0.003129961 seconds.
--------------------------------------------------------------------------------
4 tests, 17 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
--------------------------------------------------------------------------------
1277.97 tests/s, 5431.38 assertions/s
Loaded suite tests/api_test
Started
..
Finished in 0.003840105 seconds.
--------------------------------------------------------------------------------
3 tests, 13 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
--------------------------------------------------------------------------------
781.23 tests/s, 3385.32 assertions/s
The command "bundle exec rake" exited with 0.
cache.2
store build cache
$ bundle clean
0.00s
0.56snothing changed, not updating cache
dpl.0
Fetching: dpl-1.8.32.gem (100%)
Successfully installed dpl-1.8.32
1 gem installed
dpl.1
Installing deploy dependencies
Fetching: gems-1.0.0.gem (100%)
Successfully installed gems-1.0.0
1 gem installed
dpl.2
Preparing deploy
No stash found.
/home/travis/.rvm/rubies/ruby-2.2.6/lib/ruby/2.2.0/json/common.rb:155:in `parse': 776: unexpected token at 'This rubygem could not be found.' (JSON::ParserError)
	from /home/travis/.rvm/rubies/ruby-2.2.6/lib/ruby/2.2.0/json/common.rb:155:in `parse'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/gems-1.0.0/lib/gems/client.rb:27:in `info'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/gems-1.0.0/lib/gems.rb:17:in `method_missing'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/lib/dpl/provider/rubygems.rb:27:in `check_app'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/lib/dpl/provider.rb:135:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/lib/dpl/provider.rb:133:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.2.6/gems/dpl-1.8.32/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.2.6/bin/dpl:22:in `load'
	from /home/travis/.rvm/gems/ruby-2.2.6/bin/dpl:22:in `<main>'
failed to deploy

@sepulworld
Copy link
Contributor

sepulworld commented May 19, 2017 via email

@emilienh
Copy link

It does not match the repo name, but the gem name is specified in the gemspec.

@emilienh
Copy link

I just tried with the gem name in .travis.yml and I'm still getting the same error.

@BanzaiMan
Copy link
Contributor

@emilienh Do you have a build log URL that shows the problem you are describing?

@emilienh
Copy link

@BanzaiMan
Copy link
Contributor

@sepulworld
Copy link
Contributor

Please try moving the gem name under the 'deploy:' hash in .travis.yml

Like: https://github.com/sepulworld/deadman-check/blob/master/.travis.yml#L12

@emilienh
Copy link

That did it, thanks a lot!

@sepulworld
Copy link
Contributor

I submitted a PR to add one additional log line that I believe would help prevent confusion when a build fails with this error. #633

alext added a commit to alphagov/paas-github_merge_sign that referenced this issue Jun 30, 2017
Due to an issue[1] with Travis' gem publishing, it's been necessary to
manually publish the initial version of this gem. This is a test to
ensure that Travis can now properly publish. Once this is confirmed,
we'll release a non-prerelease version following the process in the
README.

[1]travis-ci/dpl#574
@zliang-min
Copy link

I think this issue should not have been closed without being fixed or updating the documentation about it. It's weird that to ask people to upload their new gem manually before to use travis' deploy rubygems function. It's so confusing.

@BanzaiMan
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants