travis-ci / travis.rb

Travis CI Client (CLI and Ruby library)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to create ssh key or use existing login session

mpdifran opened this issue · comments

travis version
1.10.0

Here's the steps to reproduce my issue.

I login to travis using the following command. My personal access token has the user:email, read:org, and repo permissions.

travis login --pro --github-token <my-personal-access-token>
// Successfully logged in as Faire-iOS!

I then run this to verify I'm logged in:

travis whoami --pro
// You are Faire-iOS

Then I try to generate an ssh key for one of my repos:

travis sshkey --generate -r Faire/ios-release-tools --pro --debug

I'm prompted to login again, which seems odd. Once I login, I get the following output:

** Loading "/Users/markdifranco/.travis/config.yml"
** GET "repos/Faire/ios-release-tools"
**   took 0.34 seconds
** GET "config"
**   took 0.058 seconds
We need the GitHub login for the account you want to add the key to.
This information will not be sent to Travis CI, only to api.github.com.
The password will not be displayed.

Username: Faire-iOS
Password for Faire-iOS: ****************************************
** GitHub API: GET /user?per_page=100
**   took 0.22 seconds
** GitHub API: GET /user?per_page=100
**   took 0.39 seconds
** GitHub API: GET /repos/Faire/ios-release-tools?per_page=100
**   took 0.29 seconds

Generating RSA key.
Uploading public key to GitHub.
** GitHub API: POST /user/keys
** Storing "/Users/markdifranco/.travis/error.log"
Not Found
for a full error report, run travis report --pro

Output of travis report --pro

System
Ruby:                     Ruby 2.6.3-p62
Operating System:         macOS 11.0.1
RubyGems:                 RubyGems 3.1.4

CLI
Version:                  1.10.0
Plugins:                  none
Auto-Completion:          yes
Last Version Check:       2020-12-04 10:34:34 -0500

Session
API Endpoint:             https://api.travis-ci.com/
Logged In:                as "Faire-iOS"
Verify SSL:               yes
Enterprise:               no

Endpoints
com:                      https://api.travis-ci.com/ (access token, current)

Last Exception
An error occurred running `travis sshkey --pro`:
    RuntimeError: Not Found
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/tools/github.rb:212:in `rescue in basic_auth'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/tools/github.rb:208:in `basic_auth'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/tools/github.rb:42:in `with_basic_auth'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/cli/sshkey.rb:54:in `generate_key'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/cli/sshkey.rb:24:in `run'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/cli/command.rb:200:in `execute'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/lib/travis/cli.rb:64:in `run'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/gems/travis-1.10.0/bin/travis:18:in `<top (required)>'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/bin/travis:23:in `load'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/bin/travis:23:in `<main>'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
        from /Users/markdifranco/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'


For issues with the command line tool, please visit https://github.com/travis-ci/travis.rb/issues.
For Travis CI in general, go to https://github.com/travis-ci/travis-ci/issues or email support@travis-ci.com.

Should I be doing anything differently?

Looks like the same error a #788, so maybe related? I am unable to login to travis via --pro. I can't even get to the token login part.

I can even re-login when asked and got a Requires authentication.

It might of course be related to the deprecation of the OAuth Authorization API from GitHub but it was announced a year ago. I don't understand why Travis doesn't anticipate it.

Which result in a broken feature since November 13.

So basically I can't define a new ssh key and there is no workaround.
Why can't we define a ssh key manually from the Travis website instead?