Jenkins Cheat Sheet PART 2
Jenkins Tips and Tricks
Commands for Start, Stop & Restart Jenkins:
$ sudo service jenkins restart
$ sudo service jenkins stop
$ sudo service jenkins start
Schedule a Build Periodically
Jenkins uses a cron expressions to schedule a job.
Each line consists of 5 fields separated by TAB or whitespace:
Syntax:
(Minute Hour DOM Month DOW) MINUTE:
Minutes in one hour (0- 59)
HOURS: Hours in one day (0–23)
DAYMONTH: Day in a month (1–31)
MONTH: Month in a year (1–12)
DAYWEEK: Day of the week (0–7) where 0 and 7 are Sunday
Example: H/2 * * * * (schedule your build for every 2 minutes)
Snippet Generator
Step 1: Create a pipeline job > configure
Step 2: Select pipeline script from pipeline definition
Step 3: Click on Pipeline syntax > snippet generator
Step 4: Step > select Git > enter repo URL
Step 5: Scroll down > Generate pipeline script
Step 6: Copy the script into your pipeline script UI
Deploy a custom build of a core plugin
Step 1: Stop Jenkins.
Step 2: Copy the custom HPI to $Jenkins_Home/plugins.
Step 3: Delete the previously expanded plugin directory.
Step 4: Make an empty file called .hpi.pinned.
Step 5: Start Jenkins
Most commonly used Jenkins plugins
Jenkins comes with over 2000 plugins and each plugin has a unique functionality. But when it comes to software development most developers use a set of plugins, such as, Maven, Git, Ant, Docker, Amazon EC2, HTML publisher, Copy artefact, etc.
Follow the below step to install the above plugins or any other Jenkins plugin.
Jenkins Dashboard-> Manage Jenkins-> Manage Plugins-> Available In the filter text field enter the name of the plugin you want to install.
These are few of the tricks and tips for using Jenkins and for quick revision.
Hope you liked it!!
Happy Testing!!!