Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

GitHub Enterprise support #19

Merged
merged 4 commits into from
Nov 2, 2016
Merged

GitHub Enterprise support #19

merged 4 commits into from
Nov 2, 2016

Conversation

mattbrictson
Copy link
Owner

This PR adds GitHub Enterprise support, in a way that should just work provided your .netrc is set up correctly. You can now also explicitly specify your GitHub Enterprise endpoint using the --github option, like this:

--github=https://github.mycompany.com/organization/project

@SimenB Can you test this using your GH Enterprise setup?

@SimenB
Copy link
Contributor

SimenB commented Oct 31, 2016

Awesome! Sure I can test, but how do I install from GH? 😆

gem install mattbrictson/chandler#github-enterprise doesn't work (that's how an npm install would be)

@mattbrictson
Copy link
Owner Author

One way is to clone the project, switch to the branch and run rake install. If that doesn't work I can publish an alpha version to Rubygems.

@SimenB
Copy link
Contributor

SimenB commented Oct 31, 2016

Aight, got it running!

Doesn't seem to work though 😢

$ chandler push
Push v1.0.0-alpha.1…  ✘
/Users/simen/.rvm/gems/ruby-2.3.0/gems/octokit-4.3.0/lib/octokit/response/raise_error.rb:16:in `on_complete': GET https://github.schibsted.io/api/v3/repos/finn/express-base/releases/tags/v1.0.0-alpha.1: 401 - Bad credentials // See: https://developer.github.com/enterprise/2.7/v3 (Octokit::Unauthorized)
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/faraday-0.9.2/lib/faraday/response.rb:9:in `block in call'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/faraday-0.9.2/lib/faraday/response.rb:57:in `on_complete'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/faraday-0.9.2/lib/faraday/response.rb:8:in `call'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/octokit-4.3.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/octokit-4.3.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/sawyer-0.7.0/lib/sawyer/agent.rb:94:in `call'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/octokit-4.3.0/lib/octokit/connection.rb:154:in `request'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/octokit-4.3.0/lib/octokit/connection.rb:19:in `get'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/octokit-4.3.0/lib/octokit/client/releases.rb:137:in `release_for_tag'
        from /Users/simen/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/delegate.rb:83:in `method_missing'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/github.rb:36:in `existing_release'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/github.rb:23:in `create_or_update_release'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/commands/push.rb:30:in `block in call'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/commands/push.rb:48:in `block (2 levels) in each_tag_with_version_and_notes'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/logger.rb:46:in `benchmark'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/commands/push.rb:47:in `block in each_tag_with_version_and_notes'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/commands/push.rb:42:in `each'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/commands/push.rb:42:in `each_tag_with_version_and_notes'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/commands/push.rb:29:in `call'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/lib/chandler/cli.rb:22:in `run'
        from /Users/simen/.rvm/gems/ruby-2.3.0/gems/chandler-0.5.0/exe/chandler:4:in `<top (required)>'
        from /Users/simen/.rvm/gems/ruby-2.3.0/bin/chandler:23:in `load'
        from /Users/simen/.rvm/gems/ruby-2.3.0/bin/chandler:23:in `<main>'
        from /Users/simen/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
        from /Users/simen/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

But doing curl -n https://github.schibsted.io/api/v3/repos/finn/express-base/tags works, so auth is correct. Is the URL you build up correct?

If I curl it, I don't get 401

$ curl -n https://github.schibsted.io/api/v3/repos/finn/express-base/releases/tags/v1.0.0-alpha.1
{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/enterprise/2.7/v3"
}

@mattbrictson
Copy link
Owner Author

@SimenB Do you have github.schibsted.io in your ~/.netrc?

@SimenB
Copy link
Contributor

SimenB commented Oct 31, 2016

Yup, if I change something with the entry curl -n gives med 401 instead of 404. I don't know why chandler get's 401...

curl -n https://github.schibsted.io/api/v3/repos/finn/express-base/tags gives an array of all tags, so I don't think auth is the problem.

Is there som debug logging I could activate?

@mattbrictson
Copy link
Owner Author

Hmm. It seems like authentication must be working if the code has gotten that far. Unfortunately I'm not sure there is a debug log that will help. Maybe you could check the Octokit documentation and issues to see if there any known problems with obtaining releases with the GitHub Enterprise API?

@SimenB
Copy link
Contributor

SimenB commented Nov 1, 2016

I don't think auth is correct inside chandler. If I mess up the pw in netrc, I get 401 with curl as well, and chandler fails at the exact same spot

@SimenB
Copy link
Contributor

SimenB commented Nov 1, 2016

Do you have a minimal repro that just tries to fetch releases (using the url above) i could run? If that doesn't work, i can open an issue with octokit

@mattbrictson
Copy link
Owner Author

@SimenB I've pushed a new commit to this branch that may solve the netrc auth problem. Can you redo rake install using the latest code and see if that works?

@SimenB
Copy link
Contributor

SimenB commented Nov 1, 2016

Will try it out when I get home! A couple of hours 😄

@SimenB
Copy link
Contributor

SimenB commented Nov 1, 2016

It works!

image

@mattbrictson
Copy link
Owner Author

Great! I will tidy up the test coverage and publish a release in the next week or so.

@mattbrictson mattbrictson changed the title WIP: GitHub Enterprise support GitHub Enterprise support Nov 2, 2016
@mattbrictson mattbrictson merged commit 28a76ab into master Nov 2, 2016
@mattbrictson mattbrictson mentioned this pull request Nov 3, 2016
@SimenB
Copy link
Contributor

SimenB commented Nov 8, 2016

@mattbrictson Could you do a release of this? 😄

@mattbrictson
Copy link
Owner Author

✅ Chandler 0.6.0 released

@mattbrictson mattbrictson deleted the github-enterprise branch April 10, 2017 00:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants