Written by 09:36 Tools & technologies, Utilities & Extensions

Hosting Plugins in the Jenkins Community Repositories

It is the third of a series of articles devoted to the problem of Jenkins plugin implementation and hosting. If you haven’t got acquainted with the first article yet, please feel free to familiarize yourself with article that uncover the process of implementing a Jenkins plugin from scratch. This article addresses the issue of hosting plugins in the Jenkins community repositories.

To host your plugin on the official Jenkins plugin market, you need to:

1. Perform preparatory steps
2. Publish the source code of your plugin on GitHub
3. Request plugin hosting with the Jenkins project on GitHub
4. Delete the original repository to make sure that the Jenkins repository on GitHub is canonical for your plugin
5. Make a request for upload permissions
6. Release your plugin using the Maven.

Preparatory steps

The preparatory steps to be performed before hosting a plugin with the Jenkins project on GitHub comprise:

• Meeting the conditions for the plugin name and the contents of the pom.xml file according to the Prerequisites section of the Jenkins Hosting Plugins Wiki page.
• Creating an account on jenkins-ci.org, which is a single account for all related Jenkins structures (Wiki, Jira, Confluence).
• Preparing readme.md and license.md files and placing them in the root of your repository.
• Creating a page on the Jenkins Wiki (for more details, see Creating a Wiki page on the Jenkins Wiki) and adding a link to it in pom.xml.
• Adding information about developers to pom.xml (see the Adding Maintainer Information section on the Jenkins Wiki for details).

Have a public repository containing the plugin source code on GitHub

You need to upload your plugin source code to a repository on GitHub.

Make a Plugin Hosting Request to place your plugin source code with the Jenkins project on GitHub

Once the above requirements have been satisfied, log in to JIRA and create a new issue in the HOSTING project. Provide all the information requested there.
After your request has been processed, your plugin repository will be created under https://github.com/jenkinsci
Once you have the Jenkins repository, you can proceed to the next stage of preparations for your first release.

Delete the original repository so that the Jenkins repository on GitHub is canonical for your plugin

This will be a recommendation from the Jenkins organization after completing your Plugin Hosting Request to ensure the Jenkins plugin repository is the only one for the plugin.

Make an upload permission request

To have the possibility to release plugins, you must request the appropriate rights. To do this, pull the https://github.com/jenkins-infra/repository-permissions-updater repository and create a .yml file in the permissions directory using the template: plugin-[artifactId ].yml

File contents:

name: "p4"
github: "jenkinsci/p4-plugin"
paths:
- "org/jenkins-ci/plugins/p4"
developers:
- "p4paul"

where:
• p4 (lines 2 and 5): artifactId
• p4-plugin (line 3): GitHub repository name
• org/jenkins-ci (line 5): groupId (with slashes replacing periods)
• p4paul (line 7): Jenkins community account user name

For more details, see the repository Readme.

Then make a pull request and wait for it to be approved and merged into the master branch.
For these permissions to be really enabled, you MUST log in at least once to your Jenkins account at https://repo.jenkins-ci.org/webapp/#/home.
Any changes to the repository will not be valid until you do that.

Release your plugin using Maven

After completing the above steps, you can proceed to the first release of the plugin. First, you need to add an SSH-key to the Jenkins plugin repository in ~/.m2/settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
  <servers>
    <server>
      <id>maven.jenkins-ci.org</id> <!-- For parent 1.397 or newer; this ID is used for historical reasons and independent of the actual host name -->
      <username>...</username>
      <password>...</password>
    </server>
  </servers>
</settings>

where username and password are from the GitHub account under which the plugin repository was originally located.
Next, in order to initiate the release process, you need to start the Command-line interface from the root directory of the plugin repository and execute the Maven command:

$ mvn release:prepare release:perform

If an error occurs during the release process, you need to roll back the changes using the Maven commands: release:rollback and release:clean, fix the errors (for more details on possible errors and ways to resolve them, see Working around common issues), and start the release again:

$ mvn release:rollback
$ mvn release:clean

You can read more about the release process in the Releasing to jenkins-ci.org section of the Jenkins Wiki.

References:

1. https://wiki.jenkins.io/display/JENKINS/Hosting+Plugins
2. https://wiki.jenkins.io/x/AgAcAQ

Tags: , , , Last modified: October 06, 2022
Close