### Run Local Jenkins Instance Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md Command to start a local Jenkins instance for development purposes using Maven. ```bash mvn hpi:run ``` -------------------------------- ### Build Jenkins Plugin .hpi File with Maven Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md Execute the `hpi:hpi` goal to compile your plugin and package it into a deployable `.hpi` file. This is a common step before installation. ```bash mvn hpi:hpi ``` -------------------------------- ### Run Jenkins with Current Plugin Project using Maven Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md Use the `hpi:run` goal to start a Jenkins instance with your plugin project loaded. This is useful for development and testing. ```bash hpi:run ``` -------------------------------- ### Update GitHub Commit Status with Multiple SCM Sources Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md A more complex example for updating GitHub commit status, suitable for pipelines with multiple SCM sources. It includes workarounds for known issues and handles various build result states. ```groovy def getRepoURL() { sh "git config --get remote.origin.url > .git/remote-url" return readFile(".git/remote-url").trim() } def getCommitSha() { sh "git rev-parse HEAD > .git/current-commit" return readFile(".git/current-commit").trim() } def updateGithubCommitStatus(build) { // workaround https://issues.jenkins-ci.org/browse/JENKINS-38674 repoUrl = getRepoURL() commitSha = getCommitSha() step([ $class: 'GitHubCommitStatusSetter', reposSource: [$class: "ManuallyEnteredRepositorySource", url: repoUrl], commitShaSource: [$class: "ManuallyEnteredShaSource", sha: commitSha], errorHandlers: [[$class: 'ShallowAnyErrorHandler']], statusResultSource: [ $class: 'ConditionalStatusResultSource', results: [ [$class: 'BetterThanOrEqualBuildResult', result: 'SUCCESS', state: 'SUCCESS', message: build.description], [$class: 'BetterThanOrEqualBuildResult', result: 'FAILURE', state: 'FAILURE', message: build.description], [$class: 'AnyBuildResult', state: 'FAILURE', message: 'Loophole'] ] ] ]) } ``` -------------------------------- ### Create Jenkins Plugin Skeleton with Maven Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md Use the `hpi:create` goal to generate a basic structure for a new Jenkins plugin project. ```bash mvn hpi:create ``` -------------------------------- ### Upload Jenkins Plugin to java.net with Maven Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md The `hpi:upload` goal is used during the release process to post the built `.hpi` file to java.net. ```bash hpi:upload ``` -------------------------------- ### Prepare and Perform Plugin Release with Maven Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md Utilize the Maven release plugin to prepare and perform a release of your Jenkins plugin. Ensure you provide valid username and password credentials. ```bash mvn release:prepare release:perform -Dusername=juretta -Dpassword=****** ``` -------------------------------- ### Generate Jenkins Plugin .hpl File with Maven Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md The `hpi:hpl` goal generates a `.hpl` file, which is a descriptor file for the plugin. ```bash hpi:hpl ``` -------------------------------- ### Javadoc for Class Members Source: https://github.com/jenkinsci/github-plugin/blob/master/CONTRIBUTING.md Standard Javadoc format for getters and setters. Ensure all public and protected methods have Javadoc comments. ```java /** * The count of widgets */ private int widgetCount; /** * Returns the count of widgets. * * @return the count of widgets. */ public int getWidgetCount() { return widgetCount; } /** * Sets the count of widgets. * * @param widgetCount the count of widgets. */ public void setWidgetCount(int widgetCount) { this.widgetCount = widgetCount; } ``` -------------------------------- ### Set Commit Status in Jenkins Pipeline Source: https://github.com/jenkinsci/github-plugin/blob/master/README.md Use this function to set the commit status for a custom repository with a configured context and message. Ensure the GitHub plugin is configured correctly. ```groovy void setBuildStatus(String message, String state) { step([ $class: "GitHubCommitStatusSetter", reposSource: [$class: "ManuallyEnteredRepositorySource", url: "https://github.com/my-org/my-repo"], contextSource: [$class: "ManuallyEnteredCommitContextSource", context: "ci/jenkins/build-status"], errorHandlers: [[$class: "ChangingBuildStatusErrorHandler", result: "UNSTABLE"]], statusResultSource: [ $class: "ConditionalStatusResultSource", results: [[$class: "AnyBuildResult", message: message, state: state]] ] ]); } setBuildStatus("Build complete", "SUCCESS"); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.