Introduction to Jenkins

by May 1, 2020IoT Programming

In this tutorial, we are going to learn the basics of Jenkins. It is the most popular, open source Continuous Integration / Continuous Delivery (CI/CD) tool written in Java with built in plugins for almost any combination of languages and source code repositories using pipelines. It builds and tests our software projects that make it easier for developers to incorporate improvements to the project and make it easier for users to get fresh construction.

What is Continuous Integration and Continuous delivery?

Continuous Integration (CI): Continuous Integration (CI) is a practice of software development, where developers often integrate their work with the Integration branch of the project and create a build.

Continuous integration is a major step in the DevOps lifecycle, it makes the development testing and deployment of applications easier and faster. There are a number of continuous integration tools like below

  • Bamboo
  • Apache
  • Travis CI
  • Jenkins
  • Buddy
  • TeamCity

Among them Jenkins is the most popular CI tool.

Continuous Delivery (CD): Continuous Delivery (CD) is an extension of continuous integration to ensure you can easily and sustainably bring new updates to your customers or software.

CONTENTS:        

  1. Installing Jenkins
  2. Creating a New Job
  3. Configuring the New Job
  4. Checking the Builds
  5. Adding plugins

1. Installing Jenkins:

Firstly before installing Jenkins we need to download Java, as it is a Java based program. If you have already JAVA make sure by typing “JAVA” in command prompt and skip here.

To install Java click here


Official Website of Java Download

Click “Java Download”

Click “Agree and Start Free Download”. After downloading, install the Java software.

Downloading Jenkins:

Here is the official website of Jenkins Download

Click the “Generic Java package(.war)“, this is best to install on any operating system

Once you downloaded the file, go to the folder where you downloaded the file and “Hold Shift + Right Click on Mouse

In this, click the option “Open PowerShell window here”.

Once you clicked it, it will display the Windows PowerShell window. Now copy the code Java –jar Jenkins.war to the Power Shell

Now it will ask access for the software, click Allow access and give access.

After clicking allow access, the powershell will install Jenkins to your system

Once installed, copy the generated password from powershell like the above.

Now, Browse here

Unlock Jenkins using the password copied from PowerShell and click “Continue”

Here select the “Install suggested plugins”, It will automatically install most popular and most used plugins and wait till the installation is finished.

After installation, enter the details asked and click “Save&Continue”. Make sure to remember username and password

Click “Start using Jenkins“. Now installation has been successfully completed


2. Creating a New Job

Click New Items in the menu to create a new job,

In here type the name of the project and select the type of project. It supports six types of projects.

Freestyle project

Freestyle means unregulated or improvised. A Jenkins freestyle project is a project covering several operations. It can be a build, a running script or even a pipeline.

Pipeline project

The pipeline project is a plugin suite that supports the implementation and integration of continuous delivery pipelines into Jenkins.

Multi Configuration project

The multi Configuration project just like a working template, it begins multiple sub jobs depending on the configuration, aggregates all the test results and shows them in the status page

Folder

A folder project allows users with configuration permission to define properties for a folder that can then be used by any jobs it contains or by any of its subfolders

GitHub Organization

To take the project from the GitHub organisation

Multi branch Pipeline

Multi branch pipeline helps you to apply numerous Jenkins files to different divisions of the same project. Jenkins automatically identifies, manages, and executes Pipelines for branches containing a Jenkins file in source control in a Multi branch Pipeline Plan.


3. Configuring New Jobs

1. General:

  • Description: Description of the Project
  • Discard old builds: This dictates when, if ever, the record builds should be discarded for this project.
  • Github Project: To choose the project if it’s from Github
  • This project is parameterized: Parameters allow you to prompt users for one or more inputs going into a project. You may have a project, for example, that runs tests on demand by allowing users to upload a binary zip file to be tested.
  • Execute concurrent builds if necessary: When this option is checked, multiple builds of this project may be executed in parallel.

2. Source Code Management:

  • None: No source code management
  • Git: Repositories management like GitHub

3. Build Triggers:

  • Trigger builds remotely (e.g., from scripts): Enable this option if you wish to activate new builds by accessing a certain predefined URL
  • Build after other projects are built: Set up a mechanism so that a new build is planned for this project when any other projects finish building.
  • Build periodically: Provides a time based like feature to periodically execute this project.
MINUTEMinutes within the hour (0–59)
HOURThe hour of the day (0–23)
DOMThe day of the month (1–31)
MONTHThe month (1–12)
DOWThe day of the week (0–7) where 0 and 7 are Sunday.
  • Poll SCM: Configure Jenkins to poll changes in SCM.

4. Build Environment:

  • Delete workspace before build starts: Deletes the workspace from it before the build starts.
  • Use secret text(s) or file(s): Allows you to take credentials of various kinds and use them from measures in shell building.
  • With Ant: Prepares an environment for it to run builds using Apache Ant.
  • Build: To select what type of build.
  • Add post build action: To add an extra feature to the project.       

4. Checking the builds

So, I configured a project to run a command every minute.

In the Build Trigger Configuration, I made it to “Build Periodically” and used “* * * * *” as my period which indicates one minute [Format: MINUTE HOUR DOM MONTH DOW]

In the Build Command, I typed echo “Hello World”, to run the build and command “Hello World” every minute.

After saving it. It will build the job every minute as shown below screenshot

To check the output select any build, (In my case I selected the 3rd build) and click Console Output

As you can see, it is displaying “Hello World” in the console.

You can also configure your project later using Configure in the menu

5. Adding Plugins

In Jenkins, you can add extra plugins from the software online. To add plugins Go to the main menu, click “Manage Jenkins” and select “Manage plugins

Now click the available tab, and search for the plugin you need. I need to install the role based Authorization Strategy plugin I have searched for “role“.

After selecting the plugin, click “Download now and install after restart” which is recommended for plugin installation.

Creating a multiplication Skill in Alexa using python

Written By Monisha Macharla

Hi, I'm Monisha. I am a tech blogger and a hobbyist. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning!

RELATED POSTS

Advanced Generics: Higher-Order Functions

Advanced Generics: Higher-Order Functions

In our journey through TypeScript generics, we've covered the basics, interfaces, and classes. Now, it's time to explore advanced concepts by combining generics with higher-order functions. These functions, which take other functions as arguments or return them,...

Basic Usage of Generics in Typescript

Basic Usage of Generics in Typescript

Keypoints Show how to declare generic functions and classes in TypeScript. Provide examples of generic functions that work with different data types. Demonstrate the use of built-in generics like Array<T> and Promise<T>. Here's the content...

Getting Started with Bash Script : A Simple Guide

Getting Started with Bash Script : A Simple Guide

Introduction In this tutorial, we will be looking into Bash Script - a tool used by developers to increase productivity and manage tasks. A lot of professionals use it for tasks such as system administration, data crunching, web app development, automated backups,...

How to Extract REST API Data using Python

How to Extract REST API Data using Python

Introduction In this tutorial, we will be discussing in detail on how to extract REST API data using Python. It is one of the most popular APIs and is used by a majority of applications. We will be using VS code editor for executing the python code. The extracted API...

Create a Simple ReactJs Application – Part 1

Create a Simple ReactJs Application – Part 1

ReactJs is one of the famous front-end open-source libraries of JavaScript developed by Facebook. It aims to allow developers to quickly create fast user interfaces for websites and applications. In this blog, we will create a simple and basic ReactJs...

Create a Simple ReactJs Application – Part 2

Create a Simple ReactJs Application – Part 2

In the tutorial's last part, we discussed about ReactJs and how to run a simple react app on a web browser. In this part, we will dig more into some interesting stuff, such as creating a home, about us, and contact pages. Click here for the first part - Create a...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....