Last active
June 23, 2019 04:38
-
-
Save kpettijohn/e294c50e29ca4e8a329e to your computer and use it in GitHub Desktop.
Configure GitHub Pull Request Builder Jenkins plugin with Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ghprb 1.29.2 | |
import java.lang.reflect.Field | |
import jenkins.model.* | |
import org.jenkinsci.plugins.ghprb.* | |
def descriptor = Jenkins.instance.getDescriptorByType(org.jenkinsci.plugins.ghprb.GhprbTrigger.DescriptorImpl.class) | |
Field auth = descriptor.class.getDeclaredField("githubAuth") | |
auth.setAccessible(true) | |
githubAuth = new ArrayList<GhprbGitHubAuth>(1) | |
githubAuth.add(new GhprbGitHubAuth("https://api.github.com", "aebe0886-5ead-47cd-9a13-18490b7a2831", "test1", "d1e9f1cb-c1e0-42f6-b3d9-6ccca25729ab", null)) | |
githubAuth.add(new GhprbGitHubAuth("https://api.github.com", "3ebe0886-5ead-47cd-9a13-18490b7a2831", "test2", "31e9f1cb-c1e0-42f6-b3d9-6ccca25729ab", null)) | |
auth.set(descriptor, githubAuth) | |
descriptor.save() | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See api here:
https://github.com/jenkinsci/ghprb-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ghprb/GhprbGitHubAuth.java#L71
Order is:
If
serverAPIUrl
andid
are left empty (""
), they'll default to github api url and a random id respectively.