Jenkins Plugin Development Tour: From Concept to Publication in 2 Days (Part II)
Introduction
In this article, we will delve into the process of developing a Jenkins plugin, from the initial concept to its publication on the Jenkins update center. This journey will cover the essential steps, including creating a wiki page, applying for permission to upload, and performing a continuous integration build.
Ready to Work
Before requesting a plugin hosting, complete the following steps:
- Find similar plugins: Browse the Jenkins plugin list page to confirm whether a similar plugin already exists to address the same issue. This ensures that users can benefit from the existing solution and reduces the likelihood of duplication.
- Naming conventions: Familiarize yourself with the Jenkins plugin naming conventions to ensure compliance. The naming convention for artifact IDs should be in lowercase, separated by a hyphen, and should not include “jenkins” or “plugin” unless the name has a specific meaning.
- Plugin name: Choose a short, descriptive name for your plugin, such as “Subversion.” Ensure that the name is consistent across the Jenkins UI and other places, like the plugin site.
- Group ID: Use a recommended Group ID, such as “io.jenkins.plugins” or “org.jenkins-ci.plugins.” This does not prohibit other organization IDs, but they must not be malicious.
- Java source code: Follow the Oracle Java code statute, but do not enforce it even in the core component. Individual plugins may choose a different style guide.
Daily Development
When developing your plugin, use IDEA and install the “Statute Ali Java plug-in” to ensure code compliance. When submitting news, reference related JIRA issues (if applicable) and provide a brief summary on the first line, followed by more detailed information in subsequent lines.
License
All plugins are required to distribute Jenkins project free and open-source software. This applies to all plugin source code and its dependencies. Ensure that the pom.xml file and repository LICENSE file comply with the protocol. The official recommended license is the MIT license, used in Jenkins core and most plugins and libraries.
Hosted Initiated Request
Before requesting a plugin hosting, log in to JIRA and create a problem in the HOSTING project. Fill out all fields as described, and ensure that you have an account on GitHub and a public repository to store your plugin source code. Once your request is reviewed and approved, your warehouse will be forked to the jenkinsci organization, and you will be invited to join the organization.
Create a Wiki Page
Although not strictly required, creating a wiki page for your plugin is highly recommended. This allows you to store documents and provide more information about your plugin. Refer to the plugin wiki page guide for more information.
CI Build Open
Jenkins performs a continuous integration build for your plugin. The official recommendation is to create a Jenkinsfile in the root directory of your plugin’s GitHub repository. This file sets up the CI build for the jenkinsci GitHub organization.
Apply for Permission to Upload
After forking your repository to the jenkinsci organization, submit a request for permission to upload. This requires creating a YAML file with the necessary permissions and submitting a PR to the jenkins-infra/repository-permissions-updater repository.
Release Plug
Once you have permission to upload, perform a release by running the following command:
mvn release:prepare release:perform
This will automatically push your code to the warehouse and make it available on the Jenkins update center within 8 hours.
For the Plug-Classification
The Jenkins plugin list page allows plugins to be classified. To add a category for your plugin, submit a PR to the jenkins-infra/update-center2 repository.
Two-Day Journey
This article has outlined the process of developing a Jenkins plugin, from concept to publication in 2 days. We have covered the essential steps, including creating a wiki page, applying for permission to upload, and performing a continuous integration build. We hope this article will serve as a helpful guide for Jenkins plugin developers.