Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33318

GitHub Enterprise Server validation does not work when private mode is enabled

      The method checkApiUrlValidity() does not work fine when a GitHub Enterprise instance is configured in private mode.

      When I've added this method in GitHub API forget to check with this configuration:

      public void checkApiUrlValidity() throws IOException {
          retrieve().to("/", GHApiInfo.class).check(apiUrl);
      }
      

      Probably, we need to do changes in this plugin (to handle the error) and in GitHub API.

          [JENKINS-33318] GitHub Enterprise Server validation does not work when private mode is enabled

          This seems to be what I'm talking about here and here.

          For info, from my GitHub Enterprise instance:

          Mar 05, 2016 12:37:50 AM org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri
          WARNING: Server returned HTTP response code: 401 for URL: https://github.example.com/api/v3/
          
          $ curl -i https://github.example.com/api/v3/                                                     
          HTTP/1.1 401 Unauthorized
          Server: GitHub.com
          Date: Fri, 04 Mar 2016 23:56:42 GMT
          Content-Type: application/json; charset=utf-8
          Content-Length: 130
          Status: 401 Unauthorized
          X-GitHub-Media-Type: github.v3
          X-XSS-Protection: 1; mode=block
          X-Frame-Options: deny
          Content-Security-Policy: default-src 'none'
          Access-Control-Allow-Credentials: true
          Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
          Access-Control-Allow-Origin: *
          X-GitHub-Request-Id: 3f457a05-16e9-490f-b28e-175cdffa45b8
          Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
          X-Content-Type-Options: nosniff
          
          {
            "message": "Must authenticate to access this API.",
            "documentation_url": "https://developer.github.com/enterprise/2.5/v3"
          }
          

          The 401 response throws an IOException, which the plugin turns into a generic error message.

          This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly

          Christopher Orr added a comment - This seems to be what I'm talking about here and here . For info, from my GitHub Enterprise instance: Mar 05, 2016 12:37:50 AM org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri WARNING: Server returned HTTP response code: 401 for URL: https: //github.example.com/api/v3/ $ curl -i https: //github.example.com/api/v3/ HTTP/1.1 401 Unauthorized Server: GitHub.com Date: Fri, 04 Mar 2016 23:56:42 GMT Content-Type: application/json; charset=utf-8 Content-Length: 130 Status: 401 Unauthorized X-GitHub-Media-Type: github.v3 X-XSS-Protection: 1; mode=block X-Frame-Options: deny Content-Security-Policy: default -src 'none' Access-Control-Allow-Credentials: true Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval Access-Control-Allow-Origin: * X-GitHub-Request-Id: 3f457a05-16e9-490f-b28e-175cdffa45b8 Strict-Transport-Security: max-age=31536000; includeSubdomains; preload X-Content-Type-Options: nosniff { "message" : "Must authenticate to access this API." , "documentation_url" : "https: //developer.github.com/enterprise/2.5/v3" } The 401 response throws an IOException , which the plugin turns into a generic error message . This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly

          orrc I did not have time to solve this bug but I'll work on it this weekend. Thanks for you feedback.

          Manuel Recena Soto added a comment - orrc I did not have time to solve this bug but I'll work on it this weekend. Thanks for you feedback.

          This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly

          In this form we don't need a credentials to validate if the URL is or not a valid Endpoint URL. Where you defines the GitHub source or GitHub Organization can be useful. I'll file an Jira issue for that.

          Manuel Recena Soto added a comment - This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly In this form we don't need a credentials to validate if the URL is or not a valid Endpoint URL. Where you defines the GitHub source or GitHub Organization can be useful. I'll file an Jira issue for that.

          Code changed in jenkins
          User: Manuel Recena
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/fad71a54a45c28b8daacc3e336ff5eaa6a8a6a5b
          Log:
          JENKINS-33318 GHE server validation with private mode enabled

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Manuel Recena Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html http://jenkins-ci.org/commit/github-branch-source-plugin/fad71a54a45c28b8daacc3e336ff5eaa6a8a6a5b Log: JENKINS-33318 GHE server validation with private mode enabled

          Code changed in jenkins
          User: recena
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/074859900436a9b1b2d425737f164f9053e91087
          Log:
          JENKINS-33318 Reviewed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java http://jenkins-ci.org/commit/github-branch-source-plugin/074859900436a9b1b2d425737f164f9053e91087 Log: JENKINS-33318 Reviewed

          Code changed in jenkins
          User: recena
          Path:
          .gitignore
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Connector.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubBuildStatusNotification.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestAction.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMHead.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/UntrustedPullRequestSCMRevision.java
          src/main/resources/index.jelly
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/config.jelly
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/help-excludes.html
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/help-includes.html
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/newInstanceDetail.jelly
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/newInstanceDetail.properties
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource/help-excludes.html
          src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource/help-includes.html
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Messages.properties
          src/main/webapp/images/48x48/github-scmnavigator.png
          http://jenkins-ci.org/commit/github-branch-source-plugin/819673c6343d29622dd7de8066154ee2ffddabc4
          Log:
          JENKINS-33318 Conflicts with upstream/master

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: .gitignore pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Connector.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubBuildStatusNotification.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestAction.java src/main/java/org/jenkinsci/plugins/github_branch_source/PullRequestSCMHead.java src/main/java/org/jenkinsci/plugins/github_branch_source/UntrustedPullRequestSCMRevision.java src/main/resources/index.jelly src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/config.jelly src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/help-excludes.html src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/help-includes.html src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/newInstanceDetail.jelly src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator/newInstanceDetail.properties src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource/help-excludes.html src/main/resources/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource/help-includes.html src/main/resources/org/jenkinsci/plugins/github_branch_source/Messages.properties src/main/webapp/images/48x48/github-scmnavigator.png http://jenkins-ci.org/commit/github-branch-source-plugin/819673c6343d29622dd7de8066154ee2ffddabc4 Log: JENKINS-33318 Conflicts with upstream/master

          Code changed in jenkins
          User: recena
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/643c7cd60ae48c4781ebaf17b5ad7bcafe1c06f8
          Log:
          JENKINS-33318 Added a comment

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java http://jenkins-ci.org/commit/github-branch-source-plugin/643c7cd60ae48c4781ebaf17b5ad7bcafe1c06f8 Log: JENKINS-33318 Added a comment

          Code changed in jenkins
          User: recena
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/e32e6946dde44fe66f6b14fc54e764c88ddb3489
          Log:
          JENKINS-33318 @svanoort's comment was addressed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java http://jenkins-ci.org/commit/github-branch-source-plugin/e32e6946dde44fe66f6b14fc54e764c88ddb3489 Log: JENKINS-33318 @svanoort's comment was addressed

          Code changed in jenkins
          User: recena
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/6f511f42b44a8b6da99c5e17b32fea2662990424
          Log:
          JENKINS-33318 @svanoort's comment was addressed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java http://jenkins-ci.org/commit/github-branch-source-plugin/6f511f42b44a8b6da99c5e17b32fea2662990424 Log: JENKINS-33318 @svanoort's comment was addressed

          Code changed in jenkins
          User: recena
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/c990cdf59531616b7dd343b02eb6aa9338cc44ee
          Log:
          JENKINS-33318 Reverted a modified line

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java http://jenkins-ci.org/commit/github-branch-source-plugin/c990cdf59531616b7dd343b02eb6aa9338cc44ee Log: JENKINS-33318 Reverted a modified line

          Code changed in jenkins
          User: recena
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/2fab60db66f3d6335825172803e5d4dbd76c6542
          Log:
          JENKINS-33318 @svanoort's comment was addressed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java http://jenkins-ci.org/commit/github-branch-source-plugin/2fab60db66f3d6335825172803e5d4dbd76c6542 Log: JENKINS-33318 @svanoort's comment was addressed

          Code changed in jenkins
          User: Manuel Recena
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/af04b025e3fd18d4f152109f0d64cf30a781328d
          Log:
          Merge pull request #27 from recena/JENKINS-33318

          JENKINS-33318 GHE server validation with private mode enabled

          Compare: https://github.com/jenkinsci/github-branch-source-plugin/compare/844f9c0d3dfc...af04b025e3fd

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Manuel Recena Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html http://jenkins-ci.org/commit/github-branch-source-plugin/af04b025e3fd18d4f152109f0d64cf30a781328d Log: Merge pull request #27 from recena/ JENKINS-33318 JENKINS-33318 GHE server validation with private mode enabled Compare: https://github.com/jenkinsci/github-branch-source-plugin/compare/844f9c0d3dfc...af04b025e3fd

          Code changed in jenkins
          User: Manuel Recena
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/58db4cc1545ad5cf4e968f3513d218b5ce22e0f4
          Log:
          Revert "JENKINS-33318 GHE server validation with private mode enabled"

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Manuel Recena Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html http://jenkins-ci.org/commit/github-branch-source-plugin/58db4cc1545ad5cf4e968f3513d218b5ce22e0f4 Log: Revert " JENKINS-33318 GHE server validation with private mode enabled"

          Code changed in jenkins
          User: Manuel Recena
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/8a607fb0e7c8e374e567d177ed84e2b432c49679
          Log:
          Merge pull request #45 from jenkinsci/revert-27-JENKINS-33318

          Revert "JENKINS-33318 GHE server validation with private mode enabled"

          Compare: https://github.com/jenkinsci/github-branch-source-plugin/compare/af04b025e3fd...8a607fb0e7c8

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Manuel Recena Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html http://jenkins-ci.org/commit/github-branch-source-plugin/8a607fb0e7c8e374e567d177ed84e2b432c49679 Log: Merge pull request #45 from jenkinsci/revert-27- JENKINS-33318 Revert " JENKINS-33318 GHE server validation with private mode enabled" Compare: https://github.com/jenkinsci/github-branch-source-plugin/compare/af04b025e3fd...8a607fb0e7c8

          Code changed in jenkins
          User: recena
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/42655c54e7eee809208b0845404d7b3fb3157a16
          Log:
          JENKINS-33318 GHE server validation with private mode enabled

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html http://jenkins-ci.org/commit/github-branch-source-plugin/42655c54e7eee809208b0845404d7b3fb3157a16 Log: JENKINS-33318 GHE server validation with private mode enabled

          Code changed in jenkins
          User: recena
          Path:
          pom.xml
          http://jenkins-ci.org/commit/github-branch-source-plugin/2a812c2eea6e4d989c116180bb15cc1bbc8c72d7
          Log:
          JENKINS-33318 Upgraded github-api dependency

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: recena Path: pom.xml http://jenkins-ci.org/commit/github-branch-source-plugin/2a812c2eea6e4d989c116180bb15cc1bbc8c72d7 Log: JENKINS-33318 Upgraded github-api dependency

          Code changed in jenkins
          User: Manuel Recena
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java
          src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/80a151959a75a0bd7665d39f9c0696ef6a1c988c
          Log:
          Merge pull request #46 from recena/JENKINS-33318

          JENKINS-33318 GHE server validation with private mode enabled

          Compare: https://github.com/jenkinsci/github-branch-source-plugin/compare/8a607fb0e7c8...80a151959a75

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Manuel Recena Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/Endpoint.java src/main/resources/org/jenkinsci/plugins/github_branch_source/Endpoint/help-apiUri.html http://jenkins-ci.org/commit/github-branch-source-plugin/80a151959a75a0bd7665d39f9c0696ef6a1c988c Log: Merge pull request #46 from recena/ JENKINS-33318 JENKINS-33318 GHE server validation with private mode enabled Compare: https://github.com/jenkinsci/github-branch-source-plugin/compare/8a607fb0e7c8...80a151959a75

            recena Manuel Recena Soto
            recena Manuel Recena Soto
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: