Publish a Plugin in Jenkins Site

January 25, 2017

Being an open source project might think that would be enough with a couple of clicks to upload your plugin to Jenkins but nothing is further from reality.

To publish a plugin in Jenkins site we must go through a series of steps that are not entirely intuitive to people who are not related to development tools like Jira and GitHub.

 

Step 1: Create a GitHub Account (or use an existent account)

1) Go to https://github.com/ and click “Sign Up”

PublishJenkinsPlugin_1.png

2) Fill the form and click “Create Account”

PublishJenkinsPlugin_2.png

 

Step 2: Create a GitHub Repository (must be public) to store your plugin source code

1) Sign In to GitHub and click “New Repository”

PublishJenkinsPlugin_3.png

2) Fill the form and click “Create Repository”

–> The repository must be public

–> You must add a license (almost all plugins uses the MIT License)

–> Initialize the repository with a README is optionally

PublishJenkinsPlugin_4.png

3) Now you can clone your new repository and start to work (or move your plugin source code)

PublishJenkinsPlugin_5.png

 

Step 3: Create an account in the Jenkins Site

1) Go to https://accounts.jenkins.io/ and click in “Create a new account”

PublishJenkinsPlugin_6.png

2) Fill the form and click “Submit”

PublishJenkinsPlugin_7.png

3) Click “Update your profile”

PublishJenkinsPlugin_8.png

4) Then Add your GitHub ID and click “submit”

PublishJenkinsPlugin_9.png

Note: I has problems using user accounts with upper case characters (avoid using them)

 

Step 4: Request Hosting for your Plugin Source Code

1) Connect to Jenkins Jira Portal: https://issues.jenkins-ci.org/secure/Dashboard.jspa and login

PublishJenkinsPlugin_10.png

2) Select your favorite language

PublishJenkinsPlugin_11.png

3) Choose an Avatar and click next

PublishJenkinsPlugin_12.png

4) Follow the “quick tour of Jira” to understand the basics of JIRA by click “Next” after each step

PublishJenkinsPlugin_13.png

5) Click “Create an Issue”

PublishJenkinsPlugin_14.png

6) Select the project “Plugin Hosting Request” and click next

PublishJenkinsPlugin_15.png

7) Fill the Create Issue Form and click Create

–> Component: New Plugin Hosting Request

–> Summary: A short but meaningful description of your plugin

–> Repository URL: The url of your github repository that contains the plugin source code

–> New Repository Name: The name to give to the repository in the jenkinsci organization

–> Plugin Description: Description of your plugin

–> GitHub users to Authorize as Commiters: GitHub user names (including your own)

PublishJenkinsPlugin_16.png

8) After you have created an issue, make sure to respond to request for additional information in a timely manner, otherwise your issue may be resolved as incomplete.

9) After the issue will be completed, your GitHub repository will be forked (cloned) into jenkinsci organization and permissions will be granted to the specified users that you gave.

 

Step 5: Grant Permissions to publish in Jenkins site

1) Access to the following project:

–> https://github.com/jenkins-infra/repository-permissions-updater

PublishJenkinsPlugin_17.png

2) Fork this repository by clicking the button “Fork”

PublishJenkinsPlugin_18.png

3) Clone the repository locally and open the file “Permissions”

PublishJenkinsPlugin_19.png

4) Create (or modify) the permissions file for your plugin

–> The name of the file must met the format: plugin-<pluginName>.yml (lower case)

–> The name parameter is the name of your plugin (this is also the “artifact id” of the maven artifact)

–> The path parameter is a set of paths (usually just one) that correspond to the full maven coordinates (“group id” and “artifact id”) used for the artifact

–> The developer list is the GitHub users that can publish the plugin in the Jenkins site

PublishJenkinsPlugin_20.png

5) Commit the changes in your fork repository

PublishJenkinsPlugin_21.png

6) Go to the forked repository in GitHub and click “pull requests”

PublishJenkinsPlugin_22.png

7) Then click “New Pull Request”

PublishJenkinsPlugin_23.png

8) Click “Create Pull Request”

PublishJenkinsPlugin_24.png

9) After the pull request be accepted, the permissions to publish the plugin in the Jenkins site will be granted to all users inserted in the .yml file

 

Step 6: Publish your plugin in the Jenkins Site

There are several ways to publish the plugin, for example using Maven or Gradle

–> You can find an example using maven in the Jenkins official documentation: https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-Releasingtojenkinsci.org

–> I will use Gradle in this example (actually I created a Jenkins job to perform the publish operation automatically)

1) Modify the file “build.gradle” to specify the publish parameters

PublishJenkinsPlugin_25.png

2) Create a file “.jenkins-ci.org” and paste it in the machine that will perform the publish in the following path C:/users/{user}/.jenkins-ci.org

PublishJenkinsPlugin_26.png

3) Set Gradle to use Java 7

4) Run Gradle (locally or using a Jenkins Job)

 

For More Info:

https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial

https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-Releasingtojenkinsci.org

 

Add comment
facebook linkedin twitter email

Leave a Reply