Jenkins on Brainy Pi

by aaditya04gupta in Circuits > Raspberry Pi

264 Views, 1 Favorites, 0 Comments

Jenkins on Brainy Pi

Screenshot 2023-01-21 213643.png
Screenshot 2023-01-17 222921.png

Pulling the entire code for building and testing can consume a lot of time. To save time we can use Jenkins. There are a number of advantages in using Jenkins while developing software. Jenkins is an open-source continuous integration tool that is written in Java. By default, Jenkins will be running on port 8080. It is a master-slave topology that distributes the build and testing efforts over slave servers with the results automatically accumulated on the master.

It is not only a continuous integration server but also has a highly active community that works towards improving codes, writing plugins, participating on mailing lists, writing bug reports, etc. It can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed. Jenkins helps an organization to advance the software development process through automation.

Supplies

Screenshot 2023-01-12 114534.png

Brainy PI

Ethernet cable/wifi

Sd card/ hard drive

Updating Software

It is very important to update the software before installing anything on the system

1. To update the system use the command

sudo apt update 

2. To upgrade the system use the command

sudo apt upgrade 

Intalling Java

We are required to install a java runtime Environment as Jenkins is built on top of the Java language.

1. To install java use the command

sudo apt install openjdk-11-jre

2. To verify that you have successfully installed Java use the command

java --version

If the output is like this

openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Raspbian-1deb10u1)
OpenJDK Server VM (build 11.0.6+10-post-Raspbian-1deb10u1, mixed mode)

then it means java is successfully installed on brainypi

Installing Jenkins to the BrainyPi

1. Before installing, we need to add the Jenkins repository key to our Pi’s key chain.

curl https://pkg.jenkins.io/debian/jenkins.io.key | gpg --dearmor | sudo tee /usr/share/keyrings/jenkins-archive-keyring.gpg >/dev/null

2. next step is to add the repository into our sources list.

We will do this by making a file called “jenkins.list” within the “/sources.list.d/” directory using the following command.

sudo nano /etc/apt/sources.list.d/jenkins.list

3. Add the following text to the file. This text defines the link to the Jenkins repository.

deb [signed-by=/usr/share/keyrings/jenkins-archive-keyring.gpg] https://pkg.jenkins.io/debian binary/

Once added, save the file by pressing CTRL + X, then Y, followed by ENTER.

4. Before installing jenkins update the system once by command

sudo apt update 

5. To install Jenkins use the command

sudo apt install jenkins

With this, we have successfully installed the Jenkins on Brainy Pi

Web Interface

WhatsApp Image 2023-01-17 at 10.53.15 - Copy.jpeg

To access the web interface, we need to IP address of Brainy Pi

1. To find IP address of you pi use command

hostname -I

If you are getting multiple ip addresses, then no need to worry you can use any one

2. Next, we need to retrieve the initial admin password. you do that by command

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

The password will be in format of

9df8c9c4cf694754a0047771a53b9fe8

3. To access the web interface go to your favorite browser and search

[BRAINYPIIPADDRESS]:8080

This will open the web interface of Jenkins

In the first window, it will ask for the Administrator password to unlock the jenkins. Here you to give the password which you retrieved earlier.

Jenkins Web Setup

90147caa-f2e8-458f-9105-4280b1b59444.jpg
Screenshot 2023-01-12 141018.png

1. The next screen will ask you if you want to install the suggested plugins or select them for yourself. For this guide, we are just going to click the “Install suggested plugins” button

2. Next, you will be asked to create an admin user to interact with your Brainy Pi Jenkins installation fill in the details then click on continue the process.

3. The next tab will ask you to verify the URL it has generated for your Jenkins installation. This URL should be your Brainy Pi’s IP address followed by the port number 8080.

de672ad0-24cb-462c-ac69-0965c2286fb2.jpg
Deploy-Jenkins-to-an-Azure-VM2.png
WhatsApp Image 2023-01-17 at 22.10.24 - Copy.jpeg
f8df81c3-f918-44a0-a6bc-1d0eddf05e62.jpg

After this next process will take time around 5 mins then it is ready to use

Now Jenkins is ready to use you can explore the web interface and create jobs and other stuff