ghprb-plugin | github pull requests builder plugin for Jenkins | Bot library
kandi X-RAY | ghprb-plugin Summary
kandi X-RAY | ghprb-plugin Summary
github pull requests builder plugin for Jenkins
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Index the event
- Handle the issue comment
- Checks if the signature matches the expected external signature
- Gets the triggers matching the specified signature
- Perform merge
- Returns true if the given PR is the same as the given author
- Deletes a branch
- Resolves the comment file
- Gets the environment variables for a specific build
- Called when the build commit status is completed
- Sets up the status of the job
- Stop the job
- Runs the trigger
- Evaluate the cause
- Returns a list of extensions that match the given types
- Creates a set from a list of strings
- Checks if a specific PR contains a comment with the given expected body
- Creates a web hook
- Trigger a pull request
- Triggers a comment
- Calculate the build URL of the build
- Return the aggregated results of a build
- Appends the comment to the commit log
- Returns the default value of the named method
- Called when a build is triggered
- Starts the trigger
ghprb-plugin Key Features
ghprb-plugin Examples and Code Snippets
Community Discussions
Trending Discussions on ghprb-plugin
QUESTION
I am setting up webhook integration between a private GitHub repository and a Jenkins build. I configure jobs exclusively using Job DSL groovy scripts (I'm open to switching to another programmatic job configuration mechanism, but I will not accept any answer that requires me to configure jobs manually). II would like to set up a commit status context and a set of custom messages based on build status.
The Job DSL API documentation embedded in Jenkins is not helpful, only giving me this signature: githubPullRequest(Closure closure)
, but not telling me how to construct a suitable closure.
Here are the relevant sections of my job DSL:
...ANSWER
Answered 2020-Aug-13 at 20:29Got it figured. There were several issues, but the crux of the problem was authentication: the various plugins and components accept and require different types of credentials. The setup I have working for me now uses a combination of personal access tokens and SSH keypairs to authenticate to GitHub.
Here's how to set up authentication:
- Generate a new public-private keypair. I did this on my local machine, but you can do it anywhere. The private key file's contents will provide access to your GitHub account, so use appropriate caution when you decide where to keep the file, and clean up after yourself accordingly.
- Go to GitHub and log in as the user you want Jenkins to use to authenticate to GitHub.
- Navigate to
Settings -> SSH and GPG keys
. (Note: that's the user's settings, not a repo's settings) - Create a new SSH key. Give it a name (I named mine after the Jenkins instance) and paste in the contents of the public key generated in step 1.
- Navigate to
Settings -> Developer settings -> Personal access tokens
- Generate a new token. Grant it access to "repo". Make sure you capture the token value somewhere safe -- I saved mine in my password manager. If you lose it, you'll have to go through all of these steps again to make a new one and configure Jenkins to use it.
- My company uses a private GitHub org with SAML-based auth and SSO. If this is true for you as well, make sure you enable SSO on the token for the appropriate org(s).
- In Jenkins, go to
Manage Jenkins -> Manage Credentials
. - Create a new "SSH Username with private key" credential in the System / Global domain. In the "Username" field, enter the GitHub username. For the private key, choose "Enter directly", choose "Add", and paste in the text contents of the private key file generated in step 1.
- You'll give the credential an ID and a description as part of creating it. The ID is used in XML config files, and the description is used in the Jenkins configuration UI. I like to use the same value for both so that the value stored in the XML config files is the same as the value I see in the user interface. IDs can be uppercase and lowercase letters plus separator characters. For best readability, i-like-to-use-kebab-case.
- Create a new "Secret Text" credential in the System / Global domain. In the "Secret" field, enter the token value GitHub generated in step 6. Again, give it a description and an ID.
- In
Manage Jenkins -> Configure System -> GitHub Pull Request Builder -> Credentials
, choose the token-based credential you created in step 9.
Here's the Job DSL that worked for PRs, using the jenkins-ghprb
plugin:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ghprb-plugin
You can use ghprb-plugin like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the ghprb-plugin component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page