mattbrictson / chandler

[unmaintained] chandler syncs your CHANGELOG entries to GitHub's release notes
MIT License
152 stars 15 forks source link

GitHub Enterprise support #19

Closed mattbrictson closed 8 years ago

mattbrictson commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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

SimenB commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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

SimenB commented 8 years ago

It works!

image

mattbrictson commented 8 years ago

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

SimenB commented 8 years ago

@mattbrictson Could you do a release of this? 😄

mattbrictson commented 8 years ago

✅ Chandler 0.6.0 released