You own Minions
Overview
This article covers the installation and use of Jenkins plugins.
I want you to feel confident that you’ve mastered this skill. That’s why this takes a hands-on approach where you type in commands and we explain the responses and possible troubleshooting. This is a “deep dive” because all details are presented.
Like a good music DJ, I’ve carefully arranged the presentation of concepts into a sequence for easy learning, so you don’t have to spend as much time as me making sense of the flood of material around this subject.
Sentences that begin with PROTIP are a high point of this website to point out wisdom and advice from experience. NOTE point out observations that many miss. Search for them if you only want “TL;DR” (Too Long Didn’t Read) highlights.
Stuck? Contact me and I or one of my friends will help you.
The assumption here is that you have followed Jenkins Setup to install the latest version of Jenkins2, which went Version 2 April 26, 2016 after over 10 years at v1.
Find plugins to install
Here is a generic set of steps to install a plug-in:
-
Click Manage Jenkins on the left menu of the Dashboard screen.
-
Click Manage Plugins to http://…/pluginManager/
- Click Installed tab to view what has been installed already.
- Click Available tab to http://…/pluginManager/available
-
Click Advanced tab and scroll to the bottom to see the Update Site URL for the source of plugins listed:
http://updates.jenkins-ci.org/update-center.json
NOTE: You can upload a plugin file with the file extension .hpi to folder <jenkinsHome>/plugins/
On a Mac, the jenkinshome is ~/.jenkins.
So many plugins
-
View the Wiki on Plugins.
PROTIP: The wide variety of plugins is why Jenkins is popular.
See xxx
-
Click on a category (such as “.NET Development”) to contract or expand items in each category.
PROTIP: There are dozens of categories, so it may be easier to search for plugins by name or from the list of categories online at
https://wiki.jenkins-ci.org/display/JENKINS/PluginsInstall Green Balls icon plugin
-
In the Filter field at the upper right of the screen, type “Green Balls”, which is one of the most popular among DevOps people who can’t stand that the Jenkins default for healthy (successful) is blue, not green. ( due to a historical/cultural artifact).
PROTIP: When a plugin is installed, Jenkins removes that plugin among the “Available” and shows the plugin among the “Installed”.
-
When you click the name of a plug-in you’ll be sent to another website, such as:
https://wiki.jenkins-ci.org/display/JENKINS/Green+Balls -
Return to the previous screen: Hit the browser return key or command + left arrow.
PROTIP: Instead of clicking plugin names, right-click to open link in New Tab on your browser so a tab with the Jenkins icon remains among browser tabs.
-
Return to the root console page (by clicking “Jenkins” at the upper left corner).
-
Click “S” among “S M L” under the icons to show Small icons.
Install SCM plug-in
Jenkins has plugins for many SCM systems: Accurev, Bazaar, BitKeeper, ClearCase, CMVC, Dimensions, Git, CA Harvest, Mercurial, Perforce, PVCS, StarTeam, CM/Synergy, Microsoft Team Foundation Server, and Visual SourceSafe.
-
In Manage Jenkins, Manage Plugins, among Available, in Filter enter enough of “SCM Sync Configuration Plugin” to check it for install. Its URL is
http://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin“This plugin allows you to synchronize your hudson configuration files with an SCM, allowing you to specify a commit message every time a config file is modified.””
NOTE: “Hudson” is still referenced even in Jenkins2. Just ignore it.
Configure repo
-
In Manage Jenkins, Configure System, notice
/var/lib/jenkins
-
In “SCM Sync Configuration”, select Git and type in the Git repo where your Jenkins configuration resides. In our example:
https://github.com/hotwilson/box.git
PROTIP: Jenkins should detect when there is a change to Jenkins configuration and update the repo with a pop-up commit message such as this:
-
Check “Display SCM Sync Status”.
-
Click Save.
Git Plugin
-
[0:42] Install “Git Plugin” https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
to provide Git client functionality on Jenkins servers. -
PROTIP: Restart Jenkins by changing the URL from:
http://.../pluginManager/installed
to
http://.../restart
Click Yes to “Are you sure”.
“Please wait while Jenkins is restarting”.
Freestyle project
-
[1:41] Create a Jenkins Freestyle project, OK.
-
[2:01] The Source Code Management section, select Git.
-
[2:15] Enter your repo, with the .git at the end.
The plugin makes a call such as:
git ls-remote -h https://github.com/hotwilson/box.git HEAD
NOTE: When done on my Mac Terminal, this returns nothing.
If you (like others) get the error message
“Failed to connect to repository : Error performing command:” -
[2:15] If your repo is private, provide your SSH keys.
https://developer.github.com/guides/managing-deploy-keys/
https://docs.docker.com/docker-hub/builds/
Jenkins 2 Pipeline Plugin
Instead of manually clicking through the Jenkins UI, the Pipeline plugin in Jenkins 2 by author Jesse Glick (@tyvole) reads a text-based Jenkinsfile Groovy script code checked into source control.
-
Install the “Pipeline” (in Manage Jenkins, Manage Plugins, Available) at
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+PluginNOTE: This was part of Cloudbees licenced features, but released in open edition.
-
Right-click to open in a new tab the “See Pipeline as Code with Jenkins for more details” “link at
https://jenkins.io/solutions/pipeline -
Return to the root console page (by clicking “Jenkins” at the upper left corner).
-
Click New Item at http://…/view/All/newJob
[TODO: jenkins2 new item menu 20160809 screen.png
-
Enter item name and click “Pipeline”, then OK. (“Orchestrates long-running activities that can span multiple build slaves. Suitable for building pipelines (formerly known as workflows) and/or organizing complex activities that do not easily fit in free-style job type.”).
When to build
-
Among Build Triggers click “Build when a change is pushed to GitHub”.
-
Click “GitHub project”.
-
For Project url: https://github.com/hotwilson/box.git
DEFINITION: The word “slave” has been replaced with the word “agent”.
DEFINITION: A node is a step that schedules a task to run by adding it to the Jenkins build queue and allocating a workspace (file directory) on that node for the duration of the task.
As soon as an executor slot is available on a node (the Jenkins master, or a slave), the task is run on that node.
-
Click “Advanced” and type the Display name, “Box” in our example.
-
Click “Pipeline” tab to bring that section up.
-
Select from the “try sample” pull down “Hello World”.
Notice the Groovy script:
node { stage 'Stage 1' echo 'Hello World 1' stage 'Stage 2' echo 'Hello World 2' }
-
Click Save for the item screen.
-
Double-click on “Build Now” (in rapid succession).
A sample response:
NOTE: Text in headings were specified in state keywords in the Groovy script above.
PROTIP: Only click once on Jenkins links or two executions will result from a double-click.
Run results
-
Cursor over one of the “ms” numbers (for milliseconds or thousands of a second) in the green area and click the Log button that appears.
A pop-up appears with the text specified by the echo command within the Groovy script.
-
Click the “X” at the upper-right of the dialog to dismiss it.
-
To remove the menu on the left, click “Full Stage View”.
PROTIP: The “full stage view” will be needed when there are more stages going across the screen.
Build History
-
To return to the menu with Build History,
click the item/job name in the breadcrumbs or press command+left arrow. -
Click one of the jobs in the Build History section in http://…/job/box/5/
Notice the number in the URL corresponds to the number listed.
PROTIP: The time of the run is the server’s time, not your local time on your laptop.
-
Click “Console Output” for log details created from that run.
NodeJS Plugin
https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin
also installs Grunt http://gruntjs.com/getting-started
Plug-in files
-
Switch to Terminal to open a new command line window and navigate to the hidden Jenkins folder to view files:
cd ~/.jenkins cd plugins ls -al
NOTE: Each plug-in has a .jpi binary file for each folder which contains a META-INF and WEB-INF folder.
-
To provision a Docker box, this Gist script
https://gist.github.com/micw/e80d739c6099078ce0f3does not require Jenkins to be running. It does the following:
- Download one or more plugins to the plugin directory
- Scan all plugins in that directory for missing dependencies to download those dependencies as well
- Loop until no open dependencies are left.
-
To install a Git client in the Console:
curl -XPOST http://localhost:8080/pluginManager/installNecessaryPlugins -d '
'
Rake Environment Variable
- In the Manage Jenkins menu, click Configure System.
- Check Environment variables under the Global properties section.
- Click Add.
- In the name value, type “PATH”.
-
In the value field, type “$PATH /usr/local/bin” for Linux or OSX.
Alternately, on Windows type “???”. TODO:
More plug-ins
Lists of top Jenkins plugins online: more plugins below.
- http://www.praqma.com/stories/top-jenkins-plugins/
- http://zeroturnaround.com/rebellabs/top-10-jenkins-featuresplugins/
- https://uttamkini.com/2012/12/01/jenkins-plugins-that-every-team-must-use/
- http://www.hugeinc.com/ideas/perspective/list-of-useful-jenkins-plugins
- http://devops.com/2015/01/15/15-must-jenkins-plugins-increase-productivity/
- https://wiki.jenkins-ci.org/display/JENKINS/Plugin+Installation+Statistics is broken
Base Plug-ins
- Email Extension Plugin
- Git Plugin
- Graddle Plugin
- SSH Slaves
- Translation Assistance
- Workspace Cleanup Plugin
For Microsoft developers
- MSBuild
- MSTest
- MSTest Runner
- VSTest Runner
Other plugins
Cloubees’ Study Guide PDF lists these plug-ins that all Certified Jenkins Engineers should know:
- Script Security Plugin
- Parameterized Trigger Plugin
- Credentials Plugin
- Amazon EC2 Plugin
- Docker Plugin
- CloudBees Folders Plugin
- Pipeline Plugin (formerly known as Workflow)
- Build Pipeline Plugin
- Delivery Pipeline Plugin
- CloudBees Docker Build and Publish Plugin
- Git Plugin
- Copy Artifact Plugin
- JUnit Plugin
- Matrix Project Plugin
- NodeLabel Parameter Plugin
- Email-ext Plugin
- Jabber Plugin
- Mailer Plugin
- IRC Plugin
- SMS Notification Plugin
- https://wiki.jenkins-ci.org/display/JENKINS/Skype+Plugin”> Skype Plugin</a>
Safe Restart Plugin
Some install the SafeRestart plug-in which adds the Restart Safely option to the Jenkins left menu to avoid needing to be at the server console at all.
Clone Workspace
The Clone Workspace SCM Plugin
https://wiki.jenkins-ci.org/display/JENKINS/Clone+Workspace+SCM+Plugin
clones Jenkins configurations for re-use in other projects.
JMeter plug-in
QUESTION: Are there more plug-ins for JMeter?
JMeter Performance Plug-in for JMeter
WARNING: This is no longer maintained, with a large bug list.
To add the Performance plug-in to display results from JMeter runs:
- Click the Manage Jenkins link.
- Click the Manage Plugins link.
- Select the Available tab.
- In Filter type “Performance”.
- Check to select “Performance plugin”.
- Click “Download now and install after restart”.
- Click to restart server.
If you prefer a manual approach:
- Create a folder to hold the folder created during cloning (such as jmeter or jenkinsci).
-
cd to that folder, then:
git clone https://github.com/jenkinsci/performance-plugin.git performance cd performance
This contains a pom.xml file for Maven to compile the src folder.
-
If you haven’t already:
brew install maven
-
Compile in a command window:
mvn package
This downloads a bunch of files specified as dependencies, ending in this:
[INFO] Total time: 09:20 min [INFO] Finished at: 2016-01-26T08:31:04-08:00 [INFO] Final Memory: 52M/259M
-
Get the address of the Jenkins server. To find (ignoring case)
find . -iname "jenkins.war"
-
Copy to the target server the .hpi file which defines a plug-in:
cp <target>/performance.hpi <path_to_jenkins>/data/plugins
-
To fix this switching report format to xml in jmeter properties file:
jmeter.save.saveservice.output_format=xml
-
Configure the search pattern to select the files to be parsed by the Performance plugin. JMeter generates .jtl files.
-
Configure the error percentage thresholds which would make the project unstable or failed
- When no jobs are running, restart the Jenkins server to reload the plugin.
Read more about plugins
- http://wiki.jenkins-ci.org/display/JENKINS/Checking+out+existing+plugins
- http://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
- http://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins
- https://www.blazemeter.com/blog/continuous-integration-101-how-run-jmeter-jenkins
-
https://www.linkedin.com/pulse/continuous-automated-web-tests-using-jenkins-jmeter-mahanta
-
https://dzone.com/articles/orchestrating-workflows-with-jenkins-and-docker
-
https://github.com/jenk
- http://udaypal.com/jenkins-workflow-getting-started/
More on DevOps
This is one of a series on DevOps:
- DevOps_2.0
- ci-cd (Continuous Integration and Continuous Delivery)
- User Stories for DevOps
- Git and GitHub vs File Archival
- Git Commands and Statuses
- Git Commit, Tag, Push
- Git Utilities
- Data Security GitHub
- GitHub API
- Choices for DevOps Technologies
- Pulumi Infrastructure as Code (IaC)
- Java DevOps Workflow
- AWS DevOps (CodeCommit, CodePipeline, CodeDeploy)
- AWS server deployment options
- Cloud services comparisons (across vendors)
- Cloud regions (across vendors)
- Azure Cloud Onramp (Subscriptions, Portal GUI, CLI)
- Azure Certifications
- Azure Cloud Powershell
- Bash Windows using Microsoft’s WSL (Windows Subsystem for Linux)
- Azure Networking
- Azure Storage
- Azure Compute
- Digital Ocean
- Packer automation to build Vagrant images
- Terraform multi-cloud provisioning automation
-
Hashicorp Vault and Consul to generate and hold secrets
- Powershell Ecosystem
- Powershell on MacOS
- Jenkins Server Setup
- Jenkins Plug-ins
- Jenkins Freestyle jobs
- Docker (Glossary, Ecosystem, Certification)
- Make Makefile for Docker
- Docker Setup and run Bash shell script
- Bash coding
- Docker Setup
- Dockerize apps
- Ansible
- Kubernetes Operators
- Threat Modeling
- API Management Microsoft
- Scenarios for load
- Chaos Engineering