Skip to content

Commit

Permalink
Fix GitHub API URI
Browse files Browse the repository at this point in the history
The previous API URI no longer works for public GitHub.
For GitHub Enterprise, the suffix '/api/v3' is still used.
  • Loading branch information
Olav Philipp Henschel committed Oct 18, 2017
1 parent e5d4484 commit 996ffab
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<endpoints>
<org.jenkinsci.plugins.github__branch__source.Endpoint>
<name>github_domain</name>
<apiUri>https://{{github_domain}}/api/v3</apiUri>
<apiUri>{{github_api_uri}}</apiUri>
</org.jenkinsci.plugins.github__branch__source.Endpoint>
</endpoints>
</org.jenkinsci.plugins.github__branch__source.GitHubConfiguration>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
<description>GitHub domain.</description>
<defaultValue>{{github_domain}}</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>GITHUB_API_URI</name>
<description>GitHub API URI.</description>
<defaultValue>{{github_api_uri}}</defaultValue>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>GITHUB_ORGANIZATION_NAME</name>
<description>GitHub organization from where the Host OS repositories will be checked out.</description>
Expand Down
6 changes: 6 additions & 0 deletions ansible/vars-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ jenkins_port: 8080
jenkins_local_url: "http://127.0.0.1:{{jenkins_port}}"

configure_ldap: no

# Public and Enterprise GitHub API URIs are different
public_github_api_uri: "https://api.{{github_domain}}"
enterprise_github_api_uri: "https://{{github_domain}}/api/v3"
using_public_github_domain: "{{github_domain == 'github.com'}}"
github_api_uri: "{{public_github_api_uri if using_public_github_domain else enterprise_github_api_uri}}"
2 changes: 1 addition & 1 deletion jenkins_jobs/build_pipelines.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def createPipeline(String repositoryName) {
multibranchPipelineJob(repositoryName) {
branchSources {
github {
apiUri("https://$GITHUB_DOMAIN/api/v3")
apiUri(GITHUB_API_URI)
scanCredentialsId('github-user-pass-credentials')
repoOwner(GITHUB_ORGANIZATION_NAME)
repository(repositoryName)
Expand Down

0 comments on commit 996ffab

Please sign in to comment.